diff --git a/admin/auth.php b/admin/auth.php index 61afb67c19f4a..41faab54ddc43 100644 --- a/admin/auth.php +++ b/admin/auth.php @@ -30,7 +30,7 @@ } if (!empty($auth) and !exists_auth_plugin($auth)) { - error(get_string('pluginnotinstalled', 'auth', $auth), $url); + print_error('pluginnotinstalled', 'auth', $url, $auth); } //////////////////////////////////////////////////////////////////////////////// @@ -67,7 +67,7 @@ $key = array_search($auth, $authsenabled); // check auth plugin is valid if ($key === false) { - error(get_string('pluginnotenabled', 'auth', $auth), $url); + print_error('pluginnotenabled', 'auth', $url, $auth); } // move down the list if ($key < (count($authsenabled) - 1)) { @@ -82,7 +82,7 @@ $key = array_search($auth, $authsenabled); // check auth is valid if ($key === false) { - error(get_string('pluginnotenabled', 'auth', $auth), $url); + print_error('pluginnotenabled', 'auth', $url, $auth); } // move up the list if ($key >= 1) { diff --git a/admin/cron.php b/admin/cron.php index f5f49bb664d41..3ace8d8f1833c 100644 --- a/admin/cron.php +++ b/admin/cron.php @@ -20,7 +20,7 @@ /// Do not set moodle cookie because we do not need it here, it is better to emulate session - $nomoodlecookie = true; + define('NO_MOODLE_COOKIES', true); /// The current directory in PHP version 4.3.0 and above isn't necessarily the /// directory of the script when run from the command line. The require_once() @@ -66,7 +66,6 @@ /// emulate normal session - $SESSION = new object(); $USER = get_admin(); /// Temporarily, to provide environment for this script /// ignore admins timezone, language and locale - use site deafult instead! diff --git a/admin/enrol.php b/admin/enrol.php index 8e0cfdfd6bf42..14b75d6b10d09 100644 --- a/admin/enrol.php +++ b/admin/enrol.php @@ -18,7 +18,7 @@ if ($frm = data_submitted()) { if (!confirm_sesskey()) { - error(get_string('confirmsesskeybad', 'error')); + print_error('confirmsesskeybad', 'error'); } if (empty($frm->enable)) { $frm->enable = array(); @@ -103,4 +103,4 @@ admin_externalpage_print_footer(); -?> \ No newline at end of file +?> diff --git a/admin/mnet/index.php b/admin/mnet/index.php index a281f1cec0960..d03efaa566090 100644 --- a/admin/mnet/index.php +++ b/admin/mnet/index.php @@ -48,7 +48,7 @@ } } elseif (!empty($form->submit) && $form->submit == get_string('delete')) { $MNET->get_private_key(); - $_SESSION['mnet_confirm_delete_key'] = md5(sha1($MNET->keypair['keypair_PEM'])).':'.time(); + $SESSION->mnet_confirm_delete_key = md5(sha1($MNET->keypair['keypair_PEM'])).':'.time(); notice_yesno(get_string("deletekeycheck", "mnet"), "index.php?sesskey=$USER->sesskey&confirm=".md5($MNET->public_key), "index.php", @@ -61,13 +61,13 @@ // We're deleting - if (!isset($_SESSION['mnet_confirm_delete_key'])) { + if (!isset($SESSION->mnet_confirm_delete_key)) { // fail - you're being attacked? } $key = ''; $time = ''; - @list($key, $time) = explode(':',$_SESSION['mnet_confirm_delete_key']); + @list($key, $time) = explode(':',$SESSION->mnet_confirm_delete_key); $MNET->get_private_key(); if($time < time() - 60) { diff --git a/admin/module.php b/admin/module.php index 3b2c8cc99e9b6..e503b8292e0a5 100644 --- a/admin/module.php +++ b/admin/module.php @@ -10,7 +10,7 @@ $module = optional_param('module', '', PARAM_SAFEDIR); if (!confirm_sesskey()) { - error(get_string('confirmsesskeybad', 'error')); + print_error('confirmsesskeybad', 'error'); } if ($module != '') { diff --git a/auth/cas/cas_ldap_sync_users.php b/auth/cas/cas_ldap_sync_users.php index e1cc5acd4c20c..9abc5fc095866 100644 --- a/auth/cas/cas_ldap_sync_users.php +++ b/auth/cas/cas_ldap_sync_users.php @@ -27,7 +27,7 @@ exit; } -$nomoodlecookie = true; // cookie not needed +define('NO_MOODLE_COOKIES', true); require_once(dirname(dirname(dirname(__FILE__))).'/config.php'); // global moodle config file. diff --git a/auth/db/auth_db_sync_users.php b/auth/db/auth_db_sync_users.php index b4e22aa4b829e..8ed5de05bc417 100644 --- a/auth/db/auth_db_sync_users.php +++ b/auth/db/auth_db_sync_users.php @@ -27,7 +27,7 @@ exit; } -$nomoodlecookie = true; // cookie not needed +define('NO_MOODLE_COOKIES', true); require_once(dirname(dirname(dirname(__FILE__))).'/config.php'); // global moodle config file. diff --git a/auth/ldap/auth.php b/auth/ldap/auth.php index 5ea3f315e8f69..8b8d1cf62baeb 100644 --- a/auth/ldap/auth.php +++ b/auth/ldap/auth.php @@ -1764,7 +1764,7 @@ function loginpage_hook() { * * NOTE that this code will execute under the OS user credentials, * so we MUST avoid dealing with files -- such as session files. - * (The caller should set $nomoodlecookie before including config.php) + * (The caller should define('NO_MOODLE_COOKIES', true) before including config.php) * */ function ntlmsso_magic($sesskey) { diff --git a/auth/ldap/auth_ldap_sync_users.php b/auth/ldap/auth_ldap_sync_users.php index 8b764242c7562..528d3556d7534 100755 --- a/auth/ldap/auth_ldap_sync_users.php +++ b/auth/ldap/auth_ldap_sync_users.php @@ -26,7 +26,7 @@ exit; } -$nomoodlecookie = true; // cookie not needed +define('NO_MOODLE_COOKIES', true); require_once(dirname(dirname(dirname(__FILE__))).'/config.php'); // global moodle config file. diff --git a/auth/ldap/ntlmsso_magic.php b/auth/ldap/ntlmsso_magic.php index 79077ef2b3f44..fc1120e05efcf 100644 --- a/auth/ldap/ntlmsso_magic.php +++ b/auth/ldap/ntlmsso_magic.php @@ -4,7 +4,7 @@ // as we will be executing under the OS security // context of the user we are trying to login, rather than // of the webserver. -$nomoodlecookie=true; +define('NO_MOODLE_COOKIES', true); require_once(dirname(dirname(dirname(__FILE__)))."/config.php"); diff --git a/auth/shibboleth/index.php b/auth/shibboleth/index.php index 3cf39a78495c5..90ba89a7b941f 100644 --- a/auth/shibboleth/index.php +++ b/auth/shibboleth/index.php @@ -43,7 +43,7 @@ update_user_login_times(); // Don't show username on login page - set_moodle_cookie('nobody'); + $SESSION->set_moodle_cookie('nobody'); set_login_session_preferences(); diff --git a/auth/shibboleth/login.php b/auth/shibboleth/login.php index ff6de2dbf563a..7f7c03212501e 100644 --- a/auth/shibboleth/login.php +++ b/auth/shibboleth/login.php @@ -38,8 +38,8 @@ $loginurl = (!empty($CFG->alternateloginurl)) ? $CFG->alternateloginurl : ''; - if (get_moodle_cookie() == '') { - set_moodle_cookie('nobody'); // To help search for cookies + if ($SESSION->get_moodle_cookie() == '') { + $SESSION->set_moodle_cookie('nobody'); // To help search for cookies } if (!empty($CFG->registerauth) or is_enabled_auth('none') or !empty($CFG->auth_instructions)) { diff --git a/backup/db/mysql.php b/backup/db/mysql.php deleted file mode 100644 index af93afa8a6275..0000000000000 --- a/backup/db/mysql.php +++ /dev/null @@ -1,163 +0,0 @@ -prefix}backup_ids` ( - `backup_code` INT(12) UNSIGNED NOT NULL, - `table_name` VARCHAR(30) NOT NULL, - `old_id` INT(10) UNSIGNED NOT NULL, - `new_id` INT(10) UNSIGNED, - PRIMARY KEY (`backup_code`, `table_name`, `old_id`) - ) - COMMENT = 'To store and convert ids in backup/restore'"); - } - - if ($oldversion < 2003050301 and $result) { - $result = execute_sql("ALTER TABLE `{$CFG->prefix}backup_ids` - ADD `info` VARCHAR(30)"); - } - - if ($oldversion < 2003050400 and $result) { - $result = execute_sql("ALTER TABLE `{$CFG->prefix}backup_ids` - MODIFY `info` VARCHAR(255)"); - } - - if ($oldversion < 2003050401 and $result) { - $result = execute_sql("CREATE TABLE `{$CFG->prefix}backup_files` ( - `backup_code` INT( 10 ) UNSIGNED NOT NULL , - `file_type` VARCHAR( 10 ) NOT NULL , - `path` VARCHAR( 255 ) NOT NULL , - `old_id` INT( 10 ) UNSIGNED, - `new_id` INT( 10 ) UNSIGNED, - PRIMARY KEY ( `backup_code` , `file_type` , `path` ) - ) COMMENT = 'To store and recode ids to user & course files.'"); - } - - if ($oldversion < 2003052000 and $result) { - $result = execute_sql("ALTER TABLE `{$CFG->prefix}backup_ids` - MODIFY `info` TEXT"); - } - - if ($oldversion < 2003061100 and $result) { - $result = execute_sql("ALTER TABLE `{$CFG->prefix}backup_ids` - MODIFY `info` MEDIUMTEXT"); - } - - if ($oldversion < 2003082600 and $result) { - print_simple_box("This is the first non-alpha release of the Backup/Restore module.

Thanks for upgrading!","center", "50%", '', "20", "noticebox"); - } - - if ($oldversion < 2003112700 and $result) { - $result = execute_sql("CREATE TABLE `{$CFG->prefix}backup_config` ( - `id` int(10) unsigned NOT NULL auto_increment, - `name` varchar(255) NOT NULL default '', - `value` varchar(255) NOT NULL default '', - PRIMARY KEY (`id`), - UNIQUE KEY `name` (`name`) - ) TYPE=MyISAM COMMENT='To store backup configuration variables'"); - } - - if ($oldversion < 2003120800 and $result) { - $result = execute_sql("CREATE TABLE `{$CFG->prefix}backup_courses` ( - `id` int(10) unsigned NOT NULL auto_increment, - `courseid` int(10) unsigned NOT NULL default '0', - `laststarttime` int(10) unsigned NOT NULL default '0', - `lastendtime` int(10) unsigned NOT NULL default '0', - `laststatus` varchar(1) NOT NULL default '0', - `nextstarttime` int(10) unsigned NOT NULL default '0', - PRIMARY KEY (`id`), - UNIQUE KEY `courseid` (`courseid`) - ) TYPE=MyISAM COMMENT='To store every course backup status'"); - - if ($result) { - $result = execute_sql("CREATE TABLE `{$CFG->prefix}backup_log` ( - `id` int(10) unsigned NOT NULL auto_increment, - `courseid` int(10) unsigned NOT NULL default '0', - `time` int(10) unsigned NOT NULL default '0', - `laststarttime` int(10) unsigned NOT NULL default '0', - `info` varchar(255) NOT NULL default '', - PRIMARY KEY (`id`) - ) TYPE=MyISAM COMMENT='To store every course backup log info'"); - } - } - - if ($oldversion < 2006011600 and $result) { - $result = execute_sql("DROP TABLE {$CFG->prefix}backup_files"); - if ($result) { - $result = execute_sql("CREATE TABLE `{$CFG->prefix}backup_files` ( - `id` int(10) unsigned NOT NULL auto_increment, - `backup_code` int(10) unsigned NOT NULL default '0', - `file_type` varchar(10) NOT NULL default '', - `path` varchar(255) NOT NULL default '', - `old_id` int(10) unsigned NOT NULL default '0', - `new_id` int(10) unsigned NOT NULL default '0', - PRIMARY KEY (`id`), - UNIQUE KEY `{$CFG->prefix}backup_files_uk` (`backup_code`,`file_type`,`path`) - ) TYPE=MyISAM COMMENT='To store and recode ids to user and course files.'"); - } - if ($result) { - $result = execute_sql("DROP TABLE {$CFG->prefix}backup_ids"); - } - if ($result) { - $result = execute_sql("CREATE TABLE `{$CFG->prefix}backup_ids` ( - `id` int(10) unsigned NOT NULL auto_increment, - `backup_code` int(12) unsigned NOT NULL default '0', - `table_name` varchar(30) NOT NULL default '', - `old_id` int(10) unsigned NOT NULL default '0', - `new_id` int(10) unsigned NOT NULL default '0', - `info` mediumtext, - PRIMARY KEY (`id`), - UNIQUE KEY `{$CFG->prefix}backup_ids_uk` (`backup_code` ,`table_name`,`old_id`) - ) TYPE=MyISAM COMMENT='To store and convert ids in backup/restore'"); - } - } - - - // code to drop the prefix in tables - if ($oldversion < 2006042100) { - // see bug 5205, silent drops, so should not panic anyone - $result = execute_sql("ALTER TABLE {$CFG->prefix}backup_files DROP INDEX backup_files_uk", false); - $result = execute_sql("ALTER TABLE {$CFG->prefix}backup_files DROP INDEX {$CFG->prefix}backup_files_uk", false); - $result = execute_sql("ALTER TABLE {$CFG->prefix}backup_ids DROP INDEX backup_ids_uk", false); - $result = execute_sql("ALTER TABLE {$CFG->prefix}backup_ids DROP INDEX {$CFG->prefix}backup_ids_uk", false); - $result = execute_sql("ALTER TABLE {$CFG->prefix}backup_files ADD UNIQUE INDEX backup_files_uk(backup_code,file_type(10),path(255))"); - $result = execute_sql("ALTER TABLE {$CFG->prefix}backup_ids ADD UNIQUE INDEX backup_ids_uk(backup_code,table_name(30),old_id)"); - } - - // chaing default nulls to not null default 0 - - if ($oldversion < 2006042800) { - - execute_sql("UPDATE {$CFG->prefix}backup_files SET old_id='0' WHERE old_id IS NULL"); - table_column('backup_files','old_id','old_id','int','10','unsigned','0','not null'); - - execute_sql("UPDATE {$CFG->prefix}backup_files SET new_id='0' WHERE new_id IS NULL"); - table_column('backup_files','new_id','new_id','int','10','unsigned','0','not null'); - - execute_sql("UPDATE {$CFG->prefix}backup_ids SET new_id='0' WHERE new_id IS NULL"); - table_column('backup_ids','new_id','new_id','int','10','unsigned','0','not null'); - - execute_sql("UPDATE {$CFG->prefix}backup_ids SET info='' WHERE info IS NULL"); - table_column('backup_ids','info','info','mediumtext','','','','not null'); - } - - ////// DO NOT ADD NEW THINGS HERE!! USE upgrade.php and the lib/ddllib.php functions. - - //Finally, return result - return $result; - -} - -?> diff --git a/backup/db/postgres7.php b/backup/db/postgres7.php deleted file mode 100644 index 87fa622507ebc..0000000000000 --- a/backup/db/postgres7.php +++ /dev/null @@ -1,59 +0,0 @@ -prefix}backup_files"); - if ($result) { - $result = execute_sql("CREATE TABLE {$CFG->prefix}backup_files ( - id SERIAL PRIMARY KEY, - backup_code integer NOT NULL default '0', - file_type varchar(10) NOT NULL default '', - path varchar(255) NOT NULL default '', - old_id integer default NULL, - new_id integer default NULL, - CONSTRAINT {$CFG->prefix}backup_files_uk UNIQUE (backup_code, file_type, path))"); - } - if ($result) { - $result = execute_sql("DROP TABLE {$CFG->prefix}backup_ids"); - } - if ($result) { - $result = execute_sql("CREATE TABLE {$CFG->prefix}backup_ids ( - id SERIAL PRIMARY KEY, - backup_code integer NOT NULL default '0', - table_name varchar(30) NOT NULL default '', - old_id integer NOT NULL default '0', - new_id integer default NULL, - info text, - CONSTRAINT {$CFG->prefix}backup_ids_uk UNIQUE (backup_code, table_name, old_id))"); - } - } - - if ($oldversion < 2006042801) { - table_column('backup_log', 'time', 'time', 'integer', '', '', '0'); - table_column('backup_log', 'laststarttime', 'laststarttime', 'integer', '', '', '0'); - table_column('backup_log', 'courseid', 'courseid', 'integer', '', '', '0'); - - table_column('backup_courses', 'lastendtime', 'lastendtime', 'integer', '', '', '0'); - table_column('backup_courses', 'laststarttime', 'laststarttime', 'integer', '', '', '0'); - table_column('backup_courses', 'courseid', 'courseid', 'integer', '', '', '0'); - table_column('backup_courses', 'nextstarttime', 'nextstarttime', 'integer', '', '', '0'); - } - - ////// DO NOT ADD NEW THINGS HERE!! USE upgrade.php and the lib/ddllib.php functions. - - //Finally, return result - return $result; - -} - -?> diff --git a/blocks/activity_modules/db/mysql.php b/blocks/activity_modules/db/mysql.php deleted file mode 100644 index 1549db4838f02..0000000000000 --- a/blocks/activity_modules/db/mysql.php +++ /dev/null @@ -1,23 +0,0 @@ - \ No newline at end of file +?> diff --git a/blocks/calendar_month/db/mysql.php b/blocks/calendar_month/db/mysql.php deleted file mode 100644 index 4e529bef17ddd..0000000000000 --- a/blocks/calendar_month/db/mysql.php +++ /dev/null @@ -1,24 +0,0 @@ -prefix}blocks` ( - `id` int(10) unsigned NOT NULL auto_increment, - `name` varchar(40) NOT NULL default '', - `version` int(10) NOT NULL default '0', - `cron` int(10) unsigned NOT NULL default '0', - `lastcron` int(10) unsigned NOT NULL default '0', - `visible` tinyint(1) NOT NULL default '1', - PRIMARY KEY (`id`) - ) - COMMENT = 'To register and update all the available blocks'"); - } - - if ($oldversion < 2004101900 && $result) { - $result = execute_sql("CREATE TABLE `{$CFG->prefix}block` ( - `id` int(10) unsigned NOT NULL auto_increment, - `name` varchar(40) NOT NULL default '', - `version` int(10) NOT NULL default '0', - `cron` int(10) unsigned NOT NULL default '0', - `lastcron` int(10) unsigned NOT NULL default '0', - `visible` tinyint(1) NOT NULL default '1', - `multiple` tinyint(1) NOT NULL default '0', - PRIMARY KEY (`id`) - ) - COMMENT = 'To register and update all the available blocks'"); - - if(!$result) { - return false; - } - - $records = get_records('blocks'); - if(!empty($records)) { - foreach($records as $block) { - $block->multiple = 0; - insert_record('block', $block, false); - } - } - - execute_sql("DROP TABLE `{$CFG->prefix}blocks`"); - - $result = execute_sql("CREATE TABLE `{$CFG->prefix}block_instance` ( - `id` int(10) not null auto_increment, - `blockid` int(10) not null default '0', - `pageid` int(10) not null default '0', - `pagetype` varchar(12) not null default '', - `position` enum('l', 'r') not null default 'l', - `weight` tinyint(3) not null default '0', - `visible` tinyint(1) not null default '0', - `configdata` text not null default '', - - PRIMARY KEY(`id`), - INDEX pageid(`pageid`) - )"); - - if(!$result) { - return false; - } - - $records = get_records('course', '','','', 'id, shortname, blockinfo'); - if(!empty($records)) { - foreach($records as $thiscourse) { - // The @ suppresses a notice emitted if there is no : in the string - @list($left, $right) = split(':', $thiscourse->blockinfo); - if(!empty($left)) { - $arr = explode(',', $left); - foreach($arr as $weight => $blk) { - $instance = new stdClass; - $instance->blockid = abs($blk); - $instance->pageid = $thiscourse->id; - $instance->pagetype = PAGE_COURSE_VIEW; - $instance->position = BLOCK_POS_LEFT; - $instance->weight = $weight; - $instance->visible = ($blk > 0) ? 1 : 0; - $instance->configdata = ''; - insert_record('block_instance', $instance, false); - } - } - if(!empty($right)) { - $arr = explode(',', $right); - foreach($arr as $weight => $blk) { - $instance = new stdClass; - $instance->blockid = abs($blk); - $instance->pageid = $thiscourse->id; - $instance->pagetype = PAGE_COURSE_VIEW; - $instance->position = BLOCK_POS_RIGHT; - $instance->weight = $weight; - $instance->visible = ($blk > 0) ? 1 : 0; - $instance->configdata = ''; - insert_record('block_instance', $instance, false); - } - } - } - } - - execute_sql("ALTER TABLE `{$CFG->prefix}course` DROP COLUMN blockinfo"); - } - - if ($oldversion < 2004112900 && $result) { - $result = $result && table_column('block_instance', 'pagetype', 'pagetype', 'varchar', '20', ''); - $result = $result && table_column('block_instance', 'position', 'position', 'varchar', '10', ''); - } - - if ($oldversion < 2004112900 && $result) { - execute_sql('UPDATE '.$CFG->prefix.'block_instance SET pagetype = \''.PAGE_COURSE_VIEW.'\' WHERE pagetype = \'\''); - } - - if ($oldversion < 2005043000 && $result) { - $records = get_records('block'); - if(!empty($records)) { - foreach($records as $block) { - if(!block_is_compatible($block->name)) { - $block->visible = 0; - update_record('block', $block); - notify('The '.$block->name.' block has been disabled because it is not compatible with Moodle 1.5 and needs to be updated by a programmer.'); - } - } - } - } - - if ($oldversion < 2005081600) { - $result = $result && modify_database('',"CREATE TABLE `prefix_block_pinned` ( - `id` int(10) not null auto_increment, - `blockid` int(10) not null default '0', - `pagetype` varchar(20) not null default '', - `position` varchar(10) not null default '', - `weight` tinyint(3) not null default '0', - `visible` tinyint(1) not null default '0', - `configdata` text not null default '', - PRIMARY KEY(`id`) - ) TYPE=MyISAM;"); - } - - if ($oldversion < 2005090200) { - execute_sql("ALTER TABLE {$CFG->prefix}block_instance ADD INDEX pagetype (pagetype);",false); // do it silently, in case it's already there from 1.5 - modify_database('','ALTER TABLE prefix_block_pinned ADD INDEX pagetype (pagetype);'); - } - - ////// DO NOT ADD NEW THINGS HERE!! USE upgrade.php and the lib/ddllib.php functions. - - //Finally, return result - return $result; -} -?> diff --git a/blocks/db/postgres7.php b/blocks/db/postgres7.php deleted file mode 100644 index 6122508413d40..0000000000000 --- a/blocks/db/postgres7.php +++ /dev/null @@ -1,160 +0,0 @@ -prefix}blocks - ( - id SERIAL8 PRIMARY KEY, - name varchar(40) NOT NULL default '', - version INT8 NOT NULL default '0', - cron INT8 NOT NULL default '0', - lastcron INT8 NOT NULL default '0', - visible int NOT NULL default '1' - ) - ") ; - - } - - if ($oldversion < 2004101900 && $result) { - $result = execute_sql("CREATE TABLE {$CFG->prefix}block ( - id SERIAL8 PRIMARY KEY, - name varchar(40) NOT NULL default '', - version INT8 NOT NULL default '0', - cron INT8 NOT NULL default '0', - lastcron INT8 NOT NULL default '0', - visible int NOT NULL default '1', - multiple int NOT NULL default '0' - ) - "); - - if(!$result) { - return false; - } - - $records = get_records('blocks'); - if(!empty($records)) { - foreach($records as $block) { - $block->multiple = 0; - insert_record('block', $block, false); - } - execute_sql("SELECT setval('{$CFG->prefix}block_id_seq', (SELECT MAX(id) FROM {$CFG->prefix}block), true)"); - } - - execute_sql("DROP TABLE {$CFG->prefix}blocks"); - - $result = execute_sql("CREATE TABLE {$CFG->prefix}block_instance ( - id SERIAL8 PRIMARY KEY, - blockid INT8 not null default '0', - pageid INT8 not null default '0', - pagetype varchar(12) not null default '', - position char not null default 'l' check (position in ('l', 'r')) , - weight int not null default '0', - visible int not null default '0', - configdata text not null default '' - )"); - - if(!$result) { - return false; - } - - $records = get_records('course', '','','', 'id, shortname, blockinfo'); - if(!empty($records)) { - foreach($records as $thiscourse) { - // The @ suppresses a notice emitted if there is no : in the string - @list($left, $right) = split(':', $thiscourse->blockinfo); - if(!empty($left)) { - $arr = explode(',', $left); - foreach($arr as $weight => $blk) { - $instance = new stdClass; - $instance->blockid = abs($blk); - $instance->pageid = $thiscourse->id; - $instance->pagetype = PAGE_COURSE_VIEW; - $instance->position = BLOCK_POS_LEFT; - $instance->weight = $weight; - $instance->visible = ($blk > 0) ? 1 : 0; - $instance->configdata = ''; - insert_record('block_instance', $instance, false); - } - } - if(!empty($right)) { - $arr = explode(',', $right); - foreach($arr as $weight => $blk) { - $instance = new stdClass; - $instance->blockid = abs($blk); - $instance->pageid = $thiscourse->id; - $instance->pagetype = PAGE_COURSE_VIEW; - $instance->position = BLOCK_POS_RIGHT; - $instance->weight = $weight; - $instance->visible = ($blk > 0) ? 1 : 0; - $instance->configdata = ''; - insert_record('block_instance', $instance, false); - } - } - } - } - - execute_sql("ALTER TABLE {$CFG->prefix}course DROP COLUMN blockinfo"); - } - - if ($oldversion < 2004112900 && $result) { - $result = $result && table_column('block_instance', 'pagetype', 'pagetype', 'varchar', '20', ''); - $result = $result && table_column('block_instance', 'position', 'position', 'varchar', '10', ''); - } - - if ($oldversion < 2005043000 && $result) { - $records = get_records('block'); - if(!empty($records)) { - foreach($records as $block) { - if(!block_is_compatible($block->name)) { - $block->visible = 0; - update_record('block', $block); - notify('The '.$block->name.' block has been disabled because it is not compatible with Moodle 1.5 and needs to be updated by a programmer.'); - } - } - } - } - - if ($oldversion < 2005022401 && $result) { // Mass cleanup of bad upgrade scripts - execute_sql("CREATE INDEX {$CFG->prefix}block_instance_pageid_idx ON {$CFG->prefix}block_instance (pageid)",false); // this one should be quiet... - modify_database('','ALTER TABLE prefix_block_instance ALTER pagetype SET DEFAULT \'\''); - modify_database('','ALTER TABLE prefix_block_instance ALTER position SET DEFAULT \'\''); - modify_database('','ALTER TABLE prefix_block_instance ALTER pagetype SET NOT NULL'); - modify_database('','ALTER TABLE prefix_block_instance ALTER position SET NOT NULL'); - } - - if ($oldversion < 2005081600) { - modify_database('',"CREATE TABLE prefix_block_pinned ( - id SERIAL8 PRIMARY KEY, - blockid INT8 NOT NULL default 0, - pagetype varchar(20) NOT NULL default '', - position varchar(10) NOT NULL default '', - weight INT NOT NULL default 0, - visible INT NOT NULL default 0, - configdata text NOT NULL default 0 - );"); - } - - if ($oldversion < 2005090200) { - execute_sql("CREATE INDEX {$CFG->prefix}block_instance_pagetype_idx ON {$CFG->prefix}block_instance (pagetype);",false); // do it silently, in case it's already there from 1.5 - modify_database('','CREATE INDEX prefix_block_pinned_pagetype_idx ON prefix_block_pinned (pagetype);'); - } - - ////// DO NOT ADD NEW THINGS HERE!! USE upgrade.php and the lib/ddllib.php functions. - - //Finally, return result - return $result; -} -?> diff --git a/blocks/news_items/db/mysql.php b/blocks/news_items/db/mysql.php deleted file mode 100644 index 2728665f0d03e..0000000000000 --- a/blocks/news_items/db/mysql.php +++ /dev/null @@ -1,24 +0,0 @@ -id; - } else { - $adminsql .= ' OR userid = '.$admin->id; - } - $count++; - } - if ($rssfeeds = get_records_select('block_rss_client', $adminsql)) { - foreach ($rssfeeds as $rssfeed) { - if (!set_field('block_rss_client', 'shared', 1)) { - notice('Could not set '.$rssfeed->title.' as a shared RSS feed.'); - } - } - } - } - } - -/// see MDL-6707 for more info about problem that was here - - if ($oldversion < 2006100101) { - - // Upgrade block to use the Roles System. - $block = get_record('block', 'name', 'rss_client'); - - if ($blockinstances = get_records('block_instance', 'blockid', $block->id)) { - - if (!$adminroles = get_roles_with_capability('moodle/legacy:admin', CAP_ALLOW)) { - notice('Default student role was not found. Roles and permissions '. - 'for all your Remote RSS Feed blocks will have to be '. - 'manually set after this upgrade.'); - } - if (!$teacherroles = get_roles_with_capability('moodle/legacy:teacher', CAP_ALLOW)) { - notice('Default teacher role was not found. Roles and permissions '. - 'for all your Remote RSS Feed blocks will have to be '. - 'manually set after this upgrade.'); - } - if (!$studentroles = get_roles_with_capability('moodle/legacy:student', CAP_ALLOW)) { - notice('Default student role was not found. Roles and permissions '. - 'for all your Remote RSS Feed blocks will have to be '. - 'manually set after this upgrade.'); - } - - foreach ($blockinstances as $bi) { - $context = get_context_instance(CONTEXT_BLOCK, $bi->id); - - if ($bi->pagetype == 'course-view' && $bi->pageid == SITEID) { - - // Only the admin was allowed to manage the RSS feed block - // on the site home page. - - // Since this is already the default behavior set in - // blocks/rss_client/db/access.php, we don't need to - // specifically assign the capabilities here. - - } else { - - // Who can add shared feeds? This was defined in lib/rsslib.php - // for config var block_rss_client_submitters. - switch ($CFG->block_rss_client_submitters) { - - case 0: - // SUBMITTERS_ALL_ACCOUNT_HOLDERS - - foreach ($adminroles as $adminrole) { - assign_capability('block/rss_client:createsharedfeeds', CAP_ALLOW, $adminrole->id, $context->id); - } - foreach ($teacherroles as $teacherrole) { - assign_capability('block/rss_client:createsharedfeeds', CAP_ALLOW, $teacherrole->id, $context->id); - } - foreach ($studentroles as $studentrole) { - assign_capability('block/rss_client:createsharedfeeds', CAP_ALLOW, $studentrole->id, $context->id); - } - break; - - case 1: - // SUBMITTERS_ADMIN_ONLY - - // Since this is already the default behavior set in - // blocks/rss_client/db/access.php, we don't need to - // specifically assign the capabilities here. - break; - - case 2: - // SUBMITTERS_ADMIN_AND_TEACHER - - foreach ($adminroles as $adminrole) { - assign_capability('block/rss_client:createsharedfeeds', CAP_ALLOW, $adminrole->id, $context->id); - } - foreach ($teacherroles as $teacherrole) { - assign_capability('block/rss_client:createsharedfeeds', CAP_ALLOW, $teacherrole->id, $context->id); - } - foreach ($studentroles as $studentrole) { - assign_capability('block/rss_client:createsharedfeeds', CAP_PREVENT, $studentrole->id, $context->id); - } - break; - - } // End switch. - - } - } - } - } - - ////// DO NOT ADD NEW THINGS HERE!! USE upgrade.php and the lib/ddllib.php functions. - - return true; -} - -?> diff --git a/blocks/rss_client/db/postgres7.php b/blocks/rss_client/db/postgres7.php deleted file mode 100644 index 4204ed8bafe3a..0000000000000 --- a/blocks/rss_client/db/postgres7.php +++ /dev/null @@ -1,145 +0,0 @@ -id; - } else { - $adminsql .= ' OR userid = '.$admin->id; - } - $count++; - } - if ($rssfeeds = get_records_select('block_rss_client', $adminsql)) { - foreach ($rssfeeds as $rssfeed) { - if (!set_field('block_rss_client', 'shared', 1)) { - notice('Could not set '.$rssfeed->title.' as a shared RSS feed.'); - } - } - } - } - } - -/// see MDL-6707 for more info about problem that was here - - if ($oldversion < 2006100101) { - - // Upgrade block to use the Roles System. - $block = get_record('block', 'name', 'rss_client'); - - if ($blockinstances = get_records('block_instance', 'blockid', $block->id)) { - - if (!$adminroles = get_roles_with_capability('moodle/legacy:admin', CAP_ALLOW)) { - notice('Default student role was not found. Roles and permissions '. - 'for all your Remote RSS Feed blocks will have to be '. - 'manually set after this upgrade.'); - } - if (!$teacherroles = get_roles_with_capability('moodle/legacy:teacher', CAP_ALLOW)) { - notice('Default teacher role was not found. Roles and permissions '. - 'for all your Remote RSS Feed blocks will have to be '. - 'manually set after this upgrade.'); - } - if (!$studentroles = get_roles_with_capability('moodle/legacy:student', CAP_ALLOW)) { - notice('Default student role was not found. Roles and permissions '. - 'for all your Remote RSS Feed blocks will have to be '. - 'manually set after this upgrade.'); - } - - foreach ($blockinstances as $bi) { - $context = get_context_instance(CONTEXT_BLOCK, $bi->id); - - if ($bi->pagetype == 'course-view' && $bi->pageid == SITEID) { - - // Only the admin was allowed to manage the RSS feed block - // on the site home page. - - // Since this is already the default behavior set in - // blocks/rss_client/db/access.php, we don't need to - // specifically assign the capabilities here. - - } else { - - // Who can add shared feeds? This was defined in lib/rsslib.php - // for config var block_rss_client_submitters. - switch ($CFG->block_rss_client_submitters) { - - case 0: - // SUBMITTERS_ALL_ACCOUNT_HOLDERS - - foreach ($adminroles as $adminrole) { - assign_capability('block/rss_client:createsharedfeeds', CAP_ALLOW, $adminrole->id, $context->id); - } - foreach ($teacherroles as $teacherrole) { - assign_capability('block/rss_client:createsharedfeeds', CAP_ALLOW, $teacherrole->id, $context->id); - } - foreach ($studentroles as $studentrole) { - assign_capability('block/rss_client:createsharedfeeds', CAP_ALLOW, $studentrole->id, $context->id); - } - break; - - case 1: - // SUBMITTERS_ADMIN_ONLY - - // Since this is already the default behavior set in - // blocks/rss_client/db/access.php, we don't need to - // specifically assign the capabilities here. - break; - - case 2: - // SUBMITTERS_ADMIN_AND_TEACHER - - foreach ($adminroles as $adminrole) { - assign_capability('block/rss_client:createsharedfeeds', CAP_ALLOW, $adminrole->id, $context->id); - } - foreach ($teacherroles as $teacherrole) { - assign_capability('block/rss_client:createsharedfeeds', CAP_ALLOW, $teacherrole->id, $context->id); - } - foreach ($studentroles as $studentrole) { - assign_capability('block/rss_client:createsharedfeeds', CAP_PREVENT, $studentrole->id, $context->id); - } - break; - - } // End switch. - - } - } - } - } - - ////// DO NOT ADD NEW THINGS HERE!! USE upgrade.php and the lib/ddllib.php functions. - - return true; -} - -?> diff --git a/blocks/search/block_search.php b/blocks/search/block_search.php index e021f9924353c..65fabe23c9f54 100644 --- a/blocks/search/block_search.php +++ b/blocks/search/block_search.php @@ -81,4 +81,4 @@ function cron(){ } //block_search -?> \ No newline at end of file +?> diff --git a/blocks/search/db/install.xml b/blocks/search/db/install.xml index 234e77e147986..b118e4e1b2ced 100644 --- a/blocks/search/db/install.xml +++ b/blocks/search/db/install.xml @@ -12,8 +12,8 @@ - - + + diff --git a/blocks/search_forums/db/mysql.php b/blocks/search_forums/db/mysql.php deleted file mode 100644 index 5161f4f667f83..0000000000000 --- a/blocks/search_forums/db/mysql.php +++ /dev/null @@ -1,24 +0,0 @@ -ajaxcapable = true; -$CFG->ajaxtestedbrowsers = array('MSIE' => 6.0, 'Gecko' => 20061111); - -?> diff --git a/course/format/topicscss/format.php b/course/format/topicscss/format.php deleted file mode 100644 index b4a62b729f668..0000000000000 --- a/course/format/topicscss/format.php +++ /dev/null @@ -1,301 +0,0 @@ - and with DIVs; inline styles. - * 3. Reorder columns so that in linear view content is first then blocks; - * styles to maintain original graphical (side by side) view. - * - * Target: 3-column graphical view using relative widths for pixel screen sizes - * 800x600, 1024x768... on IE6, Firefox. Below 800 columns will shift downwards. - * - * http://www.maxdesign.com.au/presentation/em/ Ideal length for content. - * http://www.svendtofte.com/code/max_width_in_ie/ Max width in IE. - * - * @copyright © 2006 The Open University - * @author N.D.Freear@open.ac.uk, and others. - * @license http://www.gnu.org/copyleft/gpl.html GNU Public License - * @package - */ -//TODO (nfreear): Accessibility: evaluation, lang/en_utf8/moodle.php: $string['formattopicscss'] - - require_once($CFG->libdir.'/ajax/ajaxlib.php'); - - if (!empty($THEME->customcorners)) { - require_once($CFG->dirroot.'/lib/custom_corners_lib.php'); - } - - $topic = optional_param('topic', -1, PARAM_INT); - - if ($topic != -1) { - $displaysection = course_set_display($course->id, $topic); - } else { - if (isset($USER->display[$course->id])) { - $displaysection = $USER->display[$course->id]; - } else { - $displaysection = course_set_display($course->id, 0); - } - } - - $context = get_context_instance(CONTEXT_COURSE, $course->id); - - if (($marker >=0) && has_capability('moodle/course:setcurrentsection', $context) && confirm_sesskey()) { - $course->marker = $marker; - if (! set_field("course", "marker", $marker, "id", $course->id)) { - error("Could not mark that topic for this course"); - } - } - - $streditsummary = get_string('editsummary'); - $stradd = get_string('add'); - $stractivities = get_string('activities'); - $strshowalltopics = get_string('showalltopics'); - $strtopic = get_string('topic'); - $strgroups = get_string('groups'); - $strgroupmy = get_string('groupmy'); - $editing = $PAGE->user_is_editing(); - - if ($editing) { - $strstudents = moodle_strtolower($course->students); - $strtopichide = get_string('topichide', '', $strstudents); - $strtopicshow = get_string('topicshow', '', $strstudents); - $strmarkthistopic = get_string('markthistopic'); - $strmarkedthistopic = get_string('markedthistopic'); - $strmoveup = get_string('moveup'); - $strmovedown = get_string('movedown'); - } - -/* Internet Explorer min-width fix. (See theme/standard/styles_layout.css: min-width for Firefox.) - Window width: 800px, Firefox 763px, IE 752px. (Window width: 640px, Firefox 602px, IE 588px.) -*/ -?> - - -'; - -/// The left column ... - - if (blocks_have_content($pageblocks, BLOCK_POS_LEFT) || $editing) { - echo '

'; - blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT); - echo '
'; - } - -/// The right column, BEFORE the middle-column. - if (blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $editing) { - echo '
'; - blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT); - echo '
'; - } - -/// Start main column - echo '
'; - - if (!empty($THEME->customcorners)) print_custom_corners_start(); - - echo skip_main_destination(); - - print_heading_block(get_string('topicoutline'), 'outline'); - - // Note, an ordered list would confuse - "1" could be the clipboard or summary. - echo "
'; - echo "\n"; - } - - $section++; - } - echo "\n"; - - if (!empty($sectionmenu)) { - echo '
'; - echo popup_form($CFG->wwwroot.'/course/view.php?id='.$course->id.'&', $sectionmenu, - 'sectionmenu', '', get_string('jumpto'), '', '', true); - echo '
'; - } - - if (!empty($THEME->customcorners)) print_custom_corners_end(); - - echo ''; - - echo ''; - echo '
'; - -?> diff --git a/course/format/weekscss/ajax.php b/course/format/weekscss/ajax.php deleted file mode 100644 index 2280eddd8154b..0000000000000 --- a/course/format/weekscss/ajax.php +++ /dev/null @@ -1,10 +0,0 @@ -ajaxcapable = true; -$CFG->ajaxtestedbrowsers = array('MSIE' => 6.0, 'Gecko' => 20061111); - -?> diff --git a/course/format/weekscss/format.php b/course/format/weekscss/format.php deleted file mode 100644 index a120bfd210276..0000000000000 --- a/course/format/weekscss/format.php +++ /dev/null @@ -1,276 +0,0 @@ - and with DIVs; inline styles. - * 3. Reorder columns so that in linear view content is first then blocks; - * styles to maintain original graphical (side by side) view. - * - * Target: 3-column graphical view using relative widths for pixel screen sizes - * 800x600, 1024x768... on IE6, Firefox. Below 800 columns will shift downwards. - * - * http://www.maxdesign.com.au/presentation/em/ Ideal length for content. - * http://www.svendtofte.com/code/max_width_in_ie/ Max width in IE. - * - * @copyright © 2006 The Open University - * @author N.D.Freear@open.ac.uk, and others. - * @license http://www.gnu.org/copyleft/gpl.html GNU Public License - * @package - */ -//TODO (nfreear): Accessibility: evaluation, lang/en_utf8/moodle.php: $string['formatweekscss'] - - $week = optional_param('week', -1, PARAM_INT); - - if ($week != -1) { - $displaysection = course_set_display($course->id, $week); - } else { - if (isset($USER->display[$course->id])) { - $displaysection = $USER->display[$course->id]; - } else { - $displaysection = course_set_display($course->id, 0); - } - } - - $streditsummary = get_string('editsummary'); - $stradd = get_string('add'); - $stractivities = get_string('activities'); - $strshowallweeks = get_string('showallweeks'); - $strweek = get_string('week'); - $strgroups = get_string('groups'); - $strgroupmy = get_string('groupmy'); - $editing = $PAGE->user_is_editing(); - - if ($editing) { - $strstudents = moodle_strtolower($course->students); - $strweekhide = get_string('weekhide', '', $strstudents); - $strweekshow = get_string('weekshow', '', $strstudents); - $strmoveup = get_string('moveup'); - $strmovedown = get_string('movedown'); - } - - $context = get_context_instance(CONTEXT_COURSE, $course->id); -/* Internet Explorer min-width fix. (See theme/standard/styles_layout.css: min-width for Firefox.) - Window width: 800px, Firefox 763px, IE 752px. (Window width: 640px, Firefox 602px, IE 588px.) -*/ -?> - - -'; - -/// The left column ... - - if (blocks_have_content($pageblocks, BLOCK_POS_LEFT) || $editing) { - echo '
'; - blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT); - echo '
'; - } - -/// The right column, BEFORE the middle-column. - if (blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $editing) { - echo '
'; - blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT); - echo '
'; - } - -/// Start main column - echo '
'. skip_main_destination(); - - print_heading_block(get_string('weeklyoutline'), 'outline'); - - // Note, an ordered list would confuse - "1" could be the clipboard or summary. - echo "\n"; - - if (!empty($sectionmenu)) { - echo '
'; - echo popup_form($CFG->wwwroot.'/course/view.php?id='.$course->id.'&', $sectionmenu, - 'sectionmenu', '', get_string('jumpto'), '', '', true); - echo '
'; - } - - echo '
'; - - echo ''; - echo '
'; - -?> diff --git a/doc/pix/cvstree.png b/doc/pix/cvstree.png deleted file mode 100755 index 803ad2771a459..0000000000000 Binary files a/doc/pix/cvstree.png and /dev/null differ diff --git a/doc/pix/files.jpg b/doc/pix/files.jpg deleted file mode 100755 index ff8f7d09412c7..0000000000000 Binary files a/doc/pix/files.jpg and /dev/null differ diff --git a/doc/pix/social.jpg b/doc/pix/social.jpg deleted file mode 100755 index 69596f914b144..0000000000000 Binary files a/doc/pix/social.jpg and /dev/null differ diff --git a/doc/pix/topics.jpg b/doc/pix/topics.jpg deleted file mode 100755 index c8a099eae842a..0000000000000 Binary files a/doc/pix/topics.jpg and /dev/null differ diff --git a/doc/pix/weekly.jpg b/doc/pix/weekly.jpg deleted file mode 100755 index 1ffc82c053013..0000000000000 Binary files a/doc/pix/weekly.jpg and /dev/null differ diff --git a/enrol/authorize/authorizenetlib.php b/enrol/authorize/authorizenetlib.php deleted file mode 100644 index 03501057929f1..0000000000000 --- a/enrol/authorize/authorizenetlib.php +++ /dev/null @@ -1,410 +0,0 @@ -dirroot.'/enrol/authorize/const.php'); -require_once($CFG->dirroot.'/enrol/authorize/localfuncs.php'); - -/** - * Gets settlement date and time - * - * @param int $time Time processed, usually now. - * @return int Settlement date and time - */ -function authorize_getsettletime($time) -{ - global $CFG; - - $cutoff = intval($CFG->an_cutoff); - $mins = $cutoff % 60; - $hrs = ($cutoff - $mins) / 60; - $cutofftime = strtotime("$hrs:$mins", $time); - if ($cutofftime < $time) { - $cutofftime = strtotime("$hrs:$mins", $time + (24 * 3600)); - } - return $cutofftime; -} - -/** - * Is order settled? Status must be auth_captured or credited. - * - * @param object $order Order details - * @return bool true, if settled, false otherwise. - */ -function authorize_settled($order) -{ - return (($order->status == AN_STATUS_AUTHCAPTURE || $order->status == AN_STATUS_CREDIT) && - ($order->settletime > 0) && ($order->settletime < time())); -} - -/** - * Is order expired? 'Authorized/Pending Capture' transactions are expired after 30 days. - * - * @param object &$order Order details. - * @return bool true, transaction is expired, false otherwise. - */ -function authorize_expired(&$order) -{ - static $timediff30; - - if ($order->status == AN_STATUS_EXPIRE) { - return true; - } - elseif ($order->status != AN_STATUS_AUTH) { - return false; - } - - if (empty($timediff30)) { - $timediff30 = authorize_getsettletime(time()) - (30 * 24 * 3600); - } - - $isexpired = (authorize_getsettletime($order->timecreated) < $timediff30); - if ($isexpired) { - $order->status = AN_STATUS_EXPIRE; - update_record('enrol_authorize', $order); - } - return $isexpired; -} - -/** - * Performs an action on authorize.net and updates/inserts records. If record update fails, - * sends email to admin. - * - * @param object &$order Which transaction data will be sent. See enrol_authorize table. - * @param string &$message Information about error message. - * @param object &$extra Extra data that used for refunding and credit card information. - * @param int $action Which action will be performed. See AN_ACTION_* - * @param string $cctype Used internally to configure credit types automatically. - * @return int AN_APPROVED Transaction was successful, AN_RETURNZERO otherwise. Use $message for reason. - * @author Ethem Evlice - * @uses $CFG - */ -function authorize_action(&$order, &$message, &$extra, $action=AN_ACTION_NONE, $cctype=NULL) -{ - global $CFG; - static $constpd; - require_once($CFG->libdir.'/filelib.php'); - - if (!isset($constpd)) { - $mconfig = get_config('enrol/authorize'); - $constpd = array( - 'x_version' => '3.1', - 'x_delim_data' => 'True', - 'x_delim_char' => AN_DELIM, - 'x_encap_char' => AN_ENCAP, - 'x_relay_response' => 'FALSE', - 'x_login' => rc4decrypt($mconfig->an_login) - ); - - if (!empty($mconfig->an_tran_key)) { - $constpd['x_tran_key'] = rc4decrypt($mconfig->an_tran_key); - } - else { - $constpd['x_password'] = rc4decrypt($mconfig->an_password); - } - } - - if (empty($order) or empty($order->id)) { - $message = "Check order->id!"; - return AN_RETURNZERO; - } - - $method = $order->paymentmethod; - if (empty($method)) { - $method = AN_METHOD_CC; - } - elseif ($method != AN_METHOD_CC && $method != AN_METHOD_ECHECK) { - $message = "Invalid method: $method"; - return AN_RETURNZERO; - } - - $action = intval($action); - if ($method == AN_METHOD_ECHECK) { - if ($action != AN_ACTION_AUTH_CAPTURE && $action != AN_ACTION_CREDIT) { - $message = "Please perform AUTH_CAPTURE or CREDIT for echecks"; - return AN_RETURNZERO; - } - } - - $pd = $constpd; - $pd['x_method'] = $method; - $test = !empty($CFG->an_test); - $pd['x_test_request'] = ($test ? 'TRUE' : 'FALSE'); - - switch ($action) { - case AN_ACTION_AUTH_ONLY: - case AN_ACTION_CAPTURE_ONLY: - case AN_ACTION_AUTH_CAPTURE: - { - if ($order->status != AN_STATUS_NONE) { - $message = "Order status must be AN_STATUS_NONE(0)!"; - return AN_RETURNZERO; - } - elseif (empty($extra)) { - $message = "Need extra fields!"; - return AN_RETURNZERO; - } - elseif (($action == AN_ACTION_CAPTURE_ONLY) and empty($extra->x_auth_code)) { - $message = "x_auth_code is required for capture only transactions!"; - return AN_RETURNZERO; - } - - $ext = (array)$extra; - $pd['x_type'] = (($action==AN_ACTION_AUTH_ONLY) - ? 'AUTH_ONLY' :( ($action==AN_ACTION_CAPTURE_ONLY) - ? 'CAPTURE_ONLY' : 'AUTH_CAPTURE')); - foreach($ext as $k => $v) { - $pd[$k] = $v; - } - break; - } - - case AN_ACTION_PRIOR_AUTH_CAPTURE: - { - if ($order->status != AN_STATUS_AUTH) { - $message = "Order status must be authorized!"; - return AN_RETURNZERO; - } - if (authorize_expired($order)) { - $message = "Transaction must be captured within 30 days. EXPIRED!"; - return AN_RETURNZERO; - } - $pd['x_type'] = 'PRIOR_AUTH_CAPTURE'; - $pd['x_trans_id'] = $order->transid; - break; - } - - case AN_ACTION_CREDIT: - { - if ($order->status != AN_STATUS_AUTHCAPTURE) { - $message = "Order status must be authorized/captured!"; - return AN_RETURNZERO; - } - if (!authorize_settled($order)) { - $message = "Order must be settled. Try VOID, check Cut-Off time if it fails!"; - return AN_RETURNZERO; - } - if (empty($extra->amount)) { - $message = "No valid amount!"; - return AN_RETURNZERO; - } - $timenowsettle = authorize_getsettletime(time()); - $timediff = $timenowsettle - (120 * 3600 * 24); - if ($order->settletime < $timediff) { - $message = "Order must be credited within 120 days!"; - return AN_RETURNZERO; - } - - $pd['x_type'] = 'CREDIT'; - $pd['x_trans_id'] = $order->transid; - $pd['x_currency_code'] = $order->currency; - $pd['x_invoice_num'] = $extra->orderid; - $pd['x_amount'] = $extra->amount; - if ($method == AN_METHOD_CC) { - $pd['x_card_num'] = sprintf("%04d", intval($order->refundinfo)); - } - elseif ($method == AN_METHOD_ECHECK && empty($order->refundinfo)) { - $message = "Business checkings can be refunded only."; - return AN_RETURNZERO; - } - break; - } - - case AN_ACTION_VOID: - { - if (authorize_expired($order) || authorize_settled($order)) { - $message = "The transaction cannot be voided due to the fact that it is expired or settled."; - return AN_RETURNZERO; - } - $pd['x_type'] = 'VOID'; - $pd['x_trans_id'] = $order->transid; - break; - } - - default: { - $message = "Invalid action: $action"; - return AN_RETURNZERO; - } - } - - $headers = array('Connection' => 'close'); - if (! (empty($CFG->an_referer) || $CFG->an_referer == "http://")) { - $headers['Referer'] = $CFG->an_referer; - } - - @ignore_user_abort(true); - if (intval(ini_get('max_execution_time')) > 0) { - @set_time_limit(300); - } - - $host = $test ? 'certification.authorize.net' : 'secure.authorize.net'; - $data = download_file_content("https://$host:443/gateway/transact.dll", $headers, $pd, false, 60); - if (!$data) { - $message = "No connection to https://$host:443"; - return AN_RETURNZERO; - } - $response = explode(AN_ENCAP.AN_DELIM.AN_ENCAP, $data); - if ($response === false) { - $message = "response error"; - return AN_RETURNZERO; - } - $rcount = count($response) - 1; - if ($response[0]{0} == AN_ENCAP) { - $response[0] = substr($response[0], 1); - } - if (substr($response[$rcount], -1) == AN_ENCAP) { - $response[$rcount] = substr($response[$rcount], 0, -1); - } - - $responsecode = intval($response[0]); - if ($responsecode == AN_APPROVED || $responsecode == AN_REVIEW) - { - $transid = intval($response[6]); - if ($test || $transid == 0) { - return $responsecode; // don't update original transaction in test mode. - } - switch ($action) { - case AN_ACTION_AUTH_ONLY: - case AN_ACTION_CAPTURE_ONLY: - case AN_ACTION_AUTH_CAPTURE: - case AN_ACTION_PRIOR_AUTH_CAPTURE: - { - $order->transid = $transid; - - if ($method == AN_METHOD_CC) { - if ($action == AN_ACTION_AUTH_ONLY || $responsecode == AN_REVIEW) { - $order->status = AN_STATUS_AUTH; - } else { - $order->status = AN_STATUS_AUTHCAPTURE; - $order->settletime = authorize_getsettletime(time()); - } - } - elseif ($method == AN_METHOD_ECHECK) { - $order->status = AN_STATUS_UNDERREVIEW; - } - - if (! update_record('enrol_authorize', $order)) { - email_to_admin("Error while trying to update data " . - "in table enrol_authorize. Please edit manually this record: ID=$order->id.", $order); - } - break; - } - case AN_ACTION_CREDIT: - { - // Credit generates new transaction id. - // So, $extra must be updated, not $order. - $extra->status = AN_STATUS_CREDIT; - $extra->transid = $transid; - $extra->settletime = authorize_getsettletime(time()); - if (! $extra->id = insert_record('enrol_authorize_refunds', $extra)) { - unset($extra->id); - email_to_admin("Error while trying to insert data " . - "into table enrol_authorize_refunds. Please add manually this record:", $extra); - } - break; - } - case AN_ACTION_VOID: - { - $tableupdate = 'enrol_authorize'; - if ($order->status == AN_STATUS_CREDIT) { - $tableupdate = 'enrol_authorize_refunds'; - unset($order->paymentmethod); - } - $order->status = AN_STATUS_VOID; - if (! update_record($tableupdate, $order)) { - email_to_admin("Error while trying to update data " . - "in table $tableupdate. Please edit manually this record: ID=$order->id.", $order); - } - break; - } - } - } - else - { - $reasonno = $response[2]; - $reasonstr = "reason" . $reasonno; - $message = get_string($reasonstr, "enrol_authorize"); - if ($message == '[[' . $reasonstr . ']]') { - $message = isset($response[3]) ? $response[3] : 'unknown error'; - } - if ($method == AN_METHOD_CC && !empty($CFG->an_avs) && $response[5] != "P") { - $avs = "avs" . strtolower($response[5]); - $stravs = get_string($avs, "enrol_authorize"); - $message .= "
" . get_string("avsresult", "enrol_authorize", $stravs); - } - if (!$test) { // Autoconfigure :) - switch($reasonno) { - // Credit card type isn't accepted - case AN_REASON_NOCCTYPE: - case AN_REASON_NOCCTYPE2: - { - if (!empty($cctype)) { - $ccaccepts = get_list_of_creditcards(); - unset($ccaccepts[$cctype]); - set_config('an_acceptccs', implode(',', array_keys($ccaccepts))); - email_to_admin("$message ($cctype)" . - "This is new config(an_acceptccs):", $ccaccepts); - } - break; - } - // Echecks only - case AN_REASON_ACHONLY: - { - set_config('an_acceptmethods', AN_METHOD_ECHECK); - email_to_admin("$message " . - "This is new config(an_acceptmethods):", array(AN_METHOD_ECHECK)); - break; - } - // Echecks aren't accepted - case AN_REASON_NOACH: - { - set_config('an_acceptmethods', AN_METHOD_CC); - email_to_admin("$message " . - "This is new config(an_acceptmethods):", array(AN_METHOD_CC)); - break; - } - // This echeck type isn't accepted - case AN_REASON_NOACHTYPE: - case AN_REASON_NOACHTYPE2: - { - if (!empty($extra->x_echeck_type)) { - switch ($extra->x_echeck_type) { - // CCD=BUSINESSCHECKING - case 'CCD': - { - set_config('an_acceptechecktypes', 'CHECKING,SAVINGS'); - email_to_admin("$message " . - "This is new config(an_acceptechecktypes):", array('CHECKING','SAVINGS')); - } - break; - // WEB=CHECKING or SAVINGS - case 'WEB': - { - set_config('an_acceptechecktypes', 'BUSINESSCHECKING'); - email_to_admin("$message " . - "This is new config(an_acceptechecktypes):", array('BUSINESSCHECKING')); - } - break; - } - } - break; - } - } - } - } - return $responsecode; -} - -?> diff --git a/enrol/authorize/const.php b/enrol/authorize/const.php index c66698625b61d..650dbbeb8c228 100644 --- a/enrol/authorize/const.php +++ b/enrol/authorize/const.php @@ -20,7 +20,7 @@ * CREDIT: Refunded. * VOID: Cancelled. * EXPIRE: Expired. Orders be expired unless be accepted within 30 days. - * + * * These are valid only for ECHECK: * UNDERREVIEW: Hold for review. * APPROVEDREVIEW: Approved review. @@ -41,7 +41,7 @@ /**#@-*/ /**#@+ - * Actions used in authorize_action() function. + * Actions used in AuthorizeNet::process() method. * * NONE: No action. Function always returns false. * AUTH_ONLY: Used to authorize only, don't capture. @@ -75,7 +75,7 @@ /**#@-*/ /**#@+ - * Return codes for authorize_action() function. + * Return codes for AuthorizeNet::process() method. * * AN_RETURNZERO: No connection was made on authorize.net. * AN_APPROVED: The transaction was accepted. diff --git a/enrol/authorize/db/mysql.php b/enrol/authorize/db/mysql.php deleted file mode 100755 index 9dbf6612bc1c4..0000000000000 --- a/enrol/authorize/db/mysql.php +++ /dev/null @@ -1,145 +0,0 @@ -dirroot/enrol/authorize/const.php"); - - $result = true; - - if ($oldversion < 2005071600) { - // Be sure, only last 4 digit is inserted. - table_column('enrol_authorize', 'cclastfour', 'cclastfour', 'integer', '4', 'unsigned', '0', 'not null'); - table_column('enrol_authorize', 'courseid', 'courseid', 'integer', '10', 'unsigned', '0', 'not null'); - table_column('enrol_authorize', 'userid', 'userid', 'integer', '10', 'unsigned', '0', 'not null'); - // Add some indexes for speed. - execute_sql("ALTER TABLE `{$CFG->prefix}enrol_authorize` ADD INDEX courseid(courseid)", false); - execute_sql("ALTER TABLE `{$CFG->prefix}enrol_authorize` ADD INDEX userid(userid)", false); - } - - if ($oldversion && $oldversion < 2005071602) { - notify("If you are using the authorize.net enrolment plugin for credit card - handling, please ensure that you have turned loginhttps ON in Admin >> Variables >> Security."); - } - - if ($oldversion < 2005112100) { - table_column('enrol_authorize', '', 'authcode', 'varchar', '6', '', '', '', 'avscode'); // CAPTURE_ONLY - table_column('enrol_authorize', '', 'status', 'integer', '10', 'unsigned', '0', 'not null', 'transid'); - table_column('enrol_authorize', '', 'timecreated', 'integer', '10', 'unsigned', '0', 'not null', 'status'); - table_column('enrol_authorize', '', 'timeupdated', 'integer', '10', 'unsigned', '0', 'not null', 'timecreated'); - // status index for speed. - execute_sql("ALTER TABLE `{$CFG->prefix}enrol_authorize` ADD INDEX status(status)"); - // defaults. - $status = AN_STATUS_AUTH | AN_STATUS_CAPTURE; - execute_sql("UPDATE {$CFG->prefix}enrol_authorize SET status='$status' WHERE transid<>'0'", false); - $timenow = time(); - execute_sql("UPDATE {$CFG->prefix}enrol_authorize SET timecreated='$timenow', timeupdated='$timenow'", false); - } - - if ($oldversion < 2005121200) { - // new fields for refund and sales reports. - $defaultcurrency = empty($CFG->enrol_currency) ? 'USD' : $CFG->enrol_currency; - table_column('enrol_authorize', '', 'amount', 'varchar', '10', '', '0', 'not null', 'timeupdated'); - table_column('enrol_authorize', '', 'currency', 'varchar', '3', '', $defaultcurrency, 'not null', 'amount'); - modify_database("","CREATE TABLE prefix_enrol_authorize_refunds ( - `id` int(10) unsigned NOT NULL auto_increment, - `orderid` int(10) unsigned NOT NULL default 0, - `refundtype` int(1) unsigned NOT NULL default 0, - `amount` varchar(10) NOT NULL default '', - `transid` int(10) unsigned NULL default 0, - PRIMARY KEY (`id`), - KEY `orderid` (`orderid`));"); - // defaults. - if (($courses = get_records_select('course', '', '', 'id, cost, currency'))) { - foreach ($courses as $course) { - execute_sql("UPDATE {$CFG->prefix}enrol_authorize - SET amount = '$course->cost', currency = '$course->currency' - WHERE courseid = '$course->id'", false); - } - } - } - - if ($oldversion < 2005122200) { // settletime - table_column('enrol_authorize_refunds', 'refundtype', 'status', 'integer', '1', 'unsigned', '0', 'not null'); - table_column('enrol_authorize_refunds', '', 'settletime', 'integer', '10', 'unsigned', '0', 'not null', 'transid'); - table_column('enrol_authorize', 'timeupdated', 'settletime', 'integer', '10', 'unsigned', '0', 'not null'); - $status = AN_STATUS_AUTH | AN_STATUS_CAPTURE; - if (($settlements = get_records_select('enrol_authorize', "status='$status'", '', 'id, settletime'))) { - include_once("$CFG->dirroot/enrol/authorize/authorizenetlib.php"); - foreach ($settlements as $settlement) { - execute_sql("UPDATE {$CFG->prefix}enrol_authorize SET settletime = '" . - authorize_getsettletime($settlement->settletime) . "' WHERE id = '$settlement->id'", false); - } - } - } - - if ($oldversion < 2005122800) { // no need anymore some fields. - execute_sql("ALTER TABLE {$CFG->prefix}enrol_authorize DROP ccexp", false); - execute_sql("ALTER TABLE {$CFG->prefix}enrol_authorize DROP cvv", false); - execute_sql("ALTER TABLE {$CFG->prefix}enrol_authorize DROP avscode", false); - execute_sql("ALTER TABLE {$CFG->prefix}enrol_authorize DROP authcode", false); - } - - if ($oldversion < 2006010200) { // rename an_review_day - if (isset($CFG->an_review_day)) { - set_config('an_capture_day', $CFG->an_review_day); - delete_records('config', 'name', 'an_review_day'); - } - } - - if ($oldversion < 2006020100) { // rename an_cutoff_hour and an_cutoff_min to an_cutoff - if (isset($CFG->an_cutoff_hour) && isset($CFG->an_cutoff_min)) { - $an_cutoff_hour = intval($CFG->an_cutoff_hour); - $an_cutoff_min = intval($CFG->an_cutoff_min); - $an_cutoff = ($an_cutoff_hour * 60) + $an_cutoff_min; - if (set_config('an_cutoff', $an_cutoff)) { - delete_records('config', 'name', 'an_cutoff_hour'); - delete_records('config', 'name', 'an_cutoff_min'); - } - } - } - - if ($oldversion < 2006021500) { // transid is int - table_column('enrol_authorize', 'transid', 'transid', 'integer', '10', 'unsigned', '0', 'not null'); - } - - if ($oldversion < 2006021501) { // delete an_nextmail record from config_plugins table - delete_records('config_plugins', 'name', 'an_nextmail'); - } - - if ($oldversion < 2006050400) { // Create transid indexes for backup & restore speed. - execute_sql("ALTER TABLE `{$CFG->prefix}enrol_authorize` ADD INDEX transid(transid)", false); - execute_sql("ALTER TABLE `{$CFG->prefix}enrol_authorize_refunds` ADD INDEX transid(transid)", false); - } - - if ($oldversion < 2006060500) { // delete an_nextmail record from config_plugins table - delete_records('config_plugins', 'name', 'an_nextmail'); // run twice. - } - - if ($oldversion < 2006081401) { // no need an_teachermanagepay in 1.7 - if (isset($CFG->an_teachermanagepay)) { - delete_records('config', 'name', 'an_teachermanagepay'); - } - } - - if ($oldversion < 2006083100) { - // enums are lower case - if (isset($CFG->an_acceptmethods)) { - set_config('an_acceptmethods', strtolower($CFG->an_acceptmethods)); - } - // new ENUM field: paymentmethod(cc,echeck) - execute_sql("ALTER TABLE `{$CFG->prefix}enrol_authorize` ADD paymentmethod enum('cc', 'echeck') NOT NULL default 'cc' AFTER `id`", true); - } - - ////// DO NOT ADD NEW THINGS HERE!! USE upgrade.php and the lib/ddllib.php functions. - - return $result; -} - -?> diff --git a/enrol/authorize/db/postgres7.php b/enrol/authorize/db/postgres7.php deleted file mode 100644 index 62c1d87826355..0000000000000 --- a/enrol/authorize/db/postgres7.php +++ /dev/null @@ -1,157 +0,0 @@ -dirroot/enrol/authorize/const.php"); - - $result = true; - - if (!$tables = $db->MetaColumns($CFG->prefix . 'enrol_authorize')) { - $installfirst = true; - } - - if ($oldversion == 0 || !empty($installfirst)) { // First time install - $result = modify_database("$CFG->dirroot/enrol/authorize/db/postgres7.sql"); - return $result; // RETURN, sql file contains last upgrades. - } - - // Authorize module was installed before. Upgrades must be applied to SQL file. - - if ($oldversion && $oldversion < 2005071602) { - notify("If you are using the authorize.net enrolment plugin for credit card - handling, please ensure that you have turned loginhttps ON in Admin >> Variables >> Security."); - } - - if ($oldversion < 2005080200) { - // Be sure, only last 4 digit is inserted. - table_column('enrol_authorize', 'cclastfour', 'cclastfour', 'integer', '4', 'unsigned', '0', 'not null'); - table_column('enrol_authorize', 'courseid', 'courseid', 'integer', '10', 'unsigned', '0', 'not null'); - table_column('enrol_authorize', 'userid', 'userid', 'integer', '10', 'unsigned', '0', 'not null'); - // Add some indexes for speed. - execute_sql("CREATE INDEX {$CFG->prefix}enrol_authorize_courseid_idx ON {$CFG->prefix}enrol_authorize (courseid);", false); - execute_sql("CREATE INDEX {$CFG->prefix}enrol_authorize_userid_idx ON {$CFG->prefix}enrol_authorize (userid);", false); - } - - if ($oldversion < 2005112100) { - table_column('enrol_authorize', '', 'authcode', 'varchar', '6', '', '', '', 'avscode'); // CAPTURE_ONLY - table_column('enrol_authorize', '', 'status', 'integer', '10', 'unsigned', '0', 'not null', 'transid'); - table_column('enrol_authorize', '', 'timecreated', 'integer', '10', 'unsigned', '0', 'not null', 'status'); - table_column('enrol_authorize', '', 'timeupdated', 'integer', '10', 'unsigned', '0', 'not null', 'timecreated'); - // status index for speed. - modify_database('',"CREATE INDEX prefix_enrol_authorize_status_idx ON prefix_enrol_authorize (status);"); - // defaults. - $status = AN_STATUS_AUTH | AN_STATUS_CAPTURE; - execute_sql("UPDATE {$CFG->prefix}enrol_authorize SET status='$status' WHERE transid<>'0'", false); - $timenow = time(); - execute_sql("UPDATE {$CFG->prefix}enrol_authorize SET timecreated='$timenow', timeupdated='$timenow'", false); - } - - if ($oldversion < 2005121200) { - // new fields for refund and sales reports. - $defaultcurrency = empty($CFG->enrol_currency) ? 'USD' : $CFG->enrol_currency; - table_column('enrol_authorize', '', 'amount', 'varchar', '10', '', '0', 'not null', 'timeupdated'); - table_column('enrol_authorize', '', 'currency', 'varchar', '3', '', $defaultcurrency, 'not null', 'amount'); - modify_database("","CREATE TABLE prefix_enrol_authorize_refunds ( - id SERIAL PRIMARY KEY, - orderid INTEGER NOT NULL default 0, - refundtype INTEGER NOT NULL default 0, - amount varchar(10) NOT NULL default '', - transid INTEGER NULL default 0 - );"); - modify_database("","CREATE INDEX prefix_enrol_authorize_refunds_orderid_idx ON prefix_enrol_authorize_refunds (orderid);"); - // defaults. - if (($courses = get_records_select('course', '', '', 'id, cost, currency'))) { - foreach ($courses as $course) { - execute_sql("UPDATE {$CFG->prefix}enrol_authorize - SET amount = '$course->cost', currency = '$course->currency' - WHERE courseid = '$course->id'", false); - } - } - } - - if ($oldversion < 2005122200) { // settletime - table_column('enrol_authorize_refunds', 'refundtype', 'status', 'integer', '1', 'unsigned', '0', 'not null'); - table_column('enrol_authorize_refunds', '', 'settletime', 'integer', '10', 'unsigned', '0', 'not null', 'transid'); - table_column('enrol_authorize', 'timeupdated', 'settletime', 'integer', '10', 'unsigned', '0', 'not null'); - $status = AN_STATUS_AUTH | AN_STATUS_CAPTURE; - if (($settlements = get_records_select('enrol_authorize', "status='$status'", '', 'id, settletime'))) { - include_once("$CFG->dirroot/enrol/authorize/authorizenetlib.php"); - foreach ($settlements as $settlement) { - execute_sql("UPDATE {$CFG->prefix}enrol_authorize SET settletime = '" . - authorize_getsettletime($settlement->settletime) . "' WHERE id = '$settlement->id'", false); - } - } - } - - if ($oldversion < 2005122800) { // no need anymore some fields. - execute_sql("ALTER TABLE {$CFG->prefix}enrol_authorize DROP ccexp", false); - execute_sql("ALTER TABLE {$CFG->prefix}enrol_authorize DROP cvv", false); - execute_sql("ALTER TABLE {$CFG->prefix}enrol_authorize DROP avscode", false); - execute_sql("ALTER TABLE {$CFG->prefix}enrol_authorize DROP authcode", false); - } - - if ($oldversion < 2006010200) { // rename an_review_day - if (isset($CFG->an_review_day)) { - set_config('an_capture_day', $CFG->an_review_day); - delete_records('config', 'name', 'an_review_day'); - } - } - - if ($oldversion < 2006020100) { // rename an_cutoff_hour and an_cutoff_min to an_cutoff - if (isset($CFG->an_cutoff_hour) && isset($CFG->an_cutoff_min)) { - $an_cutoff_hour = intval($CFG->an_cutoff_hour); - $an_cutoff_min = intval($CFG->an_cutoff_min); - $an_cutoff = ($an_cutoff_hour * 60) + $an_cutoff_min; - if (set_config('an_cutoff', $an_cutoff)) { - delete_records('config', 'name', 'an_cutoff_hour'); - delete_records('config', 'name', 'an_cutoff_min'); - } - } - } - - if ($oldversion < 2006021500) { // transid is int - table_column('enrol_authorize', 'transid', 'transid', 'integer', '10', 'unsigned', '0', 'not null'); - } - - if ($oldversion < 2006021501) { // delete an_nextmail record from config_plugins table - delete_records('config_plugins', 'name', 'an_nextmail'); - } - - if ($oldversion < 2006050400) { // Create transid indexes for backup & restore speed. - execute_sql("CREATE INDEX {$CFG->prefix}enrol_authorize_transid_idx ON {$CFG->prefix}enrol_authorize(transid);", false); - execute_sql("CREATE INDEX {$CFG->prefix}enrol_authorize_refunds_transid_idx ON {$CFG->prefix}enrol_authorize_refunds(transid);", false); - } - - if ($oldversion < 2006060500) { // delete an_nextmail record from config_plugins table - delete_records('config_plugins', 'name', 'an_nextmail'); // run twice. - } - - if ($oldversion < 2006081401) { // no need an_teachermanagepay in 1.7 - if (isset($CFG->an_teachermanagepay)) { - delete_records('config', 'name', 'an_teachermanagepay'); - } - } - - if ($oldversion < 2006083100) { - // enums are lower case - if (isset($CFG->an_acceptmethods)) { - set_config('an_acceptmethods', strtolower($CFG->an_acceptmethods)); - } - // new ENUM field: paymentmethod(cc,echeck) - table_column('enrol_authorize', '', 'paymentmethod', 'varchar', '6', '', 'cc', 'not null'); - execute_sql("ALTER TABLE {$CFG->prefix}enrol_authorize ADD CONSTRAINT enroauth_pay_ck CHECK (paymentmethod IN ('cc', 'echeck'))", true); - } - - ////// DO NOT ADD NEW THINGS HERE!! USE upgrade.php and the lib/ddllib.php functions. - - return $result; -} - -?> diff --git a/enrol/paypal/db/mysql.php b/enrol/paypal/db/mysql.php deleted file mode 100644 index 7a926a081cc33..0000000000000 --- a/enrol/paypal/db/mysql.php +++ /dev/null @@ -1,22 +0,0 @@ - diff --git a/enrol/paypal/db/postgres7.php b/enrol/paypal/db/postgres7.php deleted file mode 100644 index 35768f70e50b8..0000000000000 --- a/enrol/paypal/db/postgres7.php +++ /dev/null @@ -1,22 +0,0 @@ - diff --git a/filter/algebra/algebradebug.php b/filter/algebra/algebradebug.php index 2000a060c9e9b..f86445441d27a 100644 --- a/filter/algebra/algebradebug.php +++ b/filter/algebra/algebradebug.php @@ -3,7 +3,7 @@ // If not, it obtains the corresponding TeX expression from the cache_tex db table // and uses mimeTeX to create the image file - $nomoodlecookie = true; // Because it interferes with caching + define('NO_MOODLE_COOKIES', true); // Because it interferes with caching require_once("../../config.php"); diff --git a/filter/algebra/pix.php b/filter/algebra/pix.php index 3c14bd217f814..fe93abc03e5fc 100644 --- a/filter/algebra/pix.php +++ b/filter/algebra/pix.php @@ -3,7 +3,7 @@ // If not, it obtains the corresponding TeX expression from the cache_tex db table // and uses mimeTeX to create the image file - $nomoodlecookie = true; // Because it interferes with caching + define('NO_MOODLE_COOKIES', true); // Because it interferes with caching require_once('../../config.php'); diff --git a/filter/tex/pix.php b/filter/tex/pix.php index 6ca5bb567143a..dd7e9696a8543 100644 --- a/filter/tex/pix.php +++ b/filter/tex/pix.php @@ -3,7 +3,7 @@ // If not, it obtains the corresponding TeX expression from the cache_tex db table // and uses mimeTeX to create the image file - $nomoodlecookie = true; // Because it interferes with caching +define('NO_MOODLE_COOKIES', true); // Because it interferes with caching require_once('../../config.php'); diff --git a/filter/tex/texdebug.php b/filter/tex/texdebug.php index 6a976f4da13f0..4cd5f96116230 100644 --- a/filter/tex/texdebug.php +++ b/filter/tex/texdebug.php @@ -3,7 +3,7 @@ // If not, it obtains the corresponding TeX expression from the cache_tex db table // and uses mimeTeX to create the image file - $nomoodlecookie = true; // Because it interferes with caching + define('NO_MOODLE_COOKIES', true); // Because it interferes with caching require_once("../../config.php"); diff --git a/filter/tex/texed.php b/filter/tex/texed.php index 5ff4c0bd42d58..3a40ba1cc8185 100644 --- a/filter/tex/texed.php +++ b/filter/tex/texed.php @@ -3,7 +3,7 @@ // If not, it obtains the corresponding TeX expression from the cache_tex db table // and uses mimeTeX to create the image file - $nomoodlecookie = true; // Because it interferes with caching + define('NO_MOODLE_COOKIES', true); // Because it interferes with caching require_once("../../config.php"); require_once($CFG->dirroot.'/filter/tex/lib.php'); diff --git a/grade/export/csv/db/access.php b/grade/export/csv/db/access.php deleted file mode 100644 index b28b04f643122..0000000000000 --- a/grade/export/csv/db/access.php +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/grade/export/ods/dump.php b/grade/export/ods/dump.php index eff5cb65cc4ff..f6c21a79646af 100644 --- a/grade/export/ods/dump.php +++ b/grade/export/ods/dump.php @@ -23,7 +23,7 @@ // // /////////////////////////////////////////////////////////////////////////// -$nomoodlecookie = true; // session not used here +define('NO_MOODLE_COOKIES', true); // session not used here require '../../../config.php'; $id = required_param('id', PARAM_INT); // course id diff --git a/grade/export/txt/dump.php b/grade/export/txt/dump.php index 91f1ebea632a4..bb9b45af85940 100644 --- a/grade/export/txt/dump.php +++ b/grade/export/txt/dump.php @@ -23,7 +23,7 @@ // // /////////////////////////////////////////////////////////////////////////// -$nomoodlecookie = true; // session not used here +define('NO_MOODLE_COOKIES', true); // session not used here require '../../../config.php'; $id = required_param('id', PARAM_INT); // course id diff --git a/grade/export/xls/dump.php b/grade/export/xls/dump.php index 11cdd27dcb079..b3efcb770814f 100644 --- a/grade/export/xls/dump.php +++ b/grade/export/xls/dump.php @@ -23,7 +23,7 @@ // // /////////////////////////////////////////////////////////////////////////// -$nomoodlecookie = true; // session not used here +define('NO_MOODLE_COOKIES', true); // session not used here require '../../../config.php'; $id = required_param('id', PARAM_INT); // course id diff --git a/grade/export/xml/dump.php b/grade/export/xml/dump.php index 6362af0017f7a..275cc229c878a 100644 --- a/grade/export/xml/dump.php +++ b/grade/export/xml/dump.php @@ -23,7 +23,7 @@ // // /////////////////////////////////////////////////////////////////////////// -$nomoodlecookie = true; // session not used here +define('NO_MOODLE_COOKIES', true); // session not used here require '../../../config.php'; $id = required_param('id', PARAM_INT); // course id diff --git a/grade/import/xml/fetch.php b/grade/import/xml/fetch.php index 48d9d3e60bb42..008c3947eace9 100644 --- a/grade/import/xml/fetch.php +++ b/grade/import/xml/fetch.php @@ -23,7 +23,7 @@ // // /////////////////////////////////////////////////////////////////////////// -$nomoodlecookie = true; // session not used here +define('NO_MOODLE_COOKIES', true); // session not used here require '../../../config.php'; $id = required_param('id', PARAM_INT); // course id diff --git a/index.php b/index.php index dcf1356d1c583..0a7cb9d1ac06b 100644 --- a/index.php +++ b/index.php @@ -85,8 +85,8 @@ } - if (get_moodle_cookie() == '') { - set_moodle_cookie('nobody'); // To help search for cookies on login page + if ($SESSION->get_moodle_cookie() == '') { + $SESSION->set_moodle_cookie('nobody'); // To help search for cookies on login page } if (!empty($USER->id)) { diff --git a/install/lang/en_utf8/installer.php b/install/lang/en_utf8/installer.php index 67d10fa0d8b96..26f74afa6efe6 100644 --- a/install/lang/en_utf8/installer.php +++ b/install/lang/en_utf8/installer.php @@ -36,14 +36,14 @@ $string['availablelangs']='List of available languages'; $string['bypassed'] = 'Bypassed'; $string['cannotconnecttodb'] = 'Cannot connect to db'; -$string['cannotcreatelangdir'] = 'Cannot create lang dir.'; -$string['cannotcreatetempdir'] = 'Cannot create temp dir.'; -$string['cannotdownloadcomponents'] = 'Cannot download components.'; -$string['cannotdownloadzipfile'] = 'Cannot download ZIP file.'; -$string['cannotfindcomponent'] = 'Cannot find component.'; -$string['cannotsavemd5file'] = 'Cannot save md5 file.'; -$string['cannotsavezipfile'] = 'Cannot save ZIP file.'; -$string['cannotunzipfile'] = 'Cannot unzip file.'; +$string['cannotcreatelangdir'] = 'Cannot create lang directory'; +$string['cannotcreatetempdir'] = 'Cannot create temp directory'; +$string['cannotdownloadcomponents'] = 'Cannot download components'; +$string['cannotdownloadzipfile'] = 'Cannot download ZIP file'; +$string['cannotfindcomponent'] = 'Cannot find component'; +$string['cannotsavemd5file'] = 'Cannot save md5 file'; +$string['cannotsavezipfile'] = 'Cannot save ZIP file'; +$string['cannotunzipfile'] = 'Cannot unzip file'; $string['caution'] = 'Caution'; $string['check'] = 'Check'; $string['checkingphpsettings']='Checking PHP Settings'; @@ -54,7 +54,7 @@ $string['compatibilitysettings'] = 'Checking your PHP settings ...'; $string['compatibilitysettingshead'] = 'Checking your PHP settings ...'; $string['compatibilitysettingssub'] = 'Your server should pass all these tests to make Moodle run properly'; -$string['componentisuptodate'] = 'Component is up to date.'; +$string['componentisuptodate'] = 'Component is up-to-date'; $string['configfilecreated'] = 'Configuration file successfully created'; $string['configfiledoesnotexist'] = 'Configuration file does not exist !!!'; $string['configfilenotwritten'] = 'The installer script was not able to automatically create a config.php file containing your chosen settings, probably because the Moodle directory is not writeable. You can manually copy the following code into a file named config.php within the root directory of Moodle.'; @@ -215,7 +215,7 @@ $string['dirrooterror'] = 'The \'Moodle Directory\' setting seems to be incorrect - we can\'t find a Moodle installation there. The value below has been reset.'; $string['disagreelicense'] = 'Upgrade cannot proceed due to disagreement to GPL!'; $string['download'] = 'Download'; -$string['downloadedfilecheckfailed'] = 'Downloaded file check failed.'; +$string['downloadedfilecheckfailed'] = 'Downloaded file check failed'; $string['downloadlanguagebutton'] = 'Download the "$a" language pack'; $string['downloadlanguagehead'] = 'Download language pack'; $string['downloadlanguagenotneeded'] = 'You may continue the installation process using the default language pack, \"$a\".'; @@ -363,7 +363,7 @@

You must upgrade PHP or move to a host with a newer version of PHP!
(In case of 5.0.x you could also downgrade to 4.4.x version)

'; $string['postgres7'] = 'PostgreSQL (postgres7)'; -$string['prefixcannotbeempty'] = '

Error: database table prefix can not be empty ($a)

+$string['prefixcannotbeempty'] = '

Error: database table prefix cannot be empty ($a)

The site administrator must fix this problem.

'; $string['prefixtoolong'] = '

Error: database table prefix is too long ($a->dbfamily)

The site administrator must fix this problem. Maximum length for table prefixes in $a->dbfamily is $a->maxlength characters.

'; @@ -469,9 +469,9 @@ $string['welcomep70'] = 'Click the \"Next\" button below to continue with the set up of Moodle.'; $string['welcometext']='---Welcome to moodle commandline installer---'; $string['writetoconfigfilefaild'] = 'Error: Write to config file failed '; -$string['wrongdestpath'] = 'Wrong destination path.'; -$string['wrongsourcebase'] = 'Wrong source URL base.'; -$string['wrongzipfilename'] = 'Wrong ZIP filename.'; +$string['wrongdestpath'] = 'Wrong destination path'; +$string['wrongsourcebase'] = 'Wrong source URL base'; +$string['wrongzipfilename'] = 'Wrong ZIP file name'; $string['wwwroot'] = 'Web address'; $string['wwwrooterror'] = 'The \'Web Address\' does not appear to be valid - this Moodle installation doesn\'t appear to be there. The value below has been reset.'; $string['xmlrpcrecommended'] = 'Installing the optional xmlrpc extension is useful for Moodle Networking functionality.'; diff --git a/lang/en_utf8/block_search.php b/lang/en_utf8/block_search.php index 0dc8473014844..060e4c0d46ca0 100644 --- a/lang/en_utf8/block_search.php +++ b/lang/en_utf8/block_search.php @@ -12,4 +12,14 @@ $string['bytes'] = ' bytes (0 stands for no limits)'; $string['searchmoodle'] = 'Search Moodle'; $string['usemoodleroot'] = 'Use moodle root for external converters'; +$string['wordhandling'] = 'Microsoft Word handling'; +$string['pdfhandling'] = 'Acrobat PDF handling'; +$string['handlingfor'] = 'Extra handling for'; +$string['searchdiscovery'] = 'Searchable items discovery'; +$string['configtypetotxtcmd'] = 'Converter\'s command line'; +$string['configtypetotxtenv'] = 'Environment define for converter'; +$string['modulessearchswitches'] = 'Indexer activation for modules'; +$string['blockssearchswitches'] = 'Indexer activation for blocks'; +$string['nosearchablemodules'] = 'No searchable modules'; +$string['nosearchableblocks'] = 'No searchable blocks'; ?> \ No newline at end of file diff --git a/lib/adodb/adodb-time.zip b/lib/adodb/adodb-time.zip deleted file mode 100644 index d3239dbc32b26..0000000000000 Binary files a/lib/adodb/adodb-time.zip and /dev/null differ diff --git a/lib/adodb/adodb-xmlschema-0.0.1-snap20030511/docs/media/bg_left.png b/lib/adodb/adodb-xmlschema-0.0.1-snap20030511/docs/media/bg_left.png deleted file mode 100644 index 19fdf05d9fe4e..0000000000000 Binary files a/lib/adodb/adodb-xmlschema-0.0.1-snap20030511/docs/media/bg_left.png and /dev/null differ diff --git a/lib/adodb/adodb-xmlschema.zip b/lib/adodb/adodb-xmlschema.zip deleted file mode 100644 index 14e6a8f3287bb..0000000000000 Binary files a/lib/adodb/adodb-xmlschema.zip and /dev/null differ diff --git a/lib/adodb/cute_icons_for_site/adodb.gif b/lib/adodb/cute_icons_for_site/adodb.gif deleted file mode 100644 index c5e8dfc6db2d4..0000000000000 Binary files a/lib/adodb/cute_icons_for_site/adodb.gif and /dev/null differ diff --git a/lib/adodb/cute_icons_for_site/adodb.png b/lib/adodb/cute_icons_for_site/adodb.png deleted file mode 100644 index 339dd761ef6c2..0000000000000 Binary files a/lib/adodb/cute_icons_for_site/adodb.png and /dev/null differ diff --git a/lib/adodb/cute_icons_for_site/adodb2.gif b/lib/adodb/cute_icons_for_site/adodb2.gif deleted file mode 100644 index f12ae2037ee14..0000000000000 Binary files a/lib/adodb/cute_icons_for_site/adodb2.gif and /dev/null differ diff --git a/lib/adodb/cute_icons_for_site/adodb2.png b/lib/adodb/cute_icons_for_site/adodb2.png deleted file mode 100644 index ab18515a802bf..0000000000000 Binary files a/lib/adodb/cute_icons_for_site/adodb2.png and /dev/null differ diff --git a/lib/adodb/tests/tmssql.php b/lib/adodb/tests/tmssql.php deleted file mode 100644 index 69bcb9ee7a724..0000000000000 --- a/lib/adodb/tests/tmssql.php +++ /dev/null @@ -1,10 +0,0 @@ - \ No newline at end of file diff --git a/lib/componentlib.class.php b/lib/componentlib.class.php index a394d7786c01d..e44115f1edf1c 100644 --- a/lib/componentlib.class.php +++ b/lib/componentlib.class.php @@ -84,9 +84,9 @@ // $a = new stdClass(); // $a->url = 'http://download.moodle.org/lang16/es_utf8.zip'; // $a->dest= $CFG->dataroot.'/lang'; -// error(get_string($cd->get_error(), 'error', $a)); +// print_error($cd->get_error(), 'error', '', $a); // } else { -// error(get_string($cd->get_error(), 'error')); +// print_error($cd->get_error(), 'error'); // } // break; // case COMPONENT_UPTODATE: diff --git a/lib/cookieless.php b/lib/cookieless.php deleted file mode 100644 index e7ca80b3307a4..0000000000000 --- a/lib/cookieless.php +++ /dev/null @@ -1,136 +0,0 @@ -usesid=true; -* in config.php. -* Based on code from php manual by Richard at postamble.co.uk -* Attempts to use cookies if cookies not present then uses session ids attached to all urls and forms to pass session id from page to page. -* If site is open to google, google is given guest access as usual and there are no sessions. No session ids will be attached to urls for googlebot. -* This doesn't require trans_sid to be turned on but this is recommended for better performance -* you should put : -* session.use_trans_sid = 1 -* in your php.ini file and make sure that you don't have a line like this in your php.ini -* session.use_only_cookies = 1 -* @author Richard at postamble.co.uk and Jamie Pratt -* @license http://www.gnu.org/copyleft/gpl.html GNU Public License -*/ -/** -* You won't call this function directly. This function is used to process -* text buffered by php in an output buffer. All output is run through this function -* before it is ouput. -* @param string $buffer is the output sent from php -* @return string the output sent to the browser -*/ -function sid_ob_rewrite($buffer){ - $replacements = array( - '/(<\s*(a|link|script|frame|area)\s[^>]*(href|src)\s*=\s*")([^"]*)(")/i', - '/(<\s*(a|link|script|frame|area)\s[^>]*(href|src)\s*=\s*\')([^\']*)(\')/i'); - - $buffer = preg_replace_callback($replacements, "sid_rewrite_link_tag", $buffer); - $buffer = preg_replace('/]*>/i', - '\0', $buffer); - - return $buffer; -} -/** -* You won't call this function directly. This function is used to process -* text buffered by php in an output buffer. All output is run through this function -* before it is ouput. -* This function only processes absolute urls, it is used when we decide that -* php is processing other urls itself but needs some help with internal absolute urls still. -* @param string $buffer is the output sent from php -* @return string the output sent to the browser -*/ -function sid_ob_rewrite_absolute($buffer){ - $replacements = array( - '/(<\s*(a|link|script|frame|area)\s[^>]*(href|src)\s*=\s*")((?:http|https)[^"]*)(")/i', - '/(<\s*(a|link|script|frame|area)\s[^>]*(href|src)\s*=\s*\')((?:http|https)[^\']*)(\')/i'); - - $buffer = preg_replace_callback($replacements, "sid_rewrite_link_tag", $buffer); - $buffer = preg_replace('/]*>/i', - '\0', $buffer); - return $buffer; -} -/** -* A function to process link, a and script tags found -* by preg_replace_callback in {@link sid_ob_rewrite($buffer)}. -*/ -function sid_rewrite_link_tag($matches){ - $url = $matches[4]; - $url=sid_process_url($url); - return $matches[1]. $url.$matches[5]; -} -/** -* You can call this function directly. This function is used to process -* urls to add a moodle session id to the url for internal links. -* @param string $url is a url -* @return string the processed url -*/ -function sid_process_url($url) { - global $CFG; - if ((preg_match('/^(http|https):/i', $url)) // absolute url - && ((stripos($url, $CFG->wwwroot)!==0) && stripos($url, $CFG->httpswwwroot)!==0)) { // and not local one - return $url; //don't attach sessid to non local urls - } - if ($url[0]=='#' || (stripos($url, 'javascript:')===0)) { - return $url; //don't attach sessid to anchors - } - if (strpos($url, session_name())!==FALSE) - { - return $url; //don't attach sessid to url that already has one sessid - } - if (strpos($url, "?")===FALSE){ - $append="?".strip_tags(session_name() . '=' . session_id() ); - } else { - $append="&".strip_tags(session_name() . '=' . session_id() ); - } - //put sessid before any anchor - $p = strpos($url, "#"); - if($p!==FALSE){ - $anch = substr($url, $p); - $url = substr($url, 0, $p).$append.$anch ; - } else { - $url .= $append ; - } - return $url; -} - - -/** -* Call this function before there has been any output to the browser to -* buffer output and add session ids to all internal links. -*/ -function sid_start_ob(){ - global $CFG; - //don't attach sess id for bots - - if (!empty($_SERVER['HTTP_USER_AGENT'])) { - if (!empty($CFG->opentogoogle)) { - if (strpos($_SERVER['HTTP_USER_AGENT'], 'Googlebot') !== false ) { - @ini_set('session.use_trans_sid', '0'); // try and turn off trans_sid - $CFG->usesid=false; - return; - } - if (strpos($_SERVER['HTTP_USER_AGENT'], 'google.com') !== false ) { - @ini_set('session.use_trans_sid', '0'); // try and turn off trans_sid - $CFG->usesid=false; - return; - } - } - if (strpos($_SERVER['HTTP_USER_AGENT'], 'W3C_Validator') !== false ) { - @ini_set('session.use_trans_sid', '0'); // try and turn off trans_sid - $CFG->usesid=false; - return; - } - } - @ini_set('session.use_trans_sid', '1'); // try and turn on trans_sid - if (ini_get('session.use_trans_sid')!=0 ){ - // use trans sid as its available - ini_set('url_rewriter.tags', 'a=href,area=href,script=src,link=href,' - . 'frame=src,form=fakeentry'); - ob_start('sid_ob_rewrite_absolute'); - }else{ - //rewrite all links ourselves - ob_start('sid_ob_rewrite'); - } -} -?> diff --git a/lib/db/mysql.php b/lib/db/mysql.php deleted file mode 100644 index 3e27b02c1aa3a..0000000000000 --- a/lib/db/mysql.php +++ /dev/null @@ -1,2337 +0,0 @@ -config.php and remove all the unused settings (except the database, URL and directory definitions). See config-dist.php for an example of how your new slim config.php should look."); - } - if ($oldversion < 2002092000) { - execute_sql(" ALTER TABLE `user` CHANGE `lang` `lang` VARCHAR(5) DEFAULT 'en' NOT NULL "); - } - if ($oldversion < 2002092100) { - execute_sql(" ALTER TABLE `user` ADD `deleted` TINYINT(1) UNSIGNED DEFAULT '0' NOT NULL AFTER `confirmed` "); - } - if ($oldversion < 2002101001) { - execute_sql(" ALTER TABLE `user` ADD `htmleditor` TINYINT(1) UNSIGNED DEFAULT '1' NOT NULL AFTER `maildisplay` "); - } - if ($oldversion < 2002101701) { - execute_sql(" ALTER TABLE `reading` RENAME `resource` "); // Small line with big consequences! - execute_sql(" DELETE FROM `log_display` WHERE module = 'reading'"); - execute_sql(" INSERT INTO log_display (module, action, mtable, field) VALUES ('resource', 'view', 'resource', 'name') "); - execute_sql(" UPDATE log SET module = 'resource' WHERE module = 'reading' "); - execute_sql(" UPDATE modules SET name = 'resource' WHERE name = 'reading' "); - } - - if ($oldversion < 2002102503) { - execute_sql(" ALTER TABLE `course` ADD `modinfo` TEXT NOT NULL AFTER `format` "); - require_once("$CFG->dirroot/mod/forum/lib.php"); - require_once("$CFG->dirroot/course/lib.php"); - - if (! $module = get_record("modules", "name", "forum")) { - notify("Could not find forum module!!"); - return false; - } - - // First upgrade the site forums - if ($site = get_site()) { - print_heading("Making News forums editable for main site (moving to section 1)..."); - if ($news = forum_get_course_forum($site->id, "news")) { - $mod->course = $site->id; - $mod->module = $module->id; - $mod->instance = $news->id; - $mod->section = 1; - if (! $mod->coursemodule = add_course_module($mod) ) { - notify("Could not add a new course module to the site"); - return false; - } - if (! $sectionid = add_mod_to_section($mod) ) { - notify("Could not add the new course module to that section"); - return false; - } - if (! set_field("course_modules", "section", $sectionid, "id", $mod->coursemodule)) { - notify("Could not update the course module with the correct section"); - return false; - } - } - } - - - // Now upgrade the courses. - if ($courses = get_records_sql("SELECT * FROM course WHERE category > 0")) { - print_heading("Making News and Social forums editable for each course (moving to section 0)..."); - foreach ($courses as $course) { - if ($course->format == "social") { // we won't touch them - continue; - } - if ($news = forum_get_course_forum($course->id, "news")) { - $mod->course = $course->id; - $mod->module = $module->id; - $mod->instance = $news->id; - $mod->section = 0; - if (! $mod->coursemodule = add_course_module($mod) ) { - notify("Could not add a new course module to the course '" . format_string($course->fullname) . "'"); - return false; - } - if (! $sectionid = add_mod_to_section($mod) ) { - notify("Could not add the new course module to that section"); - return false; - } - if (! set_field("course_modules", "section", $sectionid, "id", $mod->coursemodule)) { - notify("Could not update the course module with the correct section"); - return false; - } - } - if ($social = forum_get_course_forum($course->id, "social")) { - $mod->course = $course->id; - $mod->module = $module->id; - $mod->instance = $social->id; - $mod->section = 0; - if (! $mod->coursemodule = add_course_module($mod) ) { - notify("Could not add a new course module to the course '" . format_string($course->fullname) . "'"); - return false; - } - if (! $sectionid = add_mod_to_section($mod) ) { - notify("Could not add the new course module to that section"); - return false; - } - if (! set_field("course_modules", "section", $sectionid, "id", $mod->coursemodule)) { - notify("Could not update the course module with the correct section"); - return false; - } - } - } - } - } - - if ($oldversion < 2002111003) { - execute_sql(" ALTER TABLE `course` ADD `modinfo` TEXT NOT NULL AFTER `format` "); - if ($courses = get_records_sql("SELECT * FROM course")) { - require_once("$CFG->dirroot/course/lib.php"); - foreach ($courses as $course) { - - $modinfo = serialize(get_array_of_activities($course->id)); - - if (!set_field("course", "modinfo", $modinfo, "id", $course->id)) { - notify("Could not cache module information for course '" . format_string($course->fullname) . "'!"); - } - } - } - } - - if ($oldversion < 2002111100) { - print_simple_box_start("CENTER", "", "#FFCCCC"); - echo ""; - echo "

Changes have been made to all built-in themes, to add the new popup navigation menu."; - echo "

If you have customised themes, you will need to edit theme/xxxx/header.html as follows:"; - echo "

  • Change anywhere it says $"."button to say $"."menu"; - echo "
  • Add $"."button elsewhere (eg at the end of the navigation bar)
"; - echo "

See the standard themes for examples, eg: theme/standard/header.html"; - print_simple_box_end(); - } - - if ($oldversion < 2002111200) { - execute_sql(" ALTER TABLE `course` ADD `showrecent` TINYINT(5) UNSIGNED DEFAULT '1' NOT NULL AFTER `numsections` "); - } - - if ($oldversion < 2002111400) { - // Rebuild all course caches, because some may not be done in new installs (eg site page) - if ($courses = get_records_sql("SELECT * FROM course")) { - require_once("$CFG->dirroot/course/lib.php"); - foreach ($courses as $course) { - - $modinfo = serialize(get_array_of_activities($course->id)); - - if (!set_field("course", "modinfo", $modinfo, "id", $course->id)) { - notify("Could not cache module information for course '" . format_string($course->fullname) . "'!"); - } - } - } - } - - if ($oldversion < 2002112000) { - set_config("guestloginbutton", 1); - } - - if ($oldversion < 2002122300) { - execute_sql("ALTER TABLE `log` CHANGE `user` `userid` INT(10) UNSIGNED DEFAULT '0' NOT NULL "); - execute_sql("ALTER TABLE `user_admins` CHANGE `user` `userid` INT(10) UNSIGNED DEFAULT '0' NOT NULL "); - execute_sql("ALTER TABLE `user_students` CHANGE `user` `userid` INT(10) UNSIGNED DEFAULT '0' NOT NULL "); - execute_sql("ALTER TABLE `user_teachers` CHANGE `user` `userid` INT(10) UNSIGNED DEFAULT '0' NOT NULL "); - execute_sql("ALTER TABLE `user_students` CHANGE `start` `timestart` INT(10) UNSIGNED DEFAULT '0' NOT NULL "); - execute_sql("ALTER TABLE `user_students` CHANGE `end` `timeend` INT(10) UNSIGNED DEFAULT '0' NOT NULL "); - } - - if ($oldversion < 2002122700) { - if (! record_exists("log_display", "module", "user", "action", "view")) { - execute_sql("INSERT INTO {$CFG->prefix}log_display (module, action, mtable, field) VALUES ('user', 'view', 'user', 'CONCAT(firstname,' ',lastname)') "); - } - } - if ($oldversion < 2003010101) { - delete_records("log_display", "module", "user"); - $new->module = "user"; - $new->action = "view"; - $new->mtable = "user"; - $new->field = "CONCAT(firstname,\" \",lastname)"; - insert_record("log_display", $new); - - delete_records("log_display", "module", "course"); - $new->module = "course"; - $new->action = "view"; - $new->mtable = "course"; - $new->field = "fullname"; - insert_record("log_display", $new); - $new->action = "update"; - insert_record("log_display", $new); - $new->action = "enrol"; - insert_record("log_display", $new); - } - - if ($oldversion < 2003012200) { - // execute_sql(" ALTER TABLE `log_display` CHANGE `module` `module` VARCHAR( 20 ) NOT NULL "); - // Commented out - see below where it's done properly - } - - if ($oldversion < 2003032500) { - modify_database("", "CREATE TABLE `prefix_user_coursecreators` ( - `id` int(10) unsigned NOT NULL auto_increment, - `userid` int(10) unsigned NOT NULL default '0', - PRIMARY KEY (`id`), - UNIQUE KEY `id` (`id`) - ) TYPE=MyISAM COMMENT='One record per course creator';"); - } - if ($oldversion < 2003032602) { - // Redoing it because of no prefix last time - execute_sql(" ALTER TABLE `{$CFG->prefix}log_display` CHANGE `module` `module` VARCHAR( 20 ) NOT NULL "); - // Add some indexes for speed - execute_sql(" ALTER TABLE `{$CFG->prefix}log` ADD INDEX(course) "); - execute_sql(" ALTER TABLE `{$CFG->prefix}log` ADD INDEX(userid) "); - } - - if ($oldversion < 2003041400) { - table_column("course_modules", "", "visible", "integer", "1", "unsigned", "1", "not null", "score"); - } - - if ($oldversion < 2003042104) { // Try to update permissions of all files - if ($files = get_directory_list($CFG->dataroot)) { - echo "Attempting to update permissions for all files... ignore any errors."; - foreach ($files as $file) { - echo "$CFG->dataroot/$file
"; - @chmod("$CFG->dataroot/$file", $CFG->directorypermissions); - } - } - } - - if ($oldversion < 2003042400) { - // Rebuild all course caches, because of changes to do with visible variable - if ($courses = get_records_sql("SELECT * FROM {$CFG->prefix}course")) { - require_once("$CFG->dirroot/course/lib.php"); - foreach ($courses as $course) { - $modinfo = serialize(get_array_of_activities($course->id)); - - if (!set_field("course", "modinfo", $modinfo, "id", $course->id)) { - notify("Could not cache module information for course '" . format_string($course->fullname) . "'!"); - } - } - } - } - - if ($oldversion < 2003042500) { - // Convert all usernames to lowercase. - $users = get_records_sql("SELECT id, username FROM {$CFG->prefix}user"); - $cerrors = ""; - $rarray = array(); - - foreach ($users as $user) { // Check for possible conflicts - $lcname = trim(moodle_strtolower($user->username)); - if (in_array($lcname, $rarray)) { - $cerrors .= $user->id."->".$lcname.'
' ; - } else { - array_push($rarray,$lcname); - } - } - - if ($cerrors != '') { - notify("Error: Cannot convert usernames to lowercase. - Following usernames would overlap (id->username):
$cerrors . - Please resolve overlapping errors."); - $result = false; - } - - $cerrors = ""; - echo "Checking userdatabase:
"; - foreach ($users as $user) { - $lcname = trim(moodle_strtolower($user->username)); - if ($lcname != $user->username) { - $convert = set_field("user" , "username" , $lcname, "id", $user->id); - if (!$convert) { - if ($cerrors){ - $cerrors .= ", "; - } - $cerrors .= $item; - } else { - echo "."; - } - } - } - if ($cerrors != '') { - notify("There were errors when converting following usernames to lowercase. - '$cerrors' . Sorry, but you will need to fix your database by hand."); - $result = false; - } - } - - if ($oldversion < 2003042600) { - /// Some more indexes - we need all the help we can get on the logs - //execute_sql(" ALTER TABLE `{$CFG->prefix}log` ADD INDEX(module) "); - //execute_sql(" ALTER TABLE `{$CFG->prefix}log` ADD INDEX(action) "); - } - - if ($oldversion < 2003042700) { - /// Changing to multiple indexes - execute_sql(" ALTER TABLE `{$CFG->prefix}log` DROP INDEX module ", false); - execute_sql(" ALTER TABLE `{$CFG->prefix}log` DROP INDEX action ", false); - execute_sql(" ALTER TABLE `{$CFG->prefix}log` DROP INDEX course ", false); - execute_sql(" ALTER TABLE `{$CFG->prefix}log` DROP INDEX userid ", false); - execute_sql(" ALTER TABLE `{$CFG->prefix}log` ADD INDEX coursemoduleaction (course,module,action) "); - execute_sql(" ALTER TABLE `{$CFG->prefix}log` ADD INDEX courseuserid (course,userid) "); - } - - if ($oldversion < 2003042801) { - execute_sql("CREATE TABLE `{$CFG->prefix}course_display` ( - `id` int(10) unsigned NOT NULL auto_increment, - `course` int(10) unsigned NOT NULL default '0', - `userid` int(10) unsigned NOT NULL default '0', - `display` int(10) NOT NULL default '0', - PRIMARY KEY (`id`), - UNIQUE KEY `id` (`id`), - KEY `courseuserid` (course,userid) - ) TYPE=MyISAM COMMENT='Stores info about how to display the course'"); - } - - if ($oldversion < 2003050400) { - table_column("course_sections", "", "visible", "integer", "1", "unsigned", "1", "", ""); - } - - if ($oldversion < 2003050900) { - table_column("modules", "", "visible", "integer", "1", "unsigned", "1", "", ""); - } - - if ($oldversion < 2003050902) { - if (get_records("modules", "name", "pgassignment")) { - print_simple_box("Note: the pgassignment module has been removed (it will be replaced later by the workshop module). Go to the new 'Manage Modules' page and DELETE IT from your system", "center", "50%", "$THEME->cellheading", "20", "noticebox"); - } - } - - if ($oldversion < 2003051600) { - print_simple_box("Thanks for upgrading!

There are many changes since the last release. Please read the release notes carefully. If you are using CUSTOM themes you will need to edit them. You will also need to check your site's config.php file.", "center", "50%", "$THEME->cellheading", "20", "noticebox"); - } - - if ($oldversion < 2003052300) { - table_column("user", "", "autosubscribe", "integer", "1", "unsigned", "1", "", "htmleditor"); - } - - if ($oldversion < 2003072100) { - table_column("course", "", "visible", "integer", "1", "unsigned", "1", "", "marker"); - } - - if ($oldversion < 2003072101) { - table_column("course_sections", "sequence", "sequence", "text", "", "", "", "", ""); - } - - if ($oldversion < 2003072800) { - print_simple_box("The following database index improves performance, but can be quite large - if you are upgrading and you have problems with a limited quota you may want to delete this index later from the '{$CFG->prefix}log' table in your database", "center", "50%", "$THEME->cellheading", "20", "noticebox"); - flush(); - execute_sql(" ALTER TABLE `{$CFG->prefix}log` ADD INDEX timecoursemoduleaction (time,course,module,action) "); - execute_sql(" ALTER TABLE `{$CFG->prefix}user_students` ADD INDEX courseuserid (course,userid) "); - execute_sql(" ALTER TABLE `{$CFG->prefix}user_teachers` ADD INDEX courseuserid (course,userid) "); - } - - if ($oldversion < 2003072803) { - table_column("course_categories", "", "description", "text", "", "", ""); - table_column("course_categories", "", "parent", "integer", "10", "unsigned"); - table_column("course_categories", "", "sortorder", "integer", "10", "unsigned"); - table_column("course_categories", "", "courseorder", "text", "", "", ""); - table_column("course_categories", "", "visible", "integer", "1", "unsigned", "1"); - table_column("course_categories", "", "timemodified", "integer", "10", "unsigned"); - } - - if ($oldversion < 2003080400) { - table_column("course_categories", "courseorder", "courseorder", "integer", "10", "unsigned"); - table_column("course", "", "sortorder", "integer", "10", "unsigned", "0", "", "category"); - } - - if ($oldversion < 2003080700) { - notify("Cleaning up categories and course ordering..."); - fix_course_sortorder(); - } - - if ($oldversion < 2003081001) { - table_column("course", "format", "format", "varchar", "10", "", "topics"); - } - - if ($oldversion < 2003081500) { -// print_simple_box("Some important changes have been made to how course creators work. Formerly, they could create new courses and assign teachers, and teachers could edit courses. Now, ordinary teachers can no longer edit courses - they need to be a teacher of a course AND a course creator. A new site-wide configuration variable allows you to choose whether to allow course creators to create new courses as well (by default this is off).

The following update will automatically convert all your existing teachers into course creators, to maintain backward compatibility. Make sure you look at your upgraded site carefully and understand these new changes.", "center", "50%", "$THEME->cellheading", "20", "noticebox"); - -// $count = 0; -// $errorcount = 0; -// if ($teachers = get_records("user_teachers")) { -// foreach ($teachers as $teacher) { -// if (! record_exists("user_coursecreators", "userid", $teacher->userid)) { -// $creator = NULL; -// $creator->userid = $teacher->userid; -// if (!insert_record("user_coursecreators", $creator)) { -// $errorcount++; -// } else { -// $count++; -// } -// } -// } -// } -// print_simple_box("$count teachers were upgraded to course creators (with $errorcount errors)", "center", "50%", "$THEME->cellheading", "20", "noticebox"); - - } - - if ($oldversion < 2003081501) { - execute_sql(" CREATE TABLE `{$CFG->prefix}scale` ( - `id` int(10) unsigned NOT NULL auto_increment, - `courseid` int(10) unsigned NOT NULL default '0', - `userid` int(10) unsigned NOT NULL default '0', - `name` varchar(255) NOT NULL default '', - `scale` text NOT NULL, - `description` text NOT NULL, - `timemodified` int(10) unsigned NOT NULL default '0', - PRIMARY KEY (id) - ) TYPE=MyISAM COMMENT='Defines grading scales'"); - - } - - if ($oldversion < 2003081503) { - table_column("forum", "", "scale", "integer", "10", "unsigned", "0", "", "assessed"); - get_scales_menu(0); // Just to force the default scale to be created - } - - if ($oldversion < 2003081600) { - table_column("user_teachers", "", "editall", "integer", "1", "unsigned", "1", "", "role"); - table_column("user_teachers", "", "timemodified", "integer", "10", "unsigned", "0", "", "editall"); - } - - if ($oldversion < 2003081900) { - table_column("course_categories", "courseorder", "coursecount", "integer", "10", "unsigned", "0"); - } - - if ($oldversion < 2003082001) { - table_column("course", "", "showgrades", "integer", "2", "unsigned", "1", "", "format"); - } - - if ($oldversion < 2003082101) { - execute_sql(" ALTER TABLE `{$CFG->prefix}course` ADD INDEX category (category) "); - } - if ($oldversion < 2003082702) { - execute_sql(" INSERT INTO {$CFG->prefix}log_display (module, action, mtable, field) VALUES ('course', 'user report', 'user', 'CONCAT(firstname,\" \",lastname)') "); - } - - if ($oldversion < 2003091400) { - table_column("course_modules", "", "indent", "integer", "5", "unsigned", "0", "", "score"); - } - - if ($oldversion < 2003092900) { - table_column("course", "", "maxbytes", "integer", "10", "unsigned", "0", "", "marker"); - } - - if ($oldversion < 2003102700) { - table_column("user_students", "", "timeaccess", "integer", "10", "unsigned", "0", "", "time"); - table_column("user_teachers", "", "timeaccess", "integer", "10", "unsigned", "0", "", "timemodified"); - - $db->debug = false; - $CFG->debug = 0; - notify("Calculating access times. Please wait - this may take a long time on big sites...", "green"); - flush(); - - if ($courses = get_records_select("course", "category > 0")) { - foreach ($courses as $course) { - notify("Processing " . format_string($course->fullname) . " ...", "green"); - flush(); - if ($users = get_records_select("user_teachers", "course = '$course->id'", - "id", "id, userid, timeaccess")) { - foreach ($users as $user) { - $loginfo = get_record_sql("SELECT id, time FROM {$CFG->prefix}log WHERE course = '$course->id' and userid = '$user->userid' ORDER by time DESC"); - if (empty($loginfo->time)) { - $loginfo->time = 0; - } - execute_sql("UPDATE {$CFG->prefix}user_teachers SET timeaccess = '$loginfo->time' - WHERE userid = '$user->userid' AND course = '$course->id'", false); - - } - } - - if ($users = get_records_select("user_students", "course = '$course->id'", - "id", "id, userid, timeaccess")) { - foreach ($users as $user) { - $loginfo = get_record_sql("SELECT id, time FROM {$CFG->prefix}log - WHERE course = '$course->id' and userid = '$user->userid' - ORDER by time DESC"); - if (empty($loginfo->time)) { - $loginfo->time = 0; - } - execute_sql("UPDATE {$CFG->prefix}user_students - SET timeaccess = '$loginfo->time' - WHERE userid = '$user->userid' AND course = '$course->id'", false); - - } - } - } - } - notify("All courses complete.", "green"); - $db->debug = true; - } - - if ($oldversion < 2003103100) { - table_column("course", "", "showreports", "integer", "4", "unsigned", "0", "", "maxbytes"); - } - - if ($oldversion < 2003121600) { - modify_database("", "CREATE TABLE `prefix_groups` ( - `id` int(10) unsigned NOT NULL auto_increment, - `courseid` int(10) unsigned NOT NULL default '0', - `name` varchar(254) NOT NULL default '', - `description` text NOT NULL, - `lang` varchar(10) NOT NULL default 'en', - `picture` int(10) unsigned NOT NULL default '0', - `timecreated` int(10) unsigned NOT NULL default '0', - `timemodified` int(10) unsigned NOT NULL default '0', - PRIMARY KEY (`id`), - KEY `courseid` (`courseid`) - ) TYPE=MyISAM COMMENT='Each record is a group in a course.'; "); - - modify_database("", "CREATE TABLE `prefix_groups_members` ( - `id` int(10) unsigned NOT NULL auto_increment, - `groupid` int(10) unsigned NOT NULL default '0', - `userid` int(10) unsigned NOT NULL default '0', - `timeadded` int(10) unsigned NOT NULL default '0', - PRIMARY KEY (`id`), - KEY `groupid` (`groupid`) - ) TYPE=MyISAM COMMENT='Lists memberships of users in groups'; "); - } - - if ($oldversion < 2003121800) { - table_column("course", "modinfo", "modinfo", "longtext", "", "", ""); - } - - if ($oldversion < 2003122600) { - table_column("course", "", "groupmode", "integer", "4", "unsigned", "0", "", "showreports"); - table_column("course", "", "groupmodeforce", "integer", "4", "unsigned", "0", "", "groupmode"); - } - - if ($oldversion < 2004010900) { - table_column("course_modules", "", "groupmode", "integer", "4", "unsigned", "0", "", "visible"); - } - - if ($oldversion < 2004011700) { - modify_database("", "CREATE TABLE `prefix_event` ( - `id` int(10) unsigned NOT NULL auto_increment, - `name` varchar(255) NOT NULL default '', - `description` text NOT NULL, - `courseid` int(10) unsigned NOT NULL default '0', - `groupid` int(10) unsigned NOT NULL default '0', - `userid` int(10) unsigned NOT NULL default '0', - `modulename` varchar(20) NOT NULL default '', - `instance` int(10) unsigned NOT NULL default '0', - `eventtype` varchar(20) NOT NULL default '', - `timestart` int(10) unsigned NOT NULL default '0', - `timeduration` int(10) unsigned NOT NULL default '0', - `timemodified` int(10) unsigned NOT NULL default '0', - PRIMARY KEY (`id`), - UNIQUE KEY `id` (`id`), - KEY `courseid` (`courseid`), - KEY `userid` (`userid`) - ) TYPE=MyISAM COMMENT='For everything with a time associated to it'; "); - } - - if ($oldversion < 2004012800) { - modify_database("", "CREATE TABLE `prefix_user_preferences` ( - `id` int(10) unsigned NOT NULL auto_increment, - `userid` int(10) unsigned NOT NULL default '0', - `name` varchar(50) NOT NULL default '', - `value` varchar(255) NOT NULL default '', - PRIMARY KEY (`id`), - UNIQUE KEY `id` (`id`), - KEY `useridname` (userid,name) - ) TYPE=MyISAM COMMENT='Allows modules to store arbitrary user preferences'; "); - } - - if ($oldversion < 2004012900) { - table_column("config", "value", "value", "text", "", "", ""); - } - - if ($oldversion < 2004013101) { - table_column("log", "", "cmid", "integer", "10", "unsigned", "0", "", "module"); - set_config("upgrade", "logs"); - } - - if ($oldversion < 2004020900) { - table_column("course", "", "lang", "varchar", "5", "", "", "", "groupmodeforce"); - } - - if ($oldversion < 2004020903) { - modify_database("", "CREATE TABLE `prefix_cache_text` ( - `id` int(10) unsigned NOT NULL auto_increment, - `md5key` varchar(32) NOT NULL default '', - `formattedtext` longtext NOT NULL, - `timemodified` int(10) unsigned NOT NULL default '0', - PRIMARY KEY (`id`), - KEY `md5key` (`md5key`) - ) TYPE=MyISAM COMMENT='For storing temporary copies of processed texts';"); - } - - if ($oldversion < 2004021000) { - $textfilters = array(); - for ($i=1; $i<=10; $i++) { - $variable = "textfilter$i"; - if (!empty($CFG->$variable)) { /// No more filters - if (is_readable("$CFG->dirroot/".$CFG->$variable)) { - $textfilters[] = $CFG->$variable; - } - } - } - $textfilters = implode(',', $textfilters); - if (empty($textfilters)) { - $textfilters = 'mod/glossary/dynalink.php'; - } - set_config('textfilters', $textfilters); - } - - if ($oldversion < 2004021201) { - modify_database("", "CREATE TABLE `prefix_cache_filters` ( - `id` int(10) unsigned NOT NULL auto_increment, - `filter` varchar(32) NOT NULL default '', - `version` int(10) unsigned NOT NULL default '0', - `md5key` varchar(32) NOT NULL default '', - `rawtext` text NOT NULL, - `timemodified` int(10) unsigned NOT NULL default '0', - PRIMARY KEY (`id`), - KEY `filtermd5key` (filter,md5key) - ) TYPE=MyISAM COMMENT='For keeping information about cached data';"); - } - - if ($oldversion < 2004021500) { - table_column("groups", "", "hidepicture", "integer", "2", "unsigned", "0", "", "picture"); - } - - if ($oldversion < 2004021700) { - if (!empty($CFG->textfilters)) { - $CFG->textfilters = str_replace("tex_filter.php", "filter.php", $CFG->textfilters); - $CFG->textfilters = str_replace("multilang.php", "filter.php", $CFG->textfilters); - $CFG->textfilters = str_replace("censor.php", "filter.php", $CFG->textfilters); - $CFG->textfilters = str_replace("mediaplugin.php", "filter.php", $CFG->textfilters); - $CFG->textfilters = str_replace("algebra_filter.php", "filter.php", $CFG->textfilters); - $CFG->textfilters = str_replace("dynalink.php", "filter.php", $CFG->textfilters); - set_config("textfilters", $CFG->textfilters); - } - } - - if ($oldversion < 2004022000) { - table_column("user", "", "emailstop", "integer", "1", "unsigned", "0", "not null", "email"); - } - - if ($oldversion < 2004022200) { /// Final renaming I hope. :-) - if (!empty($CFG->textfilters)) { - $CFG->textfilters = str_replace("/filter.php", "", $CFG->textfilters); - $CFG->textfilters = str_replace("mod/glossary/dynalink.php", "mod/glossary", $CFG->textfilters); - $textfilters = explode(',', $CFG->textfilters); - foreach ($textfilters as $key => $textfilter) { - $textfilters[$key] = trim($textfilter); - } - set_config("textfilters", implode(',',$textfilters)); - } - } - - if ($oldversion < 2004030702) { /// Because of the renaming of Czech language pack - execute_sql("UPDATE {$CFG->prefix}user SET lang = 'cs' WHERE lang = 'cz'"); - execute_sql("UPDATE {$CFG->prefix}course SET lang = 'cs' WHERE lang = 'cz'"); - } - - if ($oldversion < 2004041800) { /// Integrate Block System from contrib - table_column("course", "", "blockinfo", "varchar", "255", "", "", "not null", "modinfo"); - } - - if ($oldversion < 2004042600) { /// Rebuild course caches for resource icons - //include_once("$CFG->dirroot/course/lib.php"); - //rebuild_course_cache(); - } - - if ($oldversion < 2004042700) { /// Increase size of lang fields - table_column("user", "lang", "lang", "varchar", "10", "", "en"); - table_column("groups", "lang", "lang", "varchar", "10", "", ""); - table_column("course", "lang", "lang", "varchar", "10", "", ""); - } - - if ($oldversion < 2004042701) { /// Add hiddentopics field to control hidden topics behaviour - table_column("course", "", "hiddentopics", "integer", "1", "unsigned", "0", "not null", "visible"); - } - - if ($oldversion < 2004042702) { /// add a format field for the description - table_column("event", "", "format", "integer", "4", "unsigned", "0", "not null", "description"); - } - - if ($oldversion < 2004042900) { - execute_sql(" ALTER TABLE `{$CFG->prefix}course` DROP `showrecent` "); - } - - if ($oldversion < 2004043001) { /// Change hiddentopics to hiddensections - table_column("course", "hiddentopics", "hiddensections", "integer", "2", "unsigned", "0", "not null"); - } - - if ($oldversion < 2004050400) { /// add a visible field for events - table_column("event", "", "visible", "tinyint", "1", "", "1", "not null", "timeduration"); - if ($events = get_records('event')) { - foreach($events as $event) { - if ($moduleid = get_field('modules', 'id', 'name', $event->modulename)) { - if (get_field('course_modules', 'visible', 'module', $moduleid, 'instance', $event->instance) == 0) { - set_field('event', 'visible', 0, 'id', $event->id); - } - } - } - } - } - - if ($oldversion < 2004052800) { /// First version tagged "1.4 development", version.php 1.227 - set_config('siteblocksadded', true); /// This will be used later by the block upgrade - } - - if ($oldversion < 2004053000) { /// set defaults for site course - $site = get_site(); - set_field('course', 'numsections', 0, 'id', $site->id); - set_field('course', 'groupmodeforce', 1, 'id', $site->id); - set_field('course', 'teacher', get_string('administrator'), 'id', $site->id); - set_field('course', 'teachers', get_string('administrators'), 'id', $site->id); - set_field('course', 'student', get_string('user'), 'id', $site->id); - set_field('course', 'students', get_string('users'), 'id', $site->id); - } - - if ($oldversion < 2004060100) { - set_config('digestmailtime', 0); - table_column('user', "", 'maildigest', 'tinyint', '1', '', '0', 'not null', 'mailformat'); - } - - if ($oldversion < 2004062400) { - table_column('user_teachers', "", 'timeend', 'int', '10', 'unsigned', '0', 'not null', 'editall'); - table_column('user_teachers', "", 'timestart', 'int', '10', 'unsigned', '0', 'not null', 'editall'); - } - - if ($oldversion < 2004062401) { - table_column('course', '', 'idnumber', 'varchar', '100', '', '', 'not null', 'shortname'); - execute_sql('UPDATE '.$CFG->prefix.'course SET idnumber = shortname'); // By default - } - - if ($oldversion < 2004062600) { - table_column('course', '', 'cost', 'varchar', '10', '', '', 'not null', 'lang'); - } - - if ($oldversion < 2004072900) { - table_column('course', '', 'enrolperiod', 'int', '10', 'unsigned', '0', 'not null', 'startdate'); - } - - if ($oldversion < 2004072901) { // Fixing error in schema - if ($record = get_record('log_display', 'module', 'course', 'action', 'update')) { - delete_records('log_display', 'module', 'course', 'action', 'update'); - insert_record('log_display', $record, false); - } - } - - if ($oldversion < 2004081200) { // Fixing version errors in some blocks - set_field('blocks', 'version', 2004081200, 'name', 'admin'); - set_field('blocks', 'version', 2004081200, 'name', 'calendar_month'); - set_field('blocks', 'version', 2004081200, 'name', 'course_list'); - } - - if ($oldversion < 2004081500) { // Adding new "auth" field to user table to allow more flexibility - table_column('user', '', 'auth', 'varchar', '20', '', 'manual', 'not null', 'id'); - - execute_sql("UPDATE {$CFG->prefix}user SET auth = 'manual'"); // Set everyone to 'manual' to be sure - - if ($admins = get_admins()) { // Set all the NON-admins to whatever the current auth module is - $adminlist = array(); - foreach ($admins as $user) { - $adminlist[] = $user->id; - } - $adminlist = implode(',', $adminlist); - execute_sql("UPDATE {$CFG->prefix}user SET auth = '$CFG->auth' WHERE id NOT IN ($adminlist)"); - } - } - - if ($oldversion < 2004082200) { // Making admins teachers on site course - $site = get_site(); - $admins = get_admins(); - foreach ($admins as $admin) { - add_teacher($admin->id, $site->id); - } - } - - if ($oldversion < 2004082600) { - //update auth-fields for external users - // following code would not work in 1.8 -/* include_once ($CFG->dirroot."/auth/".$CFG->auth."/lib.php"); - if (function_exists('auth_get_userlist')) { - $externalusers = auth_get_userlist(); - if (!empty($externalusers)){ - $externalusers = '\''. implode('\',\'',$externalusers).'\''; - execute_sql("UPDATE {$CFG->prefix}user SET auth = '$CFG->auth' WHERE username IN ($externalusers)"); - } - }*/ - } - - if ($oldversion < 2004082900) { // Make sure guest is "manual" too. - set_field('user', 'auth', 'manual', 'username', 'guest'); - } - - /* Commented out unused guid-field code - if ($oldversion < 2004090300) { // Add guid-field used in user syncronization - table_column('user', '', 'guid', 'varchar', '128', '', '', '', 'auth'); - execute_sql("ALTER TABLE {$CFG->prefix}user ADD INDEX authguid (auth, guid)"); - } - */ - - if ($oldversion < 2004091900) { // modify idnumber to hold longer values - table_column('user', 'idnumber', 'idnumber', 'varchar', '64', '', '', '', ''); - execute_sql("ALTER TABLE {$CFG->prefix}user DROP INDEX user_idnumber",false); // added in case of conflicts with upgrade from 14stable - execute_sql("ALTER TABLE {$CFG->prefix}user DROP INDEX user_auth",false); // added in case of conflicts with upgrade from 14stable - - execute_sql("ALTER TABLE {$CFG->prefix}user ADD INDEX idnumber (idnumber)"); - execute_sql("ALTER TABLE {$CFG->prefix}user ADD INDEX auth (auth)"); - } - - if ($oldversion < 2004093001) { // add new table for sessions storage - execute_sql(" CREATE TABLE `{$CFG->prefix}sessions` ( - `sesskey` char(32) NOT null, - `expiry` int(11) unsigned NOT null, - `expireref` varchar(64), - `data` text NOT null, - PRIMARY KEY (`sesskey`), - KEY (`expiry`) - ) TYPE=MyISAM COMMENT='Optional database session storage, not used by default';"); - } - - if ($oldversion < 2004111500) { // Update any users/courses using wrongly-named lang pack - execute_sql("UPDATE {$CFG->prefix}user SET lang = 'mi_nt' WHERE lang = 'ma_nt'"); - execute_sql("UPDATE {$CFG->prefix}course SET lang = 'mi_nt' WHERE lang = 'ma_nt'"); - } - - if ($oldversion < 2004111700) { // add indexes. - drop them first silently to avoid conflicts when upgrading. - execute_sql(" ALTER TABLE `{$CFG->prefix}course` DROP INDEX idnumber;",false); - execute_sql(" ALTER TABLE `{$CFG->prefix}course` DROP INDEX shortname;",false); - execute_sql(" ALTER TABLE `{$CFG->prefix}user_students` DROP INDEX userid;",false); - execute_sql(" ALTER TABLE `{$CFG->prefix}user_teachers` DROP INDEX userid;",false); - - execute_sql(" ALTER TABLE `{$CFG->prefix}course` ADD INDEX idnumber (idnumber);"); - execute_sql(" ALTER TABLE `{$CFG->prefix}course` ADD INDEX shortname (shortname);"); - execute_sql(" ALTER TABLE `{$CFG->prefix}user_students` ADD INDEX userid (userid);"); - execute_sql(" ALTER TABLE `{$CFG->prefix}user_teachers` ADD INDEX userid (userid);"); - } - - if ($oldversion < 2004111700) {// add an index to event for timestart and timeduration. - drop them first silently to avoid conflicts when upgrading. - execute_sql("ALTER TABLE {$CFG->prefix}event DROP INDEX timestart;",false); - execute_sql("ALTER TABLE {$CFG->prefix}event DROP INDEX timeduration;",false); - - modify_database('','ALTER TABLE prefix_event ADD INDEX timestart (timestart);'); - modify_database('','ALTER TABLE prefix_event ADD INDEX timeduration (timeduration);'); - } - - if ($oldversion < 2004111700) { //add indexes on modules and course_modules. - drop them first silently to avoid conflicts when upgrading. - execute_sql("ALTER TABLE {$CFG->prefix}course_modules drop key visible;",false); - execute_sql("ALTER TABLE {$CFG->prefix}course_modules drop key course;",false); - execute_sql("ALTER TABLE {$CFG->prefix}course_modules drop key module;",false); - execute_sql("ALTER TABLE {$CFG->prefix}course_modules drop key instance;",false); - execute_sql("ALTER TABLE {$CFG->prefix}course_modules drop key deleted;",false); - execute_sql("ALTER TABLE {$CFG->prefix}modules drop key name;",false); - - modify_database('','ALTER TABLE prefix_course_modules add key visible(visible);'); - modify_database('','ALTER TABLE prefix_course_modules add key course(course);'); - modify_database('','ALTER TABLE prefix_course_modules add key module(module);'); - modify_database('','ALTER TABLE prefix_course_modules add key instance (instance);'); - modify_database('','ALTER TABLE prefix_course_modules add key deleted (deleted);'); - modify_database('','ALTER TABLE prefix_modules add key name(name);'); - } - - if ($oldversion < 2004111700) { // add an index on the groups_members table. - drop them first silently to avoid conflicts when upgrading. - execute_sql("ALTER TABLE {$CFG->prefix}groups_members DROP INDEX userid;",false); - - modify_database('','ALTER TABLE prefix_groups_members ADD INDEX userid (userid);'); - } - - if ($oldversion < 2004111700) { // add an index on user students timeaccess (used for sorting)- drop them first silently to avoid conflicts when upgrading - execute_sql("ALTER TABLE {$CFG->prefix}user_students DROP INDEX timeaccess;",false); - - modify_database('','ALTER TABLE prefix_user_students ADD INDEX timeaccess (timeaccess);'); - } - - if ($oldversion < 2004111700) { // add indexes on faux-foreign keys. - drop them first silently to avoid conflicts when upgrading. - execute_sql("ALTER TABLE {$CFG->prefix}scale DROP INDEX courseid;",false); - execute_sql("ALTER TABLE {$CFG->prefix}user_admins DROP INDEX userid;",false); - execute_sql("ALTER TABLE {$CFG->prefix}user_coursecreators DROP INDEX userid;",false); - - modify_database('','ALTER TABLE prefix_scale ADD INDEX courseid (courseid);'); - modify_database('','ALTER TABLE prefix_user_admins ADD INDEX userid (userid);'); - modify_database('','ALTER TABLE prefix_user_coursecreators ADD INDEX userid (userid);'); - } - - if ($oldversion < 2004111700) { // replace index on course - fix_course_sortorder(0,0,1); - execute_sql("ALTER TABLE `{$CFG->prefix}course` DROP KEY category",false); - - execute_sql("ALTER TABLE `{$CFG->prefix}course` DROP KEY category_sortorder;",false); - modify_database('', "ALTER TABLE `prefix_course` ADD UNIQUE KEY category_sortorder(category,sortorder)"); - - execute_sql("ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_deleted_idx;",false); - execute_sql("ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_confirmed_idx;",false); - execute_sql("ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_firstname_idx;",false); - execute_sql("ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_lastname_idx;",false); - execute_sql("ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_city_idx;",false); - execute_sql("ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_country_idx;",false); - execute_sql("ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_lastaccess_idx;",false); - - modify_database("", "ALTER TABLE `prefix_user` ADD INDEX prefix_user_deleted_idx (deleted)"); - modify_database("", "ALTER TABLE `prefix_user` ADD INDEX prefix_user_confirmed_idx (confirmed)"); - modify_database("", "ALTER TABLE `prefix_user` ADD INDEX prefix_user_firstname_idx (firstname)"); - modify_database("", "ALTER TABLE `prefix_user` ADD INDEX prefix_user_lastname_idx (lastname)"); - modify_database("", "ALTER TABLE `prefix_user` ADD INDEX prefix_user_city_idx (city)"); - modify_database("", "ALTER TABLE `prefix_user` ADD INDEX prefix_user_country_idx (country)"); - modify_database("", "ALTER TABLE `prefix_user` ADD INDEX prefix_user_lastaccess_idx (lastaccess)"); - } - - if ($oldversion < 2004111700) { // one more index for email (for sorting) - execute_sql("ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_email_idx;",false); - modify_database('','ALTER TABLE `prefix_user` ADD INDEX prefix_user_email_idx (email);'); - } - - if ($oldversion < 2004112200) { // new 'enrol' field for enrolment tables - table_column('user_students', '', 'enrol', 'varchar', '20', '', '', 'not null'); - table_column('user_teachers', '', 'enrol', 'varchar', '20', '', '', 'not null'); - execute_sql("ALTER TABLE `{$CFG->prefix}user_students` ADD INDEX enrol (enrol);"); - execute_sql("ALTER TABLE `{$CFG->prefix}user_teachers` ADD INDEX enrol (enrol);"); - } - - if ($oldversion < 2004112400) { - /// Delete duplicate enrolments - /// and then tell the database course,userid is a unique combination - if ($users = get_records_select("user_students", "userid > 0 GROUP BY course, userid ". - "HAVING count(*) > 1", "", "max(id) as id, userid, course ,count(*)")) { - foreach ($users as $user) { - delete_records_select("user_students", "userid = '$user->userid' ". - "AND course = '$user->course' AND id <> '$user->id'"); - } - } - flush(); - - modify_database('','ALTER TABLE prefix_user_students DROP INDEX courseuserid;'); - modify_database('','ALTER TABLE prefix_user_students ADD UNIQUE INDEX courseuserid(course,userid);'); - - /// Delete duplicate teacher enrolments - /// and then tell the database course,userid is a unique combination - if ($users = get_records_select("user_teachers", "userid > 0 GROUP BY course, userid ". - "HAVING count(*) > 1", "", "max(id) as id, userid, course ,count(*)")) { - foreach ($users as $user) { - delete_records_select("user_teachers", "userid = '$user->userid' ". - "AND course = '$user->course' AND id <> '$user->id'"); - } - } - flush(); - modify_database('','ALTER TABLE prefix_user_teachers DROP INDEX courseuserid;'); - modify_database('','ALTER TABLE prefix_user_teachers ADD UNIQUE INDEX courseuserid(course,userid);'); - } - - if ($oldversion < 2004112900) { - table_column('user', '', 'policyagreed', 'integer', '1', 'unsigned', '0', 'not null', 'confirmed'); - } - - if ($oldversion < 2004121400) { - table_column('groups', '', 'password', 'varchar', '50', '', '', 'not null', 'description'); - } - - if ($oldversion < 2004121500) { - modify_database('',"CREATE TABLE prefix_dst_preset ( - id int(10) NOT NULL auto_increment, - name char(48) default '' NOT NULL, - - apply_offset tinyint(3) default '0' NOT NULL, - - activate_index tinyint(1) default '1' NOT NULL, - activate_day tinyint(1) default '1' NOT NULL, - activate_month tinyint(2) default '1' NOT NULL, - activate_time char(5) default '03:00' NOT NULL, - - deactivate_index tinyint(1) default '1' NOT NULL, - deactivate_day tinyint(1) default '1' NOT NULL, - deactivate_month tinyint(2) default '2' NOT NULL, - deactivate_time char(5) default '03:00' NOT NULL, - - last_change int(10) default '0' NOT NULL, - next_change int(10) default '0' NOT NULL, - current_offset tinyint(3) default '0' NOT NULL, - - PRIMARY KEY (id))"); - } - - if ($oldversion < 2004122800) { - execute_sql("DROP TABLE {$CFG->prefix}message", false); - execute_sql("DROP TABLE {$CFG->prefix}message_read", false); - execute_sql("DROP TABLE {$CFG->prefix}message_contacts", false); - - modify_database('',"CREATE TABLE `prefix_message` ( - `id` int(10) unsigned NOT NULL auto_increment, - `useridfrom` int(10) NOT NULL default '0', - `useridto` int(10) NOT NULL default '0', - `message` text NOT NULL, - `timecreated` int(10) NOT NULL default '0', - `messagetype` varchar(50) NOT NULL default '', - PRIMARY KEY (`id`), - KEY `useridfrom` (`useridfrom`), - KEY `useridto` (`useridto`) - ) TYPE=MyISAM COMMENT='Stores all unread messages';"); - - modify_database('',"CREATE TABLE `prefix_message_read` ( - `id` int(10) unsigned NOT NULL auto_increment, - `useridfrom` int(10) NOT NULL default '0', - `useridto` int(10) NOT NULL default '0', - `message` text NOT NULL, - `timecreated` int(10) NOT NULL default '0', - `timeread` int(10) NOT NULL default '0', - `messagetype` varchar(50) NOT NULL default '', - `mailed` tinyint(1) NOT NULL default '0', - PRIMARY KEY (`id`), - KEY `useridfrom` (`useridfrom`), - KEY `useridto` (`useridto`) - ) TYPE=MyISAM COMMENT='Stores all messages that have been read';"); - - modify_database('',"CREATE TABLE `prefix_message_contacts` ( - `id` int(10) unsigned NOT NULL auto_increment, - `userid` int(10) unsigned NOT NULL default '0', - `contactid` int(10) unsigned NOT NULL default '0', - `blocked` tinyint(1) unsigned NOT NULL default '0', - PRIMARY KEY (`id`), - UNIQUE KEY `usercontact` (`userid`,`contactid`) - ) TYPE=MyISAM COMMENT='Maintains lists of relationships between users';"); - - modify_database('', "INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('message', 'write', 'user', 'CONCAT(firstname,\" \",lastname)'); "); - modify_database('', "INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('message', 'read', 'user', 'CONCAT(firstname,\" \",lastname)'); "); - } - - if ($oldversion < 2004122801) { - table_column('message', '', 'format', 'integer', '4', 'unsigned', '0', 'not null', 'message'); - table_column('message_read', '', 'format', 'integer', '4', 'unsigned', '0', 'not null', 'message'); - } - - if ($oldversion < 2005010100) { - modify_database('', "INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('message', 'add contact', 'user', 'CONCAT(firstname,\" \",lastname)'); "); - modify_database('', "INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('message', 'remove contact', 'user', 'CONCAT(firstname,\" \",lastname)'); "); - modify_database('', "INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('message', 'block contact', 'user', 'CONCAT(firstname,\" \",lastname)'); "); - modify_database('', "INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('message', 'unblock contact', 'user', 'CONCAT(firstname,\" \",lastname)'); "); - } - - if ($oldversion < 2005011000) { // Create a .htaccess file in dataroot, just in case - if (!file_exists($CFG->dataroot.'/.htaccess')) { - if ($handle = fopen($CFG->dataroot.'/.htaccess', 'w')) { // For safety - @fwrite($handle, "deny from all\r\nAllowOverride None\r\n"); - @fclose($handle); - notify("Created a default .htaccess file in $CFG->dataroot"); - } - } - } - - - if ($oldversion < 2005012500) { - /* - // add new table for meta courses. - modify_database("","CREATE TABLE `prefix_meta_course` ( - `id` int(1) unsigned NOT NULL auto_increment, - `parent_course` int(10) NOT NULL default 0, - `child_course` int(10) NOT NULL default 0, - PRIMARY KEY (`id`), - KEY `parent_course` (parent_course), - KEY `child_course` (child_course) - );"); - // add flag to course field - table_column('course','','meta_course','integer','1','','0','not null'); - */ // taking this OUT for upgrade from 1.4 to 1.5 (those tracking head will have already seen it) - } - - if ($oldversion < 2005012501) { - execute_sql("DROP TABLE {$CFG->prefix}meta_course",false); // drop silently - execute_sql("ALTER TABLE {$CFG->prefix}course DROP COLUMN meta_course",false); // drop silently - - // add new table for meta courses. - modify_database("","CREATE TABLE `prefix_course_meta` ( - `id` int(10) unsigned NOT NULL auto_increment, - `parent_course` int(10) NOT NULL default 0, - `child_course` int(10) NOT NULL default 0, - PRIMARY KEY (`id`), - KEY `parent_course` (parent_course), - KEY `child_course` (child_course) - );"); - // add flag to course field - table_column('course','','metacourse','integer','1','','0','not null'); - } - - if ($oldversion < 2005012800) { - // fix a typo (int 1 becomes int 10) - table_column('course_meta','id','id','integer','10','','0','not null'); - } - - if ($oldversion < 2005020100) { - fix_course_sortorder(0, 1, 1); - } - - - if ($oldversion < 2005020101) { - // hopefully this is the LAST TIME we need to do this ;) - if ($rows = count_records("course_meta")) { - // we need to upgrade - modify_database("","CREATE TABLE `prefix_course_meta_tmp` ( - `parent_course` int(10) NOT NULL default 0, - `child_course` int(10) NOT NULL default 0);"); - - execute_sql("INSERT INTO {$CFG->prefix}course_meta_tmp (parent_course,child_course) - SELECT {$CFG->prefix}course_meta.parent_course, {$CFG->prefix}course_meta.child_course - FROM {$CFG->prefix}course_meta"); - $insertafter = true; - } - - execute_sql("DROP TABLE {$CFG->prefix}course_meta"); - - modify_database("","CREATE TABLE `prefix_course_meta` ( - `id` int(10) unsigned NOT NULL auto_increment, - `parent_course` int(10) unsigned NOT NULL default 0, - `child_course` int(10) unsigned NOT NULL default 0, - PRIMARY KEY (`id`), - KEY `parent_course` (parent_course), - KEY `child_course` (child_course));"); - - if (!empty($insertafter)) { - execute_sql("INSERT INTO {$CFG->prefix}course_meta (parent_course,child_course) - SELECT {$CFG->prefix}course_meta_tmp.parent_course, {$CFG->prefix}course_meta_tmp.child_course - FROM {$CFG->prefix}course_meta_tmp"); - - execute_sql("DROP TABLE {$CFG->prefix}course_meta_tmp"); - } - } - - if ($oldversion < 2005020800) { // Expand module column to max 20 chars - table_column('log','module','module','varchar','20','','','not null'); - } - - if ($oldversion < 2005021000) { // New fields for theme choices - table_column('course', '', 'theme', 'varchar', '50', '', '', '', 'lang'); - table_column('groups', '', 'theme', 'varchar', '50', '', '', '', 'lang'); - table_column('user', '', 'theme', 'varchar', '50', '', '', '', 'lang'); - - set_config('theme', 'standardwhite'); // Reset to a known good theme - } - - if ($oldversion < 2005021600) { // course.idnumber should be varchar(100) - table_column('course', 'idnumber', 'idnumber', 'varchar', '100', '', '', '', ''); - } - - if ($oldversion < 2005021700) { - table_column('user', '', 'dstpreset', 'int', '10', '', '0', 'not null', 'timezone'); - } - - if ($oldversion < 2005021800) { // For database debugging, not for normal use - modify_database(""," CREATE TABLE `adodb_logsql` ( - `created` datetime NOT NULL, - `sql0` varchar(250) NOT NULL, - `sql1` text NOT NULL, - `params` text NOT NULL, - `tracer` text NOT NULL, - `timer` decimal(16,6) NOT NULL - );"); - } - - if ($oldversion < 2005022400) { - // Add more visible digits to the fields - table_column('dst_preset', 'activate_index', 'activate_index', 'tinyint', '2', '', '0', 'not null'); - table_column('dst_preset', 'activate_day', 'activate_day', 'tinyint', '2', '', '0', 'not null'); - // Add family and year fields - table_column('dst_preset', '', 'family', 'varchar', '100', '', '', 'not null', 'name'); - table_column('dst_preset', '', 'year', 'int', '10', '', '0', 'not null', 'family'); - } - - if ($oldversion < 2005030501) { - table_column('user', '', 'msn', 'varchar', '50', '', '', '', 'icq'); - table_column('user', '', 'aim', 'varchar', '50', '', '', '', 'icq'); - table_column('user', '', 'yahoo', 'varchar', '50', '', '', '', 'icq'); - table_column('user', '', 'skype', 'varchar', '50', '', '', '', 'icq'); - } - - if ($oldversion < 2005032300) { - table_column('user', 'dstpreset', 'timezonename', 'varchar', '100'); - execute_sql('UPDATE `'.$CFG->prefix.'user` SET timezonename = \'\''); - } - - if ($oldversion < 2005032600) { - execute_sql('DROP TABLE '.$CFG->prefix.'dst_preset', false); - modify_database('',"CREATE TABLE `prefix_timezone` ( - `id` int(10) NOT NULL auto_increment, - `name` varchar(100) NOT NULL default '', - `year` int(11) NOT NULL default '0', - `rule` varchar(20) NOT NULL default '', - `gmtoff` int(11) NOT NULL default '0', - `dstoff` int(11) NOT NULL default '0', - `dst_month` tinyint(2) NOT NULL default '0', - `dst_startday` tinyint(3) NOT NULL default '0', - `dst_weekday` tinyint(3) NOT NULL default '0', - `dst_skipweeks` tinyint(3) NOT NULL default '0', - `dst_time` varchar(5) NOT NULL default '00:00', - `std_month` tinyint(2) NOT NULL default '0', - `std_startday` tinyint(3) NOT NULL default '0', - `std_weekday` tinyint(3) NOT NULL default '0', - `std_skipweeks` tinyint(3) NOT NULL default '0', - `std_time` varchar(5) NOT NULL default '00:00', - PRIMARY KEY (`id`) - ) TYPE=MyISAM COMMENT='Rules for calculating local wall clock time for users';"); - } - - if ($oldversion < 2005032800) { - execute_sql("CREATE TABLE `{$CFG->prefix}grade_category` ( - `id` int(10) unsigned NOT NULL auto_increment, - `name` varchar(64) NOT NULL default '', - `courseid` int(10) unsigned NOT NULL default '0', - `drop_x_lowest` int(10) unsigned NOT NULL default '0', - `bonus_points` int(10) unsigned NOT NULL default '0', - `hidden` int(10) unsigned NOT NULL default '0', - `weight` decimal(4,2) NOT NULL default '0.00', - PRIMARY KEY (`id`), - KEY `courseid` (`courseid`) - ) TYPE=MyISAM ;"); - - execute_sql("CREATE TABLE `{$CFG->prefix}grade_exceptions` ( - `id` int(10) unsigned NOT NULL auto_increment, - `courseid` int(10) unsigned NOT NULL default '0', - `grade_itemid` int(10) unsigned NOT NULL default '0', - `userid` int(10) unsigned NOT NULL default '0', - PRIMARY KEY (`id`), - KEY `courseid` (`courseid`) - ) TYPE=MyISAM ;"); - - - execute_sql("CREATE TABLE `{$CFG->prefix}grade_item` ( - `id` int(10) unsigned NOT NULL auto_increment, - `courseid` int(10) unsigned NOT NULL default '0', - `category` int(10) unsigned NOT NULL default '0', - `modid` int(10) unsigned NOT NULL default '0', - `cminstance` int(10) unsigned NOT NULL default '0', - `scale_grade` float(11,10) default '1.0000000000', - `extra_credit` int(10) unsigned NOT NULL default '0', - `sort_order` int(10) unsigned NOT NULL default '0', - PRIMARY KEY (`id`), - KEY `courseid` (`courseid`) - ) TYPE=MyISAM ;"); - - - execute_sql("CREATE TABLE `{$CFG->prefix}grade_letter` ( - `id` int(10) unsigned NOT NULL auto_increment, - `courseid` int(10) unsigned NOT NULL default '0', - `letter` varchar(8) NOT NULL default 'NA', - `grade_high` decimal(4,2) NOT NULL default '100.00', - `grade_low` decimal(4,2) NOT NULL default '0.00', - PRIMARY KEY (`id`), - KEY `courseid` (`courseid`) - ) TYPE=MyISAM ;"); - - - execute_sql("CREATE TABLE `{$CFG->prefix}grade_preferences` ( - `id` int(10) unsigned NOT NULL auto_increment, - `courseid` int(10) unsigned NOT NULL default '0', - `preference` int(10) NOT NULL default '0', - `value` int(10) NOT NULL default '0', - PRIMARY KEY (`id`), - UNIQUE KEY `courseidpreference` (`courseid`,`preference`) - ) TYPE=MyISAM ;"); - - } - - if ($oldversion < 2005033100) { // Get rid of defunct field from course modules table - delete_records('course_modules', 'deleted', 1); // Delete old records we don't need any more - execute_sql('ALTER TABLE `'.$CFG->prefix.'course_modules` DROP INDEX `deleted`'); // Old index - execute_sql('ALTER TABLE `'.$CFG->prefix.'course_modules` DROP `deleted`'); // Old field - } - - if ($oldversion < 2005040800) { - table_column('user', 'timezone', 'timezone', 'varchar', '100', '', '99'); - execute_sql(" ALTER TABLE `{$CFG->prefix}user` DROP `timezonename` "); - } - - if ($oldversion < 2005041101) { - require_once($CFG->libdir.'/filelib.php'); - if (is_readable($CFG->dirroot.'/lib/timezones.txt')) { // Distribution file - if ($timezones = get_records_csv($CFG->dirroot.'/lib/timezones.txt', 'timezone')) { - $db->debug = false; - update_timezone_records($timezones); - notify(count($timezones).' timezones installed'); - $db->debug = true; - } - } - } - - if ($oldversion < 2005041900) { // Copy all Dialogue entries into Messages, and hide Dialogue module - - if ($entries = get_records_sql('SELECT e.id, e.userid, c.recipientid, e.text, e.timecreated - FROM '.$CFG->prefix.'dialogue_conversations c, - '.$CFG->prefix.'dialogue_entries e - WHERE e.conversationid = c.id')) { - foreach ($entries as $entry) { - $message = new object; - $message->useridfrom = $entry->userid; - $message->useridto = $entry->recipientid; - $message->message = addslashes($entry->text); - $message->format = FORMAT_HTML; - $message->timecreated = $entry->timecreated; - $message->messagetype = 'direct'; - - insert_record('message_read', $message); - } - } - - set_field('modules', 'visible', 0, 'name', 'dialogue'); - - notify('The Dialogue module has been disabled, and all the old Messages from it copied into the new standard Message feature. If you really want Dialogue back, you can enable it using the "eye" icon here: Admin >> Modules >> Dialogue'); - - } - - if ($oldversion < 2005042100) { - $result = table_column('event', '', 'repeatid', 'int', '10', 'unsigned', '0', 'not null', 'userid') && $result; - } - - if ($oldversion < 2005042400) { // Add user tracking prefs field. - table_column('user', '', 'trackforums', 'int', '4', 'unsigned', '0', 'not null', 'autosubscribe'); - } - - if ($oldversion < 2005053000 ) { // Add config_plugins table - - // this table was created on the MOODLE_15_STABLE branch - // so it may already exist. - $result = execute_sql("CREATE TABLE IF NOT EXISTS `{$CFG->prefix}config_plugins` ( - `id` int(10) unsigned NOT NULL auto_increment, - `plugin` varchar(100) NOT NULL default 'core', - `name` varchar(100) NOT NULL default '', - `value` text NOT NULL default '', - PRIMARY KEY (`id`), - UNIQUE KEY `plugin_name` (`plugin`, `name`) - ) TYPE=MyISAM - COMMENT='Moodle modules and plugins configuration variables';"); - } - - if ($oldversion < 2005060200) { // migrate some config items to config_plugins table - - // NOTE: this block is in both postgres AND mysql upgrade - // files. If you edit either, update the otherone. - $user_fields = array("firstname", "lastname", "email", - "phone1", "phone2", "department", - "address", "city", "country", - "description", "idnumber", "lang"); - if (!empty($CFG->auth)) { // if we have no auth, just pass - foreach ($user_fields as $field) { - $suffixes = array('', '_editlock', '_updateremote', '_updatelocal'); - foreach ($suffixes as $suffix) { - $key = 'auth_user_' . $field . $suffix; - if (isset($CFG->$key)) { - - // translate keys & values - // to the new convention - // this should support upgrading - // even 1.5dev installs - $newkey = $key; - $newval = $CFG->$key; - if ($suffix === '') { - $newkey = 'field_map_' . $field; - } elseif ($suffix === '_editlock') { - $newkey = 'field_lock_' . $field; - $newval = ($newval==1) ? 'locked' : 'unlocked'; // translate 0/1 to locked/unlocked - } elseif ($suffix === '_updateremote') { - $newkey = 'field_updateremote_' . $field; - } elseif ($suffix === '_updatelocal') { - $newkey = 'field_updatelocal_' . $field; - $newval = ($newval==1) ? 'onlogin' : 'oncreate'; // translate 0/1 to locked/unlocked - } - - if (!(set_config($newkey, addslashes($newval), 'auth/'.$CFG->auth) - && delete_records('config', 'name', $key))) { - notify("Error updating Auth configuration $key to {$CFG->auth} $newkey ."); - $result = false; - } - } // end if isset key - } // end foreach suffix - } // end foreach field - } - } - - if ($oldversion < 2005060201) { // Close down the Attendance module, we are removing it from CVS. - if (!file_exists($CFG->dirroot.'/mod/attendance/lib.php')) { - if (count_records('attendance')) { // We have some data, so should keep it - - set_field('modules', 'visible', 0, 'name', 'attendance'); - notify('The Attendance module has been discontinued. If you really want to - continue using it, you should download it individually from - http://download.moodle.org/modules and install it, then - reactivate it from Admin >> Configuration >> Modules. - None of your existing data has been deleted, so all existing - Attendance activities should re-appear.'); - - } else { // No data, so do a complete delete - - execute_sql('DROP TABLE '.$CFG->prefix.'attendance', false); - delete_records('modules', 'name', 'attendance'); - notify("The Attendance module has been discontinued and removed from your site. - You weren't using it anyway. ;-)"); - } - } - } - - if ($oldversion < 2005071700) { // Close down the Dialogue module, we are removing it from CVS. - if (!file_exists($CFG->dirroot.'/mod/dialogue/lib.php')) { - if (count_records('dialogue')) { // We have some data, so should keep it - - set_field('modules', 'visible', 0, 'name', 'dialogue'); - notify('The Dialogue module has been discontinued. If you really want to - continue using it, you should download it individually from - http://download.moodle.org/modules and install it, then - reactivate it from Admin >> Configuration >> Modules. - None of your existing data has been deleted, so all existing - Dialogue activities should re-appear.'); - - } else { // No data, so do a complete delete - - execute_sql('DROP TABLE '.$CFG->prefix.'dialogue', false); - delete_records('modules', 'name', 'dialogue'); - notify("The Dialogue module has been discontinued and removed from your site. - You weren't using it anyway. ;-)"); - } - } - } - - if ($oldversion < 2005072000) { // Add a couple fields to mdl_event to work towards iCal import/export - table_column('event', '', 'uuid', 'char', '36', '', '', 'not null', 'visible'); - table_column('event', '', 'sequence', 'integer', '10', 'unsigned', '1', 'not null', 'uuid'); - } - - if ($oldversion < 2005072100) { // run the online assignment cleanup code - include($CFG->dirroot.'/'.$CFG->admin.'/oacleanup.php'); - if (function_exists('online_assignment_cleanup')) { - online_assignment_cleanup(); - } - } - - if ($oldversion < 2005072200) { // fix the mistakenly-added currency stuff from enrol/authorize - execute_sql("DROP TABLE {$CFG->prefix}currencies", false); // drop silently - execute_sql("ALTER TABLE {$CFG->prefix}course DROP currency", false); - $defaultcurrency = empty($CFG->enrol_currency) ? 'USD' : $CFG->enrol_currency; - table_column('course', '', 'currency', 'char', '3', '', $defaultcurrency, 'not null', 'cost'); - } - - if ($oldversion < 2005081600) { //set up the course requests table - modify_database('',"CREATE TABLE `prefix_course_request` ( - `id` int(10) unsigned NOT NULL auto_increment, - `fullname` varchar(254) NOT NULL default '', - `shortname` varchar(15) NOT NULL default '', - `summary` text NOT NULL, - `reason` text NOT NULL, - `requester` int(10) NOT NULL default 0, - PRIMARY KEY (`id`), - KEY `shortname` (`shortname`) - ) TYPE=MyISAM;"); - - table_column('course','','requested'); - } - - if ($oldversion < 2005081601) { - modify_database('',"CREATE TABLE `prefix_course_allowed_modules` ( - `id` int(10) unsigned NOT NULL auto_increment, - `course` int(10) unsigned NOT NULL default 0, - `module` int(10) unsigned NOT NULL default 0, - PRIMARY KEY (`id`), - KEY `course` (`course`), - KEY `module` (`module`) - ) TYPE=MyISAM;"); - - table_column('course','','restrictmodules','int','1','','0','not null'); - } - - if ($oldversion < 2005081700) { - table_column('course_categories','','depth','integer'); - table_column('course_categories','','path','varchar','255'); - } - - if ($oldversion < 2005090100) { - modify_database("","CREATE TABLE `prefix_stats_daily` ( - `id` int(10) unsigned NOT NULL auto_increment, - `courseid` int(10) unsigned NOT NULL default 0, - `timeend` int(10) unsigned NOT NULL default 0, - `students` int(10) unsigned NOT NULL default 0, - `teachers` int(10) unsigned NOT NULL default 0, - `activestudents` int(10) unsigned NOT NULL default 0, - `activeteachers` int(10) unsigned NOT NULL default 0, - `studentreads` int(10) unsigned NOT NULL default 0, - `studentwrites` int(10) unsigned NOT NULL default 0, - `teacherreads` int(10) unsigned NOT NULL default 0, - `teacherwrites` int(10) unsigned NOT NULL default 0, - `logins` int(10) unsigned NOT NULL default 0, - `uniquelogins` int(10) unsigned NOT NULL default 0, - PRIMARY KEY (`id`), - KEY `courseid` (`courseid`), - KEY `timeend` (`timeend`) - );"); - - modify_database("","CREATE TABLE prefix_stats_weekly ( - `id` int(10) unsigned NOT NULL auto_increment, - `courseid` int(10) unsigned NOT NULL default 0, - `timeend` int(10) unsigned NOT NULL default 0, - `students` int(10) unsigned NOT NULL default 0, - `teachers` int(10) unsigned NOT NULL default 0, - `activestudents` int(10) unsigned NOT NULL default 0, - `activeteachers` int(10) unsigned NOT NULL default 0, - `studentreads` int(10) unsigned NOT NULL default 0, - `studentwrites` int(10) unsigned NOT NULL default 0, - `teacherreads` int(10) unsigned NOT NULL default 0, - `teacherwrites` int(10) unsigned NOT NULL default 0, - `logins` int(10) unsigned NOT NULL default 0, - `uniquelogins` int(10) unsigned NOT NULL default 0, - PRIMARY KEY (`id`), - KEY `courseid` (`courseid`), - KEY `timeend` (`timeend`) - );"); - - modify_database("","CREATE TABLE prefix_stats_monthly ( - `id` int(10) unsigned NOT NULL auto_increment, - `courseid` int(10) unsigned NOT NULL default 0, - `timeend` int(10) unsigned NOT NULL default 0, - `students` int(10) unsigned NOT NULL default 0, - `teachers` int(10) unsigned NOT NULL default 0, - `activestudents` int(10) unsigned NOT NULL default 0, - `activeteachers` int(10) unsigned NOT NULL default 0, - `studentreads` int(10) unsigned NOT NULL default 0, - `studentwrites` int(10) unsigned NOT NULL default 0, - `teacherreads` int(10) unsigned NOT NULL default 0, - `teacherwrites` int(10) unsigned NOT NULL default 0, - `logins` int(10) unsigned NOT NULL default 0, - `uniquelogins` int(10) unsigned NOT NULL default 0, - PRIMARY KEY (`id`), - KEY `courseid` (`courseid`), - KEY `timeend` (`timeend`) - );"); - - modify_database("","CREATE TABLE prefix_stats_user_daily ( - `id` int(10) unsigned NOT NULL auto_increment, - `courseid` int(10) unsigned NOT NULL default 0, - `userid` int(10) unsigned NOT NULL default 0, - `roleid` int(10) unsigned NOT NULL default 0, - `timeend` int(10) unsigned NOT NULL default 0, - `statsreads` int(10) unsigned NOT NULL default 0, - `statswrites` int(10) unsigned NOT NULL default 0, - `stattype` varchar(30) NOT NULL default '', - PRIMARY KEY (`id`), - KEY `courseid` (`courseid`), - KEY `userid` (`userid`), - KEY `roleid` (`roleid`), - KEY `timeend` (`timeend`) - );"); - - modify_database("","CREATE TABLE prefix_stats_user_weekly ( - `id` int(10) unsigned NOT NULL auto_increment, - `courseid` int(10) unsigned NOT NULL default 0, - `userid` int(10) unsigned NOT NULL default 0, - `roleid` int(10) unsigned NOT NULL default 0, - `timeend` int(10) unsigned NOT NULL default 0, - `statsreads` int(10) unsigned NOT NULL default 0, - `statswrites` int(10) unsigned NOT NULL default 0, - `stattype` varchar(30) NOT NULL default '', - PRIMARY KEY (`id`), - KEY `courseid` (`courseid`), - KEY `userid` (`userid`), - KEY `roleid` (`roleid`), - KEY `timeend` (`timeend`) - );"); - - modify_database("","CREATE TABLE prefix_stats_user_monthly ( - `id` int(10) unsigned NOT NULL auto_increment, - `courseid` int(10) unsigned NOT NULL default 0, - `userid` int(10) unsigned NOT NULL default 0, - `roleid` int(10) unsigned NOT NULL default 0, - `timeend` int(10) unsigned NOT NULL default 0, - `statsreads` int(10) unsigned NOT NULL default 0, - `statswrites` int(10) unsigned NOT NULL default 0, - `stattype` varchar(30) NOT NULL default '', - PRIMARY KEY (`id`), - KEY `courseid` (`courseid`), - KEY `userid` (`userid`), - KEY `roleid` (`roleid`), - KEY `timeend` (`timeend`) - );"); - - } - - if ($oldversion < 2005100300) { - table_column('course','','expirynotify','tinyint','1'); - table_column('course','','expirythreshold','int','10'); - table_column('course','','notifystudents','tinyint','1'); - $new = new stdClass(); - $new->name = 'lastexpirynotify'; - $new->value = 0; - insert_record('config', $new); - } - - if ($oldversion < 2005100400) { - table_column('course','','enrollable','tinyint','1','unsigned','1'); - table_column('course','','enrolstartdate','int'); - table_column('course','','enrolenddate','int'); - } - - if ($oldversion < 2005101200) { // add enrolment key to course_request. - table_column('course_request','','password','varchar',50); - } - - if ($oldversion < 2006030800) { # add extra indexes to log (see bug #4112) - modify_database('',"ALTER TABLE prefix_log ADD INDEX userid (userid);"); - modify_database('',"ALTER TABLE prefix_log ADD INDEX info (info);"); - } - - if ($oldversion < 2006030900) { - table_column('course','','enrol','varchar','20','',''); - - if ($CFG->enrol == 'internal' || $CFG->enrol == 'manual') { - set_config('enrol_plugins_enabled', 'manual'); - set_config('enrol', 'manual'); - } else { - set_config('enrol_plugins_enabled', 'manual,'.$CFG->enrol); - } - - require_once("$CFG->dirroot/enrol/enrol.class.php"); - $defaultenrol = enrolment_factory::factory($CFG->enrol); - if (!method_exists($defaultenrol, 'print_entry')) { // switch enrollable to off for all courses in this case - modify_database('', 'UPDATE prefix_course SET enrollable = 0'); - } - - execute_sql("UPDATE {$CFG->prefix}user_students SET enrol='manual' WHERE enrol='' OR enrol='internal'"); - execute_sql("UPDATE {$CFG->prefix}user_teachers SET enrol='manual' WHERE enrol=''"); - - } - - if ($oldversion < 2006031000) { - - modify_database("","CREATE TABLE prefix_post ( - `id` int(10) unsigned NOT NULL auto_increment, - `userid` int(10) unsigned NOT NULL default '0', - `courseid` int(10) unsigned NOT NULL default'0', - `groupid` int(10) unsigned NOT NULL default'0', - `moduleid` int(10) unsigned NOT NULL default'0', - `coursemoduleid` int(10) unsigned NOT NULL default'0', - `subject` varchar(128) NOT NULL default '', - `summary` longtext, - `content` longtext, - `uniquehash` varchar(128) NOT NULL default '', - `rating` int(10) unsigned NOT NULL default'0', - `format` int(10) unsigned NOT NULL default'0', - `publishstate` enum('draft','site','public') NOT NULL default 'draft', - `lastmodified` int(10) unsigned NOT NULL default '0', - `created` int(10) unsigned NOT NULL default '0', - PRIMARY KEY (`id`), - UNIQUE KEY `id_user_idx` (`id`, `userid`), - KEY `post_lastmodified_idx` (`lastmodified`), - KEY `post_subject_idx` (`subject`) - ) TYPE=MyISAM COMMENT='New moodle post table. Holds data posts such as forum entries or blog entries.';"); - - modify_database("","CREATE TABLE prefix_tags ( - `id` int(10) unsigned NOT NULL auto_increment, - `type` varchar(255) NOT NULL default 'official', - `userid` int(10) unsigned NOT NULL default'0', - `text` varchar(255) NOT NULL default '', - PRIMARY KEY (`id`) - ) TYPE=MyISAM COMMENT ='tags structure for moodle.';"); - - modify_database("","CREATE TABLE prefix_blog_tag_instance ( - `id` int(10) unsigned NOT NULL auto_increment, - `entryid` int(10) unsigned NOT NULL default'0', - `tagid` int(10) unsigned NOT NULL default'0', - `groupid` int(10) unsigned NOT NULL default'0', - `courseid` int(10) unsigned NOT NULL default'0', - `userid` int(10) unsigned NOT NULL default'0', - PRIMARY KEY (`id`) - ) TYPE=MyISAM COMMENT ='tag instance for blogs.';"); - } - - if ($oldversion < 2006031400) { - require_once("$CFG->dirroot/enrol/enrol.class.php"); - $defaultenrol = enrolment_factory::factory($CFG->enrol); - if (!method_exists($defaultenrol, 'print_entry')) { - set_config('enrol', 'manual'); - } - } - - if ($oldversion < 2006031600) { - execute_sql(" ALTER TABLE `{$CFG->prefix}grade_category` CHANGE `weight` `weight` decimal(5,2) default '0.00';"); - } - - if ($oldversion < 2006032000) { - table_column('post','','module','varchar','20','','','not null', 'id'); - modify_database('',"ALTER TABLE prefix_post ADD INDEX post_module_idx (module);"); - modify_database('',"UPDATE prefix_post SET module = 'blog';"); - } - - if ($oldversion < 2006032001) { - table_column('blog_tag_instance','','timemodified','integer','10','unsigned','0','not null', 'userid'); - modify_database('',"ALTER TABLE prefix_blog_tag_instance ADD INDEX bti_entryid_idx (entryid);"); - modify_database('',"ALTER TABLE prefix_blog_tag_instance ADD INDEX bti_tagid_idx (tagid);"); - modify_database('',"UPDATE prefix_blog_tag_instance SET timemodified = '".time()."';"); - } - - if ($oldversion < 2006040500) { // Add an index to course_sections that was never upgraded (bug 5100) - execute_sql(" CREATE INDEX coursesection ON {$CFG->prefix}course_sections (course,section) ", false); - } - - /// change all the int(11) to int(10) for blogs and tags - - if ($oldversion < 2006041000) { - table_column('post','id','id','integer','10','unsigned','0','not null'); - table_column('post','userid','userid','integer','10','unsigned','0','not null'); - table_column('post','courseid','courseid','integer','10','unsigned','0','not null'); - table_column('post','groupid','groupid','integer','10','unsigned','0','not null'); - table_column('post','moduleid','moduleid','integer','10','unsigned','0','not null'); - table_column('post','coursemoduleid','coursemoduleid','integer','10','unsigned','0','not null'); - table_column('post','rating','rating','integer','10','unsigned','0','not null'); - table_column('post','format','format','integer','10','unsigned','0','not null'); - table_column('tags','id','id','integer','10','unsigned','0','not null'); - table_column('tags','userid','userid','integer','10','unsigned','0','not null'); - table_column('blog_tag_instance','id','id','integer','10','unsigned','0','not null'); - table_column('blog_tag_instance','entryid','entryid','integer','10','unsigned','0','not null'); - table_column('blog_tag_instance','tagid','tagid','integer','10','unsigned','0','not null'); - table_column('blog_tag_instance','groupid','groupid','integer','10','unsigned','0','not null'); - table_column('blog_tag_instance','courseid','courseid','integer','10','unsigned','0','not null'); - table_column('blog_tag_instance','userid','userid','integer','10','unsigned','0','not null'); - } - - if ($oldversion < 2006041001) { - table_column('cache_text','formattedtext','formattedtext','longblob','','','','not null'); - } - - if ($oldversion < 2006041100) { - table_column('course_modules','','visibleold','integer','1','unsigned','1','not null', 'visible'); - } - - if ($oldversion < 2006041801) { // forgot auto_increments for ids - modify_database('',"ALTER TABLE prefix_post CHANGE id id INT UNSIGNED NOT NULL AUTO_INCREMENT"); - modify_database('',"ALTER TABLE prefix_tags CHANGE id id INT UNSIGNED NOT NULL AUTO_INCREMENT"); - modify_database('',"ALTER TABLE prefix_blog_tag_instance CHANGE id id INT UNSIGNED NOT NULL AUTO_INCREMENT"); - } - - // changed user->firstname, user->lastname, course->shortname to varchar(100) - - if ($oldversion < 2006041900) { - table_column('course','shortname','shortname','varchar','100','','','not null'); - table_column('user','firstname','firstname','varchar','100','','','not null'); - table_column('user','lastname','lastname','varchar','100','','','not null'); - } - - if ($oldversion < 2006042400) { - // Look through table log_display and get rid of duplicates. - $rs = get_recordset_sql('SELECT DISTINCT * FROM '.$CFG->prefix.'log_display'); - - // Drop the log_display table and create it back with an id field. - execute_sql("DROP TABLE {$CFG->prefix}log_display", false); - - modify_database('', "CREATE TABLE prefix_log_display ( - `id` int(10) unsigned NOT NULL auto_increment, - `module` varchar(30), - `action` varchar(40), - `mtable` varchar(30), - `field` varchar(50), - PRIMARY KEY (`id`) - ) TYPE=MyISAM"); - - // Add index to ensure that module and action combination is unique. - modify_database('', "ALTER TABLE prefix_log_display ADD UNIQUE `moduleaction`(`module` , `action`)"); - - // Insert the records back in, sans duplicates. - if ($rs) { - while (!$rs->EOF) { - $sql = "INSERT INTO {$CFG->prefix}log_display ". - "VALUES('', '".$rs->fields['module']."', ". - "'".$rs->fields['action']."', ". - "'".$rs->fields['mtable']."', ". - "'".$rs->fields['field']."')"; - - execute_sql($sql, false); - $rs->MoveNext(); - } - rs_close($rs); - } - } - - // change tags->type to varchar(20), adding 2 indexes for tags table. - if ($oldversion < 2006042401) { - table_column('tags','type','type','varchar','20','','','not null'); - modify_database('',"ALTER TABLE prefix_tags ADD INDEX tags_typeuserid_idx (type(20), userid)"); - modify_database('',"ALTER TABLE prefix_tags ADD INDEX tags_text_idx(text(255))"); - } - - /*************************************************** - * The following is an effort to change all the * - * default NULLs to NOT NULL defaut '' in all * - * mysql tables, to prevent 5303 and be consistent * - ***************************************************/ - - if ($oldversion < 2006042800) { - - execute_sql("UPDATE {$CFG->prefix}grade_category SET name='' WHERE name IS NULL"); - table_column('grade_category','name','name','varchar','64','','','not null'); - - execute_sql("UPDATE {$CFG->prefix}grade_category SET weight='0' WHERE weight IS NULL"); - execute_sql("ALTER TABLE {$CFG->prefix}grade_category change weight weight decimal(5,2) NOT NULL default 0.00"); - execute_sql("UPDATE {$CFG->prefix}grade_item SET courseid='0' WHERE courseid IS NULL"); - table_column('grade_item','courseid','courseid','int','10','unsigned','0','not null'); - - execute_sql("UPDATE {$CFG->prefix}grade_item SET category='0' WHERE category IS NULL"); - table_column('grade_item','category','category','int','10','unsigned','0','not null'); - - execute_sql("UPDATE {$CFG->prefix}grade_item SET modid='0' WHERE modid IS NULL"); - table_column('grade_item','modid','modid','int','10','unsigned','0','not null'); - - execute_sql("UPDATE {$CFG->prefix}grade_item SET cminstance='0' WHERE cminstance IS NULL"); - table_column('grade_item','cminstance','cminstance','int','10','unsigned','0','not null'); - - execute_sql("UPDATE {$CFG->prefix}grade_item SET scale_grade='0' WHERE scale_grade IS NULL"); - execute_sql("ALTER TABLE {$CFG->prefix}grade_item change scale_grade scale_grade float(11,10) NOT NULL default 1.0000000000"); - - execute_sql("UPDATE {$CFG->prefix}grade_preferences SET courseid='0' WHERE courseid IS NULL"); - table_column('grade_preferences','courseid','courseid','int','10','unsigned','0','not null'); - - execute_sql("UPDATE {$CFG->prefix}user SET idnumber='' WHERE idnumber IS NULL"); - table_column('user','idnumber','idnumber','varchar','64','','','not null'); - - execute_sql("UPDATE {$CFG->prefix}user SET icq='' WHERE icq IS NULL"); - table_column('user','icq','icq','varchar','15','','','not null'); - - execute_sql("UPDATE {$CFG->prefix}user SET skype='' WHERE skype IS NULL"); - table_column('user','skype','skype','varchar','50','','','not null'); - - execute_sql("UPDATE {$CFG->prefix}user SET yahoo='' WHERE yahoo IS NULL"); - table_column('user','yahoo','yahoo','varchar','50','','','not null'); - - execute_sql("UPDATE {$CFG->prefix}user SET aim='' WHERE aim IS NULL"); - table_column('user','aim','aim','varchar','50','','','not null'); - - execute_sql("UPDATE {$CFG->prefix}user SET msn='' WHERE msn IS NULL"); - table_column('user','msn','msn','varchar','50','','','not null'); - - execute_sql("UPDATE {$CFG->prefix}user SET phone1='' WHERE phone1 IS NULL"); - table_column('user','phone1','phone1','varchar','20','','','not null'); - - execute_sql("UPDATE {$CFG->prefix}user SET phone2='' WHERE phone2 IS NULL"); - table_column('user','phone2','phone2','varchar','20','','','not null'); - - execute_sql("UPDATE {$CFG->prefix}user SET institution='' WHERE institution IS NULL"); - table_column('user','institution','institution','varchar','40','','','not null'); - - execute_sql("UPDATE {$CFG->prefix}user SET department='' WHERE department IS NULL"); - table_column('user','department','department','varchar','30','','','not null'); - - execute_sql("UPDATE {$CFG->prefix}user SET address='' WHERE address IS NULL"); - table_column('user','address','address','varchar','70','','','not null'); - - execute_sql("UPDATE {$CFG->prefix}user SET city='' WHERE city IS NULL"); - table_column('user','city','city','varchar','20','','','not null'); - - execute_sql("UPDATE {$CFG->prefix}user SET country='' WHERE country IS NULL"); - table_column('user','country','country','char','2','','','not null'); - - execute_sql("UPDATE {$CFG->prefix}user SET lang='' WHERE lang IS NULL"); - table_column('user','lang','lang','varchar','10','','en','not null'); - - execute_sql("UPDATE {$CFG->prefix}user SET lastIP='' WHERE lastIP IS NULL"); - table_column('user','lastIP','lastIP','varchar','15','','','not null'); - - execute_sql("UPDATE {$CFG->prefix}user SET secret='' WHERE secret IS NULL"); - table_column('user','secret','secret','varchar','15','','','not null'); - - execute_sql("UPDATE {$CFG->prefix}user SET picture='0' WHERE picture IS NULL"); - table_column('user','picture','picture','tinyint','1','','0','not null'); - - execute_sql("UPDATE {$CFG->prefix}user SET url='' WHERE url IS NULL"); - table_column('user','url','url','varchar','255','','','not null'); - } - - if ($oldversion < 2006050400) { - - execute_sql("ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_deleted_idx;",false); - execute_sql("ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_confirmed_idx;",false); - execute_sql("ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_firstname_idx;",false); - execute_sql("ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_lastname_idx;",false); - execute_sql("ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_city_idx;",false); - execute_sql("ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_country_idx;",false); - execute_sql("ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_lastaccess_idx;",false); - execute_sql("ALTER TABLE `{$CFG->prefix}user` DROP INDEX {$CFG->prefix}user_email_idx;",false); - - execute_sql("ALTER TABLE `{$CFG->prefix}user` ADD INDEX user_deleted (deleted)",false); - execute_sql("ALTER TABLE `{$CFG->prefix}user` ADD INDEX user_confirmed (confirmed)",false); - execute_sql("ALTER TABLE `{$CFG->prefix}user` ADD INDEX user_firstname (firstname)",false); - execute_sql("ALTER TABLE `{$CFG->prefix}user` ADD INDEX user_lastname (lastname)",false); - execute_sql("ALTER TABLE `{$CFG->prefix}user` ADD INDEX user_city (city)",false); - execute_sql("ALTER TABLE `{$CFG->prefix}user` ADD INDEX user_country (country)",false); - execute_sql("ALTER TABLE `{$CFG->prefix}user` ADD INDEX user_lastaccess (lastaccess)",false); - execute_sql("ALTER TABLE `{$CFG->prefix}user` ADD INDEX user_email (email)",false); - } - - if ($oldversion < 2006050500) { - table_column('log', 'action', 'action', 'varchar', '40', '', '', 'not null'); - } - - if ($oldversion < 2006050501) { - table_column('sessions', 'data', 'data', 'mediumtext', '', '', '', 'not null'); - } - - // renaming of reads and writes for stats_user_xyz - if ($oldversion < 2006052400) { // change this later - - // we are using this because we want silent updates - - execute_sql("ALTER TABLE `{$CFG->prefix}stats_user_daily` CHANGE `reads` statsreads int(10) unsigned NOT NULL default 0", false); - execute_sql("ALTER TABLE `{$CFG->prefix}stats_user_daily` CHANGE `writes` statswrites int(10) unsigned NOT NULL default 0", false); - execute_sql("ALTER TABLE `{$CFG->prefix}stats_user_weekly` CHANGE `reads` statsreads int(10) unsigned NOT NULL default 0", false); - execute_sql("ALTER TABLE `{$CFG->prefix}stats_user_weekly` CHANGE `writes` statswrites int(10) unsigned NOT NULL default 0", false); - execute_sql("ALTER TABLE `{$CFG->prefix}stats_user_monthly` CHANGE `reads` statsreads int(10) unsigned NOT NULL default 0", false); - execute_sql("ALTER TABLE `{$CFG->prefix}stats_user_monthly` CHANGE `writes` statswrites int(10) unsigned NOT NULL default 0", false); - - } - - // Adding some missing log actions - if ($oldversion < 2006060400) { - // But only if they doesn't exist (because this was introduced after branch and we could be duplicating!) - if (!record_exists('log_display', 'module', 'course', 'action', 'report log')) { - execute_sql("INSERT INTO {$CFG->prefix}log_display (module, action, mtable, field) VALUES ('course', 'report log', 'course', 'fullname')"); - } - if (!record_exists('log_display', 'module', 'course', 'action', 'report live')) { - execute_sql("INSERT INTO {$CFG->prefix}log_display (module, action, mtable, field) VALUES ('course', 'report live', 'course', 'fullname')"); - } - if (!record_exists('log_display', 'module', 'course', 'action', 'report outline')) { - execute_sql("INSERT INTO {$CFG->prefix}log_display (module, action, mtable, field) VALUES ('course', 'report outline', 'course', 'fullname')"); - } - if (!record_exists('log_display', 'module', 'course', 'action', 'report participation')) { - execute_sql("INSERT INTO {$CFG->prefix}log_display (module, action, mtable, field) VALUES ('course', 'report participation', 'course', 'fullname')"); - } - if (!record_exists('log_display', 'module', 'course', 'action', 'report stats')) { - execute_sql("INSERT INTO {$CFG->prefix}log_display (module, action, mtable, field) VALUES ('course', 'report stats', 'course', 'fullname')"); - } - } - - //Renaming lastIP to lastip (all fields lowercase) - if ($oldversion < 2006060900) { - //Only if it exists - $fields = $db->MetaColumnNames($CFG->prefix.'user'); - if (in_array('lastIP',$fields)) { - table_column("user", "lastIP", "lastip", "varchar", "15", "", "", "not null", "currentlogin"); - } - } - - // Change in MySQL 5.0.3 concerning how decimals are stored. Mimic from 16_STABLE - // this isn't dangerous because it's a simple type change, but be careful with - // versions and duplicate work in order to provide smooth upgrade paths. - if ($oldversion < 2006071800) { - table_column('grade_letter', 'grade_high', 'grade_high', 'decimal(5,2)', '', '', '100.00', 'not null', ''); - table_column('grade_letter', 'grade_low', 'grade_low', 'decimal(5,2)', '', '', '0.00', 'not null', ''); - } - - if ($oldversion < 2006080400) { - execute_sql("CREATE TABLE {$CFG->prefix}role ( - `id` int(10) unsigned NOT NULL auto_increment, - `name` varchar(255) NOT NULL default '', - `shortname` varchar(100) NOT NULL default '', - `description` text NOT NULL default '', - `sortorder` int(10) unsigned NOT NULL default '0', - PRIMARY KEY (`id`) - )", true); - - execute_sql("CREATE TABLE {$CFG->prefix}context ( - `id` int(10) unsigned NOT NULL auto_increment, - `level` int(10) unsigned NOT NULL default '0', - `instanceid` int(10) unsigned NOT NULL default '0', - PRIMARY KEY (`id`) - )", true); - - execute_sql("CREATE TABLE {$CFG->prefix}role_assignments ( - `id` int(10) unsigned NOT NULL auto_increment, - `roleid` int(10) unsigned NOT NULL default '0', - `contextid` int(10) unsigned NOT NULL default '0', - `userid` int(10) unsigned NOT NULL default '0', - `hidden` int(1) unsigned NOT NULL default '0', - `timestart` int(10) unsigned NOT NULL default '0', - `timeend` int(10) unsigned NOT NULL default '0', - `timemodified` int(10) unsigned NOT NULL default '0', - `modifierid` int(10) unsigned NOT NULL default '0', - `enrol` varchar(20) NOT NULL default '', - `sortorder` int(10) unsigned NOT NULL default '0', - PRIMARY KEY (`id`) - )", true); - - execute_sql("CREATE TABLE {$CFG->prefix}role_capabilities ( - `id` int(10) unsigned NOT NULL auto_increment, - `contextid` int(10) unsigned NOT NULL default '0', - `roleid` int(10) unsigned NOT NULL default '0', - `capability` varchar(255) NOT NULL default '', - `permission` int(10) unsigned NOT NULL default '0', - `timemodified` int(10) unsigned NOT NULL default '0', - `modifierid` int(10) unsigned NOT NULL default '0', - PRIMARY KEY (`id`) - )", true); - - execute_sql("CREATE TABLE {$CFG->prefix}role_deny_grant ( - `id` int(10) unsigned NOT NULL auto_increment, - `roleid` int(10) unsigned NOT NULL default '0', - `unviewableroleid` int(10) unsigned NOT NULL default '0', - PRIMARY KEY (`id`) - )", true); - - execute_sql("CREATE TABLE {$CFG->prefix}capabilities ( - `id` int(10) unsigned NOT NULL auto_increment, - `name` varchar(255) NOT NULL default '', - `captype` varchar(50) NOT NULL default '', - `contextlevel` int(10) unsigned NOT NULL default '0', - `component` varchar(100) NOT NULL default '', - PRIMARY KEY (`id`) - )", true); - - execute_sql("CREATE TABLE {$CFG->prefix}role_names ( - `id` int(10) unsigned NOT NULL auto_increment, - `roleid` int(10) unsigned NOT NULL default '0', - `contextid` int(10) unsigned NOT NULL default '0', - `text` text NOT NULL default '', - PRIMARY KEY (`id`) - )", true); - - } - - if ($oldversion < 2006081000) { - - execute_sql("ALTER TABLE `{$CFG->prefix}role` ADD INDEX `sortorder` (`sortorder`)",true); - - execute_sql("ALTER TABLE `{$CFG->prefix}context` ADD INDEX `instanceid` (`instanceid`)",true); - execute_sql("ALTER TABLE `{$CFG->prefix}context` ADD UNIQUE INDEX `level-instanceid` (`level`, `instanceid`)",true); - - execute_sql("ALTER TABLE `{$CFG->prefix}role_assignments` ADD INDEX `roleid` (`roleid`)",true); - execute_sql("ALTER TABLE `{$CFG->prefix}role_assignments` ADD INDEX `contextid` (`contextid`)",true); - execute_sql("ALTER TABLE `{$CFG->prefix}role_assignments` ADD INDEX `userid` (`userid`)",true); - execute_sql("ALTER TABLE `{$CFG->prefix}role_assignments` ADD UNIQUE INDEX `contextid-roleid-userid` (`contextid`, `roleid`, `userid`)",true); - execute_sql("ALTER TABLE `{$CFG->prefix}role_assignments` ADD INDEX `sortorder` (`sortorder`)",true); - - execute_sql("ALTER TABLE `{$CFG->prefix}role_capabilities` ADD INDEX `roleid` (`roleid`)",true); - execute_sql("ALTER TABLE `{$CFG->prefix}role_capabilities` ADD INDEX `contextid` (`contextid`)",true); - execute_sql("ALTER TABLE `{$CFG->prefix}role_capabilities` ADD INDEX `modifierid` (`modifierid`)",true); - // MDL-10640 adding missing index from upgrade - execute_sql("ALTER TABLE `{$CFG->prefix}role_capabilities` ADD INDEX `capability` (`capability`)",true); - execute_sql("ALTER TABLE `{$CFG->prefix}role_capabilities` ADD UNIQUE INDEX `roleid-contextid-capability` (`roleid`, `contextid`, `capability`)",true); - - execute_sql("ALTER TABLE `{$CFG->prefix}role_deny_grant` ADD INDEX `roleid` (`roleid`)",true); - execute_sql("ALTER TABLE `{$CFG->prefix}role_deny_grant` ADD INDEX `unviewableroleid` (`unviewableroleid`)",true); - execute_sql("ALTER TABLE `{$CFG->prefix}role_deny_grant` ADD UNIQUE INDEX `roleid-unviewableroleid` (`roleid`, `unviewableroleid`)",true); - - execute_sql("ALTER TABLE `{$CFG->prefix}capabilities` ADD UNIQUE INDEX `name` (`name`)",true); - - execute_sql("ALTER TABLE `{$CFG->prefix}role_names` ADD INDEX `roleid` (`roleid`)",true); - execute_sql("ALTER TABLE `{$CFG->prefix}role_names` ADD INDEX `contextid` (`contextid`)",true); - execute_sql("ALTER TABLE `{$CFG->prefix}role_names` ADD UNIQUE INDEX `roleid-contextid` (`roleid`, `contextid`)",true); - } - - if ($oldversion < 2006081600) { - execute_sql("ALTER TABLE `{$CFG->prefix}role_capabilities` CHANGE permission permission int(10) NOT NULL default '0'",true); - } - - // drop role_deny_grant table, and create 2 new ones - if ($oldversion < 2006081700) { - execute_sql("DROP TABLE `{$CFG->prefix}role_deny_grant`", true); - - execute_sql("CREATE TABLE {$CFG->prefix}role_allow_assign ( - `id` int(10) unsigned NOT NULL auto_increment, - `roleid` int(10) unsigned NOT NULL default '0', - `allowassign` int(10) unsigned NOT NULL default '0', - KEY `roleid` (`roleid`), - KEY `allowassign` (`allowassign`), - UNIQUE KEY `roleid-allowassign` (`roleid`, `allowassign`), - PRIMARY KEY (`id`) - )", true); - - execute_sql("CREATE TABLE {$CFG->prefix}role_allow_override ( - `id` int(10) unsigned NOT NULL auto_increment, - `roleid` int(10) unsigned NOT NULL default '0', - `allowoverride` int(10) unsigned NOT NULL default '0', - KEY `roleid` (`roleid`), - KEY `allowoverride` (`allowoverride`), - UNIQUE KEY `roleid-allowoverride` (`roleid`, `allowoverride`), - PRIMARY KEY (`id`) - )", true); - - } - - if ($oldversion < 2006082100) { - execute_sql("ALTER TABLE `{$CFG->prefix}context` DROP INDEX `level-instanceid`;",false); - table_column('context', 'level', 'aggregatelevel', 'int', '10', 'unsigned', '0', 'not null', ''); - execute_sql("ALTER TABLE `{$CFG->prefix}context` ADD UNIQUE INDEX `aggregatelevel-instanceid` (`aggregatelevel`, `instanceid`)",false); - } - - if ($oldversion < 2006082200) { - table_column('timezone', 'rule', 'tzrule', 'varchar', '20', '', '', 'not null', ''); - } - - if ($oldversion < 2006082800) { - table_column('user', '', 'ajax', 'integer', '1', 'unsigned', '1', 'not null', 'htmleditor'); - } - - if ($oldversion < 2006082900) { - execute_sql("DROP TABLE {$CFG->prefix}sessions", true); - execute_sql(" - CREATE TABLE {$CFG->prefix}sessions2 ( - sesskey VARCHAR(64) NOT NULL default '', - expiry DATETIME NOT NULL, - expireref VARCHAR(250), - created DATETIME NOT NULL, - modified DATETIME NOT NULL, - sessdata TEXT, - CONSTRAINT PRIMARY KEY (sesskey) - ) COMMENT='Optional database session storage in new format, not used by default';", true); - - execute_sql(" - CREATE INDEX {$CFG->prefix}sess_exp_ix ON {$CFG->prefix}sessions2 (expiry);", true); - execute_sql(" - CREATE INDEX {$CFG->prefix}sess_exp2_ix ON {$CFG->prefix}sessions2 (expireref);", true); - } - - if ($oldversion < 2006083001) { - table_column('sessions2', 'sessdata', 'sessdata', 'LONGTEXT', '', '', '', '', ''); - } - - if ($oldversion < 2006083002) { - table_column('capabilities', '', 'riskbitmask', 'INTEGER', '10', 'unsigned', '0', 'not null', ''); - } - - if ($oldversion < 2006083100) { - execute_sql("ALTER TABLE {$CFG->prefix}course CHANGE modinfo modinfo longtext NULL AFTER showgrades"); - } - - if ($oldversion < 2006083101) { - execute_sql("ALTER TABLE {$CFG->prefix}course_categories CHANGE description description text NULL AFTER name"); - } - - if ($oldversion < 2006083102) { - execute_sql("ALTER TABLE {$CFG->prefix}user CHANGE description description text NULL AFTER url"); - } - - if ($oldversion < 2006090200) { - execute_sql("ALTER TABLE {$CFG->prefix}course_sections CHANGE summary summary text NULL AFTER section"); - execute_sql("ALTER TABLE {$CFG->prefix}course_sections CHANGE sequence sequence text NULL AFTER section"); - } - - - // table to keep track of course page access times, used in online participants block, and participants list - if ($oldversion < 2006091200) { - execute_sql("CREATE TABLE {$CFG->prefix}user_lastaccess ( - `id` int(10) unsigned NOT NULL auto_increment, - `userid` int(10) unsigned NOT NULL default '0', - `courseid` int(10) unsigned NOT NULL default '0', - `timeaccess` int(10) unsigned NOT NULL default '0', - KEY `userid` (`userid`), - KEY `courseid` (`courseid`), - UNIQUE KEY `userid-courseid` (`userid`, `courseid`), - PRIMARY KEY (`id`) - )TYPE=MYISAM COMMENT ='time user last accessed any page in a course';", true); - } - - if (!empty($CFG->rolesactive) and $oldversion < 2006091212) { // Reload the guest roles completely with new defaults - if ($guestroles = get_roles_with_capability('moodle/legacy:guest', CAP_ALLOW)) { - delete_records('capabilities'); - $sitecontext = get_context_instance(CONTEXT_SYSTEM); - foreach ($guestroles as $guestrole) { - delete_records('role_capabilities', 'roleid', $guestrole->id); - assign_capability('moodle/legacy:guest', CAP_ALLOW, $guestrole->id, $sitecontext->id); - } - } - } - - if ($oldversion < 2006091700) { - table_column('course','','defaultrole','integer','10', 'unsigned', '0', 'not null'); - } - - if ($oldversion < 2006091800) { - delete_records('config', 'name', 'showsiteparticipantslist'); - delete_records('config', 'name', 'requestedteachername'); - delete_records('config', 'name', 'requestedteachersname'); - delete_records('config', 'name', 'requestedstudentname'); - delete_records('config', 'name', 'requestedstudentsname'); - } - - if (!empty($CFG->rolesactive) and $oldversion < 2006091901) { - if ($roles = get_records('role')) { - $first = array_shift($roles); - if (!empty($first->shortname)) { - // shortnames already exist - } else { - table_column('role', '', 'shortname', 'varchar', '100', '', '', 'not null', 'name'); - $legacy_names = array('admin', 'coursecreator', 'editingteacher', 'teacher', 'student', 'guest'); - foreach ($legacy_names as $name) { - if ($roles = get_roles_with_capability('moodle/legacy:'.$name, CAP_ALLOW)) { - $i = ''; - foreach ($roles as $role) { - if (empty($role->shortname)) { - $updated = new object(); - $updated->id = $role->id; - $updated->shortname = $name.$i; - update_record('role', $updated); - $i++; - } - } - } - } - } - } - } - - /// Tables for customisable user profile fields - if ($oldversion < 2006092000) { - execute_sql("CREATE TABLE {$CFG->prefix}user_info_field ( - id BIGINT(10) NOT NULL auto_increment, - name VARCHAR(255) NOT NULL default '', - datatype VARCHAR(255) NOT NULL default '', - categoryid BIGINT(10) unsigned NOT NULL default 0, - sortorder BIGINT(10) unsigned NOT NULL default 0, - required TINYINT(2) unsigned NOT NULL default 0, - locked TINYINT(2) unsigned NOT NULL default 0, - visible SMALLINT(4) unsigned NOT NULL default 0, - defaultdata LONGTEXT, - CONSTRAINT PRIMARY KEY (id));", true); - - execute_sql("ALTER TABLE {$CFG->prefix}user_info_field COMMENT='Customisable user profile fields';", true); - - execute_sql("CREATE TABLE {$CFG->prefix}user_info_category ( - id BIGINT(10) NOT NULL auto_increment, - name VARCHAR(255) NOT NULL default '', - sortorder BIGINT(10) unsigned NOT NULL default 0, - CONSTRAINT PRIMARY KEY (id));", true); - - execute_sql("ALTER TABLE {$CFG->prefix}user_info_category COMMENT='Customisable fields categories';", true); - - execute_sql("CREATE TABLE {$CFG->prefix}user_info_data ( - id BIGINT(10) NOT NULL auto_increment, - userid BIGINT(10) unsigned NOT NULL default 0, - fieldid BIGINT(10) unsigned NOT NULL default 0, - data LONGTEXT NOT NULL, - CONSTRAINT PRIMARY KEY (id));", true); - - execute_sql("ALTER TABLE {$CFG->prefix}user_info_data COMMENT='Data for the customisable user fields';", true); - - - } - - if ($oldversion < 2006092200) { - table_column('context', 'aggregatelevel', 'contextlevel', 'int', '10', 'unsigned', '0', 'not null', ''); -/* execute_sql("ALTER TABLE `{$CFG->prefix}context` DROP INDEX `aggregatelevel-instanceid`;",false); - execute_sql("ALTER TABLE `{$CFG->prefix}context` ADD UNIQUE INDEX `contextlevel-instanceid` (`contextlevel`, `instanceid`)",false); // see 2006092409 below */ - } - - if ($oldversion < 2006092201) { - execute_sql('TRUNCATE TABLE '.$CFG->prefix.'cache_text', true); - table_column('cache_text','formattedtext','formattedtext','longtext','','','','not null'); - } - - if ($oldversion < 2006092302) { - // fix sortorder first if needed - if ($roles = get_all_roles()) { - $i = 0; - foreach ($roles as $rolex) { - if ($rolex->sortorder != $i) { - $r = new object(); - $r->id = $rolex->id; - $r->sortorder = $i; - update_record('role', $r); - } - $i++; - } - } -/* execute_sql("ALTER TABLE {$CFG->prefix}role DROP INDEX {$CFG->prefix}role_sor_ix;", false); - execute_sql("ALTER TABLE {$CFG->prefix}role ADD UNIQUE INDEX {$CFG->prefix}role_sor_uix (sortorder)", false);*/ - } - - if ($oldversion < 2006092400) { - table_column('user', '', 'trustbitmask', 'INTEGER', '10', 'unsigned', '0', 'not null', ''); - } - - if ($oldversion < 2006092409) { - // ok, once more and now correctly! - execute_sql("DROP INDEX `aggregatelevel-instanceid` ON {$CFG->prefix}context ;", false); - execute_sql("DROP INDEX `contextlevel-instanceid` ON {$CFG->prefix}context ;", false); - execute_sql("CREATE UNIQUE INDEX {$CFG->prefix}cont_conins_uix ON {$CFG->prefix}context (contextlevel, instanceid);", false); - - execute_sql("DROP INDEX {$CFG->prefix}role_sor_ix ON {$CFG->prefix}role ;", false); - execute_sql("DROP INDEX {$CFG->prefix}role_sor_uix ON {$CFG->prefix}role ;", false); - execute_sql("CREATE UNIQUE INDEX {$CFG->prefix}role_sor_uix ON {$CFG->prefix}role (sortorder);", false); - } - - if ($oldversion < 2006092601) { - table_column('log_display', 'field', 'field', 'varchar', '200', '', '', 'not null', ''); - } - - ////// DO NOT ADD NEW THINGS HERE!! USE upgrade.php and the lib/ddllib.php functions. - - return $result; -} - -?> diff --git a/lib/db/postgres7.php b/lib/db/postgres7.php deleted file mode 100644 index 3decbc2832784..0000000000000 --- a/lib/db/postgres7.php +++ /dev/null @@ -1,1961 +0,0 @@ -module = "user"; - $new->action = "view"; - $new->mtable = "user"; - $new->field = "CONCAT(firstname,\" \",lastname)"; - insert_record("log_display", $new); - - delete_records("log_display", "module", "course"); - $new->module = "course"; - $new->action = "view"; - $new->mtable = "course"; - $new->field = "fullname"; - insert_record("log_display", $new); - $new->action = "update"; - insert_record("log_display", $new); - $new->action = "enrol"; - insert_record("log_display", $new); - } - - //support user based course creating - if ($oldversion < 2003032400) { - execute_sql("CREATE TABLE {$CFG->prefix}user_coursecreators ( - id int8 SERIAL PRIMARY KEY, - userid int8 NOT NULL default '0' - )"); - } - - if ($oldversion < 2003041400) { - table_column("course_modules", "", "visible", "integer", "1", "unsigned", "1", "not null", "score"); - } - - if ($oldversion < 2003042104) { // Try to update permissions of all files - if ($files = get_directory_list($CFG->dataroot)) { - echo "Attempting to update permissions for all files... ignore any errors."; - foreach ($files as $file) { - echo "$CFG->dataroot/$file
"; - @chmod("$CFG->dataroot/$file", $CFG->directorypermissions); - } - } - } - - if ($oldversion < 2003042400) { - // Rebuild all course caches, because of changes to do with visible variable - if ($courses = get_records_sql("SELECT * FROM {$CFG->prefix}course")) { - require_once("$CFG->dirroot/course/lib.php"); - foreach ($courses as $course) { - $modinfo = serialize(get_array_of_activities($course->id)); - - if (!set_field("course", "modinfo", $modinfo, "id", $course->id)) { - notify("Could not cache module information for course '" . format_string($course->fullname) . "'!"); - } - } - } - } - - if ($oldversion < 2003042500) { - // Convert all usernames to lowercase. - $users = get_records_sql("SELECT id, username FROM {$CFG->prefix}user"); - $cerrors = ""; - $rarray = array(); - - foreach ($users as $user) { // Check for possible conflicts - $lcname = trim(moodle_strtolower($user->username)); - if (in_array($lcname, $rarray)) { - $cerrors .= $user->id."->".$lcname.'
' ; - } else { - array_push($rarray,$lcname); - } - } - - if ($cerrors != '') { - notify("Error: Cannot convert usernames to lowercase. - Following usernames would overlap (id->username):
$cerrors . - Please resolve overlapping errors."); - $result = false; - } - - $cerrors = ""; - echo "Checking userdatabase:
"; - foreach ($users as $user) { - $lcname = trim(moodle_strtolower($user->username)); - if ($lcname != $user->username) { - $convert = set_field("user" , "username" , $lcname, "id", $user->id); - if (!$convert) { - if ($cerrors){ - $cerrors .= ", "; - } - $cerrors .= $item; - } else { - echo "."; - } - } - } - if ($cerrors != '') { - notify("There were errors when converting following usernames to lowercase. - '$cerrors' . Sorry, but you will need to fix your database by hand."); - $result = false; - } - } - - if ($oldversion < 2003042700) { - /// Changing to multiple indexes - execute_sql(" CREATE INDEX {$CFG->prefix}log_coursemoduleaction_idx ON {$CFG->prefix}log (course,module,action) "); - execute_sql(" CREATE INDEX {$CFG->prefix}log_courseuserid_idx ON {$CFG->prefix}log (course,userid) "); - } - - if ($oldversion < 2003042801) { - execute_sql("CREATE TABLE {$CFG->prefix}course_display ( - id SERIAL PRIMARY KEY, - course integer NOT NULL default '0', - userid integer NOT NULL default '0', - display integer NOT NULL default '0' - )"); - - execute_sql("CREATE INDEX {$CFG->prefix}course_display_courseuserid_idx ON {$CFG->prefix}course_display (course,userid)"); - } - - if ($oldversion < 2003050400) { - table_column("course_sections", "", "visible", "integer", "1", "unsigned", "1", "", ""); - } - - if ($oldversion < 2003050401) { - table_column("user", "", "lang", "VARCHAR", "5", "", "$CFG->lang" ,"NOT NULL",""); - } - - if ($oldversion < 2003050900) { - table_column("modules", "", "visible", "integer", "1", "unsigned", "1", "", ""); - } - - if ($oldversion < 2003050902) { - if (get_records("modules", "name", "pgassignment")) { - print_simple_box("Note: the pgassignment module will soon be deleted from CVS! Go to the new 'Manage Modules' page and DELETE IT from your system", "center", "50%", "$THEME->cellheading", "20", "noticebox"); - } - } - - if ($oldversion < 2003051600) { - print_simple_box("Thanks for upgrading!

There are many changes since the last release. Please read the release notes carefully. If you are using CUSTOM themes you will need to edit them. You will also need to check your site's config.php file.", "center", "50%", "$THEME->cellheading", "20", "noticebox"); - } - - if ($oldversion < 2003052300) { - table_column("user", "", "autosubscribe", "integer", "1", "unsigned", "1", "", "htmleditor"); - } - - if ($oldversion < 2003072100) { - table_column("course", "", "visible", "integer", "1", "unsigned", "1", "", "marker"); - } - - if ($oldversion < 2003072101) { - table_column("course_sections", "sequence", "sequence", "text", "", "", "", "", ""); - } - - if ($oldversion < 2003072800) { - print_simple_box("The following database index improves performance, but can be quite large - if you are upgrading and you have problems with a limited quota you may want to delete this index later from the '{$CFG->prefix}log' table in your database", "center", "50%", "$THEME->cellheading", "20", "noticebox"); - flush(); - execute_sql(" CREATE INDEX {$CFG->prefix}log_timecoursemoduleaction_idx ON {$CFG->prefix}log (time,course,module,action) "); - execute_sql(" CREATE INDEX {$CFG->prefix}user_students_courseuserid_idx ON {$CFG->prefix}user_students (course,userid) "); - execute_sql(" CREATE INDEX {$CFG->prefix}user_teachers_courseuserid_idx ON {$CFG->prefix}user_teachers (course,userid) "); - } - - if ($oldversion < 2003072802) { - table_column("course_categories", "", "description", "text", "", "", ""); - table_column("course_categories", "", "parent", "integer", "10", "unsigned"); - table_column("course_categories", "", "sortorder", "integer", "10", "unsigned"); - table_column("course_categories", "", "courseorder", "text", "", "", ""); - table_column("course_categories", "", "visible", "integer", "1", "unsigned", "1"); - table_column("course_categories", "", "timemodified", "integer", "10", "unsigned"); - } - - if ($oldversion < 2003080400) { - notify("If the following command fails you may want to change the type manually, from TEXT to INTEGER. Moodle should keep working even if you don't."); - table_column("course_categories", "courseorder", "courseorder", "integer", "10", "unsigned"); - table_column("course", "", "sortorder", "integer", "10", "unsigned", "0", "", "category"); - } - - if ($oldversion < 2003081502) { - execute_sql(" CREATE TABLE {$CFG->prefix}scale ( - id SERIAL PRIMARY KEY, - courseid integer NOT NULL default '0', - userid integer NOT NULL default '0', - name varchar(255) NOT NULL default '', - scale text, - description text, - timemodified integer NOT NULL default '0' - )"); - } - - if ($oldversion < 2003081503) { - table_column("forum", "", "scale", "integer", "10", "unsigned", "0", "", "assessed"); - get_scales_menu(0); // Just to force the default scale to be created - } - - if ($oldversion < 2003081600) { - table_column("user_teachers", "", "editall", "integer", "1", "unsigned", "1", "", "role"); - table_column("user_teachers", "", "timemodified", "integer", "10", "unsigned", "0", "", "editall"); - } - - if ($oldversion < 2003081900) { - table_column("course_categories", "courseorder", "coursecount", "integer", "10", "unsigned", "0"); - } - - if ($oldversion < 2003080700) { - notify("Cleaning up categories and course ordering..."); - fix_course_sortorder(); - } - - - if ($oldversion < 2003082001) { - table_column("course", "", "showgrades", "integer", "2", "unsigned", "1", "", "format"); - } - - if ($oldversion < 2003082101) { - execute_sql(" CREATE INDEX {$CFG->prefix}course_category_idx ON {$CFG->prefix}course (category) "); - } - if ($oldversion < 2003082702) { - execute_sql(" INSERT INTO {$CFG->prefix}log_display (module, action, mtable, field) VALUES ('course', 'user report', 'user', 'CONCAT(firstname,\" \",lastname)') "); - } - - if ($oldversion < 2003091000) { - # Old field that was never added! - table_column("course", "", "showrecent", "integer", "10", "unsigned", "1", "", "numsections"); - } - - if ($oldversion < 2003091400) { - table_column("course_modules", "", "indent", "integer", "5", "unsigned", "0", "", "score"); - } - - if ($oldversion < 2003092900) { - table_column("course", "", "maxbytes", "integer", "10", "unsigned", "0", "", "marker"); - } - - if ($oldversion < 2003102700) { - table_column("user_students", "", "timeaccess", "integer", "10", "unsigned", "0", "", "time"); - table_column("user_teachers", "", "timeaccess", "integer", "10", "unsigned", "0", "", "timemodified"); - - $db->debug = false; - $CFG->debug = 0; - notify("Calculating access times. Please wait - this may take a long time on big sites...", "green"); - flush(); - - if ($courses = get_records_select("course", "category > 0")) { - foreach ($courses as $course) { - notify("Processing " . format_string($course->fullname) . " ...", "green"); - flush(); - if ($users = get_records_select("user_teachers", "course = '$course->id'", - "id", "id, userid, timeaccess")) { - foreach ($users as $user) { - $loginfo = get_record_sql("SELECT id, time FROM {$CFG->prefix}log WHERE course = '$course->id' and userid = '$user->userid' ORDER by time DESC"); - if (empty($loginfo->time)) { - $loginfo->time = 0; - } - execute_sql("UPDATE {$CFG->prefix}user_teachers SET timeaccess = '$loginfo->time' - WHERE userid = '$user->userid' AND course = '$course->id'", false); - - } - } - - if ($users = get_records_select("user_students", "course = '$course->id'", - "id", "id, userid, timeaccess")) { - foreach ($users as $user) { - $loginfo = get_record_sql("SELECT id, time FROM {$CFG->prefix}log - WHERE course = '$course->id' and userid = '$user->userid' - ORDER by time DESC"); - if (empty($loginfo->time)) { - $loginfo->time = 0; - } - execute_sql("UPDATE {$CFG->prefix}user_students - SET timeaccess = '$loginfo->time' - WHERE userid = '$user->userid' AND course = '$course->id'", false); - - } - } - } - } - notify("All courses complete.", "green"); - $db->debug = true; - } - - if ($oldversion < 2003103100) { - table_column("course", "", "showreports", "integer", "4", "unsigned", "0", "", "maxbytes"); - } - - - if ($oldversion < 2003121600) { - execute_sql("CREATE TABLE {$CFG->prefix}groups ( - id SERIAL PRIMARY KEY, - courseid integer NOT NULL default '0', - name varchar(255) NOT NULL default '', - description text, - lang varchar(10) NOT NULL default '', - picture integer NOT NULL default '0', - timecreated integer NOT NULL default '0', - timemodified integer NOT NULL default '0' - )"); - - execute_sql("CREATE INDEX {$CFG->prefix}groups_idx ON {$CFG->prefix}groups (courseid) "); - - execute_sql("CREATE TABLE {$CFG->prefix}groups_members ( - id SERIAL PRIMARY KEY, - groupid integer NOT NULL default '0', - userid integer NOT NULL default '0', - timeadded integer NOT NULL default '0' - )"); - - execute_sql("CREATE INDEX {$CFG->prefix}groups_members_idx ON {$CFG->prefix}groups_members (groupid) "); - } - - if ($oldversion < 2003122600) { - table_column("course", "", "groupmode", "integer", "4", "unsigned", "0", "", "visible"); - table_column("course", "", "groupmodeforce", "integer", "4", "unsigned", "0", "", "groupmode"); - } - - if ($oldversion < 2004010900) { - table_column("course_modules", "", "groupmode", "integer", "4", "unsigned", "0", "", "visible"); - } - - if ($oldversion < 2004011700) { - modify_database("", "CREATE TABLE prefix_event ( - id SERIAL PRIMARY KEY, - name varchar(255) NOT NULL default '', - description text, - courseid integer NOT NULL default '0', - groupid integer NOT NULL default '0', - userid integer NOT NULL default '0', - modulename varchar(20) NOT NULL default '', - instance integer NOT NULL default '0', - eventtype varchar(20) NOT NULL default '', - timestart integer NOT NULL default '0', - timeduration integer NOT NULL default '0', - timemodified integer NOT NULL default '0' - ); "); - - modify_database("", "CREATE INDEX prefix_event_courseid_idx ON prefix_event (courseid);"); - modify_database("", "CREATE INDEX prefix_event_userid_idx ON prefix_event (userid);"); - } - - - if ($oldversion < 2004012800) { - modify_database("", "CREATE TABLE prefix_user_preferences ( - id SERIAL PRIMARY KEY, - userid integer NOT NULL default '0', - name varchar(50) NOT NULL default '', - value varchar(255) NOT NULL default '' - ); "); - - modify_database("", "CREATE INDEX prefix_user_preferences_useridname_idx ON prefix_user_preferences (userid,name);"); - } - - if ($oldversion < 2004012900) { - table_column("config", "value", "value", "text", "", "", ""); - } - - if ($oldversion < 2004013101) { - table_column("log", "", "cmid", "integer", "10", "unsigned", "0", "", "module"); - set_config("upgrade", "logs"); - } - - if ($oldversion < 2004020900) { - table_column("course", "", "lang", "varchar", "5", "", "", "", "groupmodeforce"); - } - - if ($oldversion < 2004020903) { - modify_database("", "CREATE TABLE prefix_cache_text ( - id SERIAL PRIMARY KEY, - md5key varchar(32) NOT NULL default '', - formattedtext text, - timemodified integer NOT NULL default '0' - );"); - } - - if ($oldversion < 2004021000) { - $textfilters = array(); - for ($i=1; $i<=10; $i++) { - $variable = "textfilter$i"; - if (!empty($CFG->$variable)) { /// No more filters - if (is_readable("$CFG->dirroot/".$CFG->$variable)) { - $textfilters[] = $CFG->$variable; - } - } - } - $textfilters = implode(',', $textfilters); - if (empty($textfilters)) { - $textfilters = 'mod/glossary/dynalink.php'; - } - set_config('textfilters', $textfilters); - } - - if ($oldversion < 2004021201) { - modify_database("", "CREATE TABLE prefix_cache_filters ( - id SERIAL PRIMARY KEY, - filter varchar(32) NOT NULL default '', - version integer NOT NULL default '0', - md5key varchar(32) NOT NULL default '', - rawtext text, - timemodified integer NOT NULL default '0' - );"); - - modify_database("", "CREATE INDEX prefix_cache_filters_filtermd5key_idx ON prefix_cache_filters (filter,md5key);"); - modify_database("", "CREATE INDEX prefix_cache_text_md5key_idx ON prefix_cache_text (md5key);"); - } - - if ($oldversion < 2004021500) { - table_column("groups", "", "hidepicture", "integer", "2", "unsigned", "0", "", "picture"); - } - - if ($oldversion < 2004021700) { - if (!empty($CFG->textfilters)) { - $CFG->textfilters = str_replace("tex_filter.php", "filter.php", $CFG->textfilters); - $CFG->textfilters = str_replace("multilang.php", "filter.php", $CFG->textfilters); - $CFG->textfilters = str_replace("censor.php", "filter.php", $CFG->textfilters); - $CFG->textfilters = str_replace("mediaplugin.php", "filter.php", $CFG->textfilters); - $CFG->textfilters = str_replace("algebra_filter.php", "filter.php", $CFG->textfilters); - $CFG->textfilters = str_replace("dynalink.php", "filter.php", $CFG->textfilters); - set_config("textfilters", $CFG->textfilters); - } - } - - if ($oldversion < 2004022000) { - table_column("user", "", "emailstop", "integer", "1", "unsigned", "0", "not null", "email"); - } - - if ($oldversion < 2004022200) { /// Final renaming I hope. :-) - if (!empty($CFG->textfilters)) { - $CFG->textfilters = str_replace("/filter.php", "", $CFG->textfilters); - $CFG->textfilters = str_replace("mod/glossary/dynalink.php", "mod/glossary", $CFG->textfilters); - $textfilters = explode(',', $CFG->textfilters); - foreach ($textfilters as $key => $textfilter) { - $textfilters[$key] = trim($textfilter); - } - set_config("textfilters", implode(',',$textfilters)); - } - } - - if ($oldversion < 2004030702) { /// Because of the renaming of Czech language pack - execute_sql("UPDATE {$CFG->prefix}user SET lang = 'cs' WHERE lang = 'cz'"); - execute_sql("UPDATE {$CFG->prefix}course SET lang = 'cs' WHERE lang = 'cz'"); - } - - if ($oldversion < 2004041800) { /// Integrate Block System from contrib - table_column("course", "", "blockinfo", "varchar", "255", "", "", "not null", "modinfo"); - } - - if ($oldversion < 2004042600) { /// Rebuild course caches for resource icons - //include_once("$CFG->dirroot/course/lib.php"); - //rebuild_course_cache(); - } - - if ($oldversion < 2004042700) { /// Increase size of lang fields - table_column("user", "lang", "lang", "varchar", "10", "", "en"); - table_column("groups", "lang", "lang", "varchar", "10", "", ""); - table_column("course", "lang", "lang", "varchar", "10", "", ""); - } - - if ($oldversion < 2004042701) { /// Add hiddentopics field to control hidden topics behaviour - #table_column("course", "", "hiddentopics", "integer", "1", "unsigned", "0", "not null", "visible"); - #See 'hiddensections' further down - } - - if ($oldversion < 2004042702) { /// Add a format field for the description - table_column("event", "", "format", "integer", "4", "unsigned", "0", "not null", "description"); - } - - if ($oldversion < 2004043001) { /// Add hiddentopics field to control hidden topics behaviour - table_column("course", "", "hiddensections", "integer", "2", "unsigned", "0", "not null", "visible"); - } - - if ($oldversion < 2004050400) { /// add a visible field for events - table_column("event", "", "visible", "smallint", "1", "", "1", "not null", "timeduration"); - if ($events = get_records('event')) { - foreach($events as $event) { - if ($moduleid = get_field('modules', 'id', 'name', $event->modulename)) { - if (get_field('course_modules', 'visible', 'module', $moduleid, 'instance', $event->instance) == 0) { - set_field('event', 'visible', 0, 'id', $event->id); - } - } - } - } - } - - if ($oldversion < 2004052800) { /// First version tagged "1.4 development", version.php 1.227 - set_config('siteblocksadded', true); /// This will be used later by the block upgrade - } - - if ($oldversion < 2004053000) { /// set defaults for site course - $site = get_site(); - set_field('course', 'numsections', 0, 'id', $site->id); - set_field('course', 'groupmodeforce', 1, 'id', $site->id); - set_field('course', 'teacher', get_string('administrator'), 'id', $site->id); - set_field('course', 'teachers', get_string('administrators'), 'id', $site->id); - set_field('course', 'student', get_string('user'), 'id', $site->id); - set_field('course', 'students', get_string('users'), 'id', $site->id); - } - - if ($oldversion < 2004060100) { - set_config('digestmailtime', 0); - table_column('user', "", 'maildigest', 'smallint', '1', '', '0', 'not null', 'mailformat'); - } - - if ($oldversion < 2004062400) { - table_column('user_teachers', "", 'timeend', 'int', '10', 'unsigned', '0', 'not null', 'editall'); - table_column('user_teachers', "", 'timestart', 'int', '10', 'unsigned', '0', 'not null', 'editall'); - } - - if ($oldversion < 2004062401) { - table_column('course', '', 'idnumber', 'varchar', '100', '', '', 'not null', 'shortname'); - execute_sql('UPDATE '.$CFG->prefix.'course SET idnumber = shortname'); // By default - } - - if ($oldversion < 2004062600) { - table_column('course', '', 'cost', 'varchar', '10', '', '', 'not null', 'lang'); - } - - if ($oldversion < 2004072900) { - table_column('course', '', 'enrolperiod', 'int', '10', 'unsigned', '0', 'not null', 'startdate'); - } - - if ($oldversion < 2004072901) { // Fixing error in schema - if ($record = get_record('log_display', 'module', 'course', 'action', 'update')) { - delete_records('log_display', 'module', 'course', 'action', 'update'); - insert_record('log_display', $record, false); - } - } - - if ($oldversion < 2004081200) { // Fixing version errors in some blocks - set_field('blocks', 'version', 2004081200, 'name', 'admin'); - set_field('blocks', 'version', 2004081200, 'name', 'calendar_month'); - set_field('blocks', 'version', 2004081200, 'name', 'course_list'); - } - - if ($oldversion < 2004081500) { // Adding new "auth" field to user table to allow more flexibility - table_column('user', '', 'auth', 'varchar', '20', '', 'manual', 'not null', 'id'); - - execute_sql("UPDATE {$CFG->prefix}user SET auth = 'manual'"); // Set everyone to 'manual' to be sure - - if ($admins = get_admins()) { // Set all the NON-admins to whatever the current auth module is - $adminlist = array(); - foreach ($admins as $user) { - $adminlist[] = $user->id; - } - $adminlist = implode(',', $adminlist); - execute_sql("UPDATE {$CFG->prefix}user SET auth = '$CFG->auth' WHERE id NOT IN ($adminlist)"); - } - } - - if ($oldversion < 2004082600) { - //update auth-fields for external users - // following code would not work in 1.8 -/* include_once ($CFG->dirroot."/auth/".$CFG->auth."/lib.php"); - if (function_exists('auth_get_userlist')) { - $externalusers = auth_get_userlist(); - if (!empty($externalusers)){ - $externalusers = '\''. implode('\',\'',$externalusers).'\''; - execute_sql("UPDATE {$CFG->prefix}user SET auth = '$CFG->auth' WHERE username IN ($externalusers)"); - } - }*/ - } - - if ($oldversion < 2004082900) { // Make sure guest is "manual" too. - set_field('user', 'auth', 'manual', 'username', 'guest'); - } - - /* Just commenteed unused fields out - if ($oldversion < 2004090300) { // Add guid-field used in user syncronization - table_column('user', '', 'guid', 'varchar', '128', '', '', '', 'auth'); - execute_sql("CREATE INDEX {$CFG->prefix}user_auth_guid_idx ON {$CFG->prefix}user (auth, guid)"); - } - */ - - if ($oldversion < 2004091900) { //Modify idnumber to hold longer keys - set_field('user', 'auth', 'manual', 'username', 'guest'); - table_column('user', 'idnumber', 'idnumber', 'varchar', '64', '', '', '', ''); - execute_sql("DROP INDEX {$CFG->prefix}user_idnumber_idx ;",false);// added in case of conflicts with upgrade from 14stable - execute_sql("DROP INDEX {$CFG->prefix}user_auth_idx ;",false);// added in case of conflicts with upgrade from 14stable - execute_sql("CREATE INDEX {$CFG->prefix}user_idnumber_idx ON {$CFG->prefix}user (idnumber)"); - execute_sql("CREATE INDEX {$CFG->prefix}user_auth_idx ON {$CFG->prefix}user (auth)"); - } - - if ($oldversion < 2004092000) { //redoing this just to be sure that column type is text (postgres type changes didnt work when this was done first time) - table_column("config", "value", "value", "text", "", "", ""); - } - - if ($oldversion < 2004093001) { // add new table for sessions storage - execute_sql(" CREATE TABLE {$CFG->prefix}sessions ( - sesskey char(32) PRIMARY KEY, - expiry integer NOT null, - expireref varchar(64), - data text NOT null - );"); - - execute_sql(" CREATE INDEX {$CFG->prefix}sessions_expiry_idx ON {$CFG->prefix}sessions (expiry)"); - } - - if ($oldversion < 2004111500) { // Update any users/courses using wrongly-named lang pack - execute_sql("UPDATE {$CFG->prefix}user SET lang = 'mi_nt' WHERE lang = 'ma_nt'"); - execute_sql("UPDATE {$CFG->prefix}course SET lang = 'mi_nt' WHERE lang = 'ma_nt'"); - } - - if ($oldversion < 2004111700) { // add indexes- drop them first silently to avoid conflicts when upgrading. - execute_sql("DROP INDEX {$CFG->prefix}course_idnumber_idx;",false); - execute_sql("DROP INDEX {$CFG->prefix}course_shortname_idx;",false); - execute_sql("DROP INDEX {$CFG->prefix}user_students_userid_idx;",false); - execute_sql("DROP INDEX {$CFG->prefix}user_teachers_userid_idx;",false); - - modify_database("","CREATE INDEX {$CFG->prefix}course_idnumber_idx ON {$CFG->prefix}course (idnumber);" ); - modify_database("","CREATE INDEX {$CFG->prefix}course_shortname_idx ON {$CFG->prefix}course (shortname);" ); - modify_database("","CREATE INDEX {$CFG->prefix}user_students_userid_idx ON {$CFG->prefix}user_students (userid);"); - modify_database("","CREATE INDEX {$CFG->prefix}user_teachers_userid_idx ON {$CFG->prefix}user_teachers (userid);"); - } - - if ($oldversion < 2004111700) { // add an index to event for timestart and timeduration- drop them first silently to avoid conflicts when upgrading. - execute_sql("DROP INDEX {$CFG->prefix}event_timestart_idx;",false); - execute_sql("DROP INDEX {$CFG->prefix}event_timeduration_idx;",false); - - modify_database('','CREATE INDEX prefix_event_timestart_idx ON prefix_event (timestart);'); - modify_database('','CREATE INDEX prefix_event_timeduration_idx ON prefix_event (timeduration);'); - } - - if ($oldversion < 2004117000) { // add an index on the groups_members table- drop them first silently to avoid conflicts when upgrading. - execute_sql("DROP INDEX {$CFG->prefix}groups_members_userid_idx;",false); - - modify_database('','CREATE INDEX prefix_groups_members_userid_idx ON prefix_groups_members (userid);'); - } - - if ($oldversion < 2004111700) { //add indexes on modules and course_modules- drop them first silently to avoid conflicts when upgrading. - execute_sql("DROP INDEX {$CFG->prefix}course_modules_visible_idx;",false); - execute_sql("DROP INDEX {$CFG->prefix}course_modules_course_idx;",false); - execute_sql("DROP INDEX {$CFG->prefix}course_modules_module_idx;",false); - execute_sql("DROP INDEX {$CFG->prefix}course_modules_instance_idx;",false); - execute_sql("DROP INDEX {$CFG->prefix}course_modules_deleted_idx;",false); - execute_sql("DROP INDEX {$CFG->prefix}modules_name_idx;",false); - - modify_database('','CREATE INDEX prefix_course_modules_visible_idx ON prefix_course_modules (visible);'); - modify_database('','CREATE INDEX prefix_course_modules_course_idx ON prefix_course_modules (course);'); - modify_database('','CREATE INDEX prefix_course_modules_module_idx ON prefix_course_modules (module);'); - modify_database('','CREATE INDEX prefix_course_modules_instance_idx ON prefix_course_modules (instance);'); - modify_database('','CREATE INDEX prefix_course_modules_deleted_idx ON prefix_course_modules (deleted);'); - modify_database('','CREATE INDEX prefix_modules_name_idx ON prefix_modules (name);'); - } - - if ($oldversion < 2004111700) { // add an index on user students timeaccess (used for sorting)- drop them first silently to avoid conflicts when upgrading - execute_sql("DROP INDEX {$CFG->prefix}user_students_timeaccess_idx;",false); - - modify_database('','CREATE INDEX prefix_user_students_timeaccess_idx ON prefix_user_students (timeaccess);'); - } - - if ($oldversion < 2004111700) { //add indexes on faux foreign keys - drop them first silently to avoid conflicts when upgrading. - execute_sql("DROP INDEX {$CFG->prefix}course_sections_coursesection_idx;",false); - execute_sql("DROP INDEX {$CFG->prefix}scale_courseid_idx;",false); - execute_sql("DROP INDEX {$CFG->prefix}user_admins_userid_idx;",false); - execute_sql("DROP INDEX {$CFG->prefix}user_coursecreators_userid_idx;",false); - - modify_database('','CREATE INDEX prefix_course_sections_coursesection_idx ON prefix_course_sections (course,section);'); - modify_database('','CREATE INDEX prefix_scale_courseid_idx ON prefix_scale (courseid);'); - modify_database('','CREATE INDEX prefix_user_admins_userid_idx ON prefix_user_admins (userid);'); - modify_database('','CREATE INDEX prefix_user_coursecreators_userid_idx ON prefix_user_coursecreators (userid);'); - } - - if ($oldversion < 2004111700) { // make new indexes on user table. - fix_course_sortorder(0,0,1); - - execute_sql("DROP INDEX {$CFG->prefix}course_category_idx;",false); - execute_sql("DROP INDEX {$CFG->prefix}course_category_sortorder_uk;",false); - modify_database('', "CREATE UNIQUE INDEX prefix_course_category_sortorder_uk ON prefix_course(category,sortorder)"); - - execute_sql("DROP INDEX {$CFG->prefix}user_deleted_idx;",false); - execute_sql("DROP INDEX {$CFG->prefix}user_confirmed_idx;",false); - execute_sql("DROP INDEX {$CFG->prefix}user_firstname_idx;",false); - execute_sql("DROP INDEX {$CFG->prefix}user_lastname_idx;",false); - execute_sql("DROP INDEX {$CFG->prefix}user_city_idx;",false); - execute_sql("DROP INDEX {$CFG->prefix}user_country_idx;",false); - execute_sql("DROP INDEX {$CFG->prefix}user_lastaccess_idx;",false); - - modify_database("","CREATE INDEX prefix_user_deleted_idx ON prefix_user (deleted)"); - modify_database("","CREATE INDEX prefix_user_confirmed_idx ON prefix_user (confirmed)"); - modify_database("","CREATE INDEX prefix_user_firstname_idx ON prefix_user (firstname)"); - modify_database("","CREATE INDEX prefix_user_lastname_idx ON prefix_user (lastname)"); - modify_database("","CREATE INDEX prefix_user_city_idx ON prefix_user (city)"); - modify_database("","CREATE INDEX prefix_user_country_idx ON prefix_user (country)"); - modify_database("","CREATE INDEX prefix_user_lastaccess_idx ON prefix_user (lastaccess)"); - } - - if ($oldversion < 2004111700) { // one more index for email (for sorting) - execute_sql("DROP INDEX {$CFG->prefix}user_email_idx;",false); - - modify_database('','CREATE INDEX prefix_user_email_idx ON prefix_user (email);'); - } - - if ($oldversion < 2004112200) { // new 'enrol' field for enrolment tables - table_column('user_students', '', 'enrol', 'varchar', '20', '', '', 'not null'); - table_column('user_teachers', '', 'enrol', 'varchar', '20', '', '', 'not null'); - modify_database("","CREATE INDEX {$CFG->prefix}user_students_enrol_idx ON {$CFG->prefix}user_students (enrol);"); - modify_database("","CREATE INDEX {$CFG->prefix}user_teachers_enrol_idx ON {$CFG->prefix}user_teachers (enrol);"); - } - - if ($oldversion < 2004112300) { // update log display to use correct postgres friendly sql - execute_sql("UPDATE {$CFG->prefix}log_display SET field='firstname||\' \'||lastname' WHERE module='user' AND action='view' AND mtable='user'"); - execute_sql("UPDATE {$CFG->prefix}log_display SET field='firstname||\' \'||lastname' WHERE module='course' AND action='user report' AND mtable='user'"); - } - - if ($oldversion < 2004112400) { - - /// Delete duplicate enrolments - /// and then tell the database course,userid is a unique combination - if ($users = get_records_select("user_students", "userid > 0 GROUP BY course, userid ". - "HAVING count(*) > 1", "", "max(id) as id, userid, course ,count(*)")) { - foreach ($users as $user) { - delete_records_select("user_students", "userid = '$user->userid' ". - "AND course = '$user->course' AND id <> '$user->id'"); - } - } - flush(); - - // drop some indexes quietly -- they may or may not exist depending on what version - // the user upgrades from - execute_sql("DROP INDEX {$CFG->prefix}user_students_courseuserid_idx ", false); - execute_sql("DROP INDEX {$CFG->prefix}user_students_courseuserid_uk ", false); - modify_database('','CREATE UNIQUE INDEX prefix_user_students_courseuserid_uk ON prefix_user_students (course,userid);'); - - /// Delete duplicate teacher enrolments - /// and then tell the database course,userid is a unique combination - if ($users = get_records_select("user_teachers", "userid > 0 GROUP BY course, userid ". - "HAVING count(*) > 1", "", "max(id) as id, userid, course ,count(*)")) { - foreach ($users as $user) { - delete_records_select("user_teachers", "userid = '$user->userid' ". - "AND course = '$user->course' AND id <> '$user->id'"); - } - } - flush(); - - // drop some indexes quietly -- they may or may not exist depending on what version - // the user upgrades from - execute_sql("DROP INDEX {$CFG->prefix}user_teachers_courseuserid_idx ", false); - execute_sql("DROP INDEX {$CFG->prefix}user_teachers_courseuserid_uk ", false); - modify_database('','CREATE UNIQUE INDEX prefix_user_teachers_courseuserid_uk ON prefix_user_teachers (course,userid);'); - } - - if ($oldversion < 2004112401) { - // some postgres databases may have a non-unique index mislabeled unique. - fix_course_sortorder(0,0,1); - execute_sql("DROP INDEX {$CFG->prefix}course_category_sortorder_uk ", false); - execute_sql("DROP INDEX {$CFG->prefix}course_category_idx ", false); - modify_database('', "CREATE UNIQUE INDEX prefix_course_category_sortorder_uk ON prefix_course(category,sortorder);"); - - // odd! username was missing its unique index! - // first silently drop it just in case... - execute_sql("ALTER TABLE {$CFG->prefix}user DROP CONSTRAINT {$CFG->prefix}user_username_uk;", false); - execute_sql("DROP INDEX {$CFG->prefix}user_username_uk", false); - modify_database('', "CREATE UNIQUE INDEX prefix_user_username_uk ON prefix_user (username);"); - - } - - if ($oldversion < 2004112900) { - table_column('user', '', 'policyagreed', 'integer', '1', 'unsigned', '0', 'not null', 'confirmed'); - } - - if ($oldversion < 2004121400) { - table_column('groups', '', 'password', 'varchar', '50', '', '', 'not null', 'description'); - } - - if ($oldversion < 2004121600) { - modify_database('',"CREATE TABLE prefix_dst_preset ( - id SERIAL PRIMARY KEY, - name varchar(48) NOT NULL default '', - apply_offset integer NOT NULL default '0', - activate_index integer NOT NULL default '1', - activate_day integer NOT NULL default '1', - activate_month integer NOT NULL default '1', - activate_time char(5) NOT NULL default '03:00', - deactivate_index integer NOT NULL default '1', - deactivate_day integer NOT NULL default '1', - deactivate_month integer NOT NULL default '2', - deactivate_time char(5) NOT NULL default '03:00', - last_change integer NOT NULL default '0', - next_change integer NOT NULL default '0', - current_offset integer NOT NULL default '0' - );"); - } - - if ($oldversion < 2004122800) { - execute_sql("DROP TABLE {$CFG->prefix}message", false); - execute_sql("DROP TABLE {$CFG->prefix}message_read", false); - execute_sql("DROP TABLE {$CFG->prefix}message_contacts", false); - - execute_sql("DROP INDEX {$CFG->prefix}message_useridfrom_idx", false); - execute_sql("DROP INDEX {$CFG->prefix}message_useridto_idx", false); - execute_sql("DROP INDEX {$CFG->prefix}message_read_useridfrom_idx", false); - execute_sql("DROP INDEX {$CFG->prefix}message_read_useridto_idx", false); - execute_sql("DROP INDEX {$CFG->prefix}message_contacts_useridcontactid_idx", false); - - modify_database('',"CREATE TABLE prefix_message ( - id SERIAL PRIMARY KEY, - useridfrom integer NOT NULL default '0', - useridto integer NOT NULL default '0', - message text, - timecreated integer NOT NULL default '0', - messagetype varchar(50) NOT NULL default '' - ); - - CREATE INDEX prefix_message_useridfrom_idx ON prefix_message (useridfrom); - CREATE INDEX prefix_message_useridto_idx ON prefix_message (useridto); - - CREATE TABLE prefix_message_read ( - id SERIAL PRIMARY KEY, - useridfrom integer NOT NULL default '0', - useridto integer NOT NULL default '0', - message text, - timecreated integer NOT NULL default '0', - timeread integer NOT NULL default '0', - messagetype varchar(50) NOT NULL default '', - mailed integer NOT NULL default '0' - ); - - CREATE INDEX prefix_message_read_useridfrom_idx ON prefix_message_read (useridfrom); - CREATE INDEX prefix_message_read_useridto_idx ON prefix_message_read (useridto); - "); - - modify_database('',"CREATE TABLE prefix_message_contacts ( - id SERIAL PRIMARY KEY, - userid integer NOT NULL default '0', - contactid integer NOT NULL default '0', - blocked integer NOT NULL default '0' - ); - - CREATE INDEX prefix_message_contacts_useridcontactid_idx ON prefix_message_contacts (userid,contactid); - "); - - modify_database('',"INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('message', 'write', 'user', 'firstname||\' \'||lastname'); - INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('message', 'read', 'user', 'firstname||\' \'||lastname'); - "); - } - - if ($oldversion < 2004122801) { - table_column('message', '', 'format', 'integer', '4', 'unsigned', '0', 'not null', 'message'); - table_column('message_read', '', 'format', 'integer', '4', 'unsigned', '0', 'not null', 'message'); - } - - - if ($oldversion < 2005010100) { - modify_database('',"INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('message', 'add contact', 'user', 'firstname||\' \'||lastname'); - INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('message', 'remove contact', 'user', 'firstname||\' \'||lastname'); - INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('message', 'block contact', 'user', 'firstname||\' \'||lastname'); - INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('message', 'unblock contact', 'user', 'firstname||\' \'||lastname'); - "); - } - - if ($oldversion < 2005011000) { // Create a .htaccess file in dataroot, just in case - if (!file_exists($CFG->dataroot.'/.htaccess')) { - if ($handle = fopen($CFG->dataroot.'/.htaccess', 'w')) { // For safety - @fwrite($handle, "deny from all\r\nAllowOverride None\r\n"); - @fclose($handle); - notify("Created a default .htaccess file in $CFG->dataroot"); - } - } - } - - if ($oldversion < 2005012500) { // add new table for meta courses. - /* - modify_database("","CREATE TABLE prefix_meta_course ( - id SERIAL primary key, - parent_course integer NOT NULL, - child_course integer NOT NULL - );"); - - modify_database("","CREATE INDEX prefix_meta_course_parent_idx ON prefix_meta_course (parent_course);"); - modify_database("","CREATE INDEX prefix_meta_course_child_idx ON prefix_meta_course (child_course);"); - table_column('course','','meta_course','integer','1','','0','not null'); - */ // taking this OUT for upgrade from 1.4 to 1.5 (those tracking head will have already seen it) - } - - if ($oldversion < 2005012501) { //fix table names for consistency - execute_sql("DROP TABLE {$CFG->prefix}meta_course",false); // drop silently - execute_sql("ALTER TABLE {$CFG->prefix}course DROP COLUMN meta_course",false); // drop silently - - modify_database("","CREATE TABLE prefix_course_meta ( - id SERIAL primary key, - parent_course integer NOT NULL, - child_course integer NOT NULL - );"); - - modify_database("","CREATE INDEX prefix_course_meta_parent_idx ON prefix_course_meta (parent_course);"); - modify_database("","CREATE INDEX prefix_course_meta_child_idx ON prefix_course_meta (child_course);"); - table_column('course','','metacourse','integer','1','','0','not null'); - } - - if ($oldversion < 2005020100) { - fix_course_sortorder(0, 1, 1); - } - - if ($oldversion < 2005021000) { // New fields for theme choices - table_column('course', '', 'theme', 'varchar', '50', '', '', '', 'lang'); - table_column('groups', '', 'theme', 'varchar', '50', '', '', '', 'lang'); - table_column('user', '', 'theme', 'varchar', '50', '', '', '', 'lang'); - - set_config('theme', 'standardwhite'); // Reset to a known good theme - } - - if ($oldversion < 2005021700) { - table_column('user', '', 'dstpreset', 'int', '10', '', '0', 'not null', 'timezone'); - } - - if ($oldversion < 2005021800) { - modify_database("","CREATE TABLE adodb_logsql ( - created timestamp NOT NULL, - sql0 varchar(250) NOT NULL, - sql1 text NOT NULL, - params text NOT NULL, - tracer text NOT NULL, - timer decimal(16,6) NOT NULL - );"); - } - - if ($oldversion < 2005022400) { - table_column('dst_preset', '', 'family', 'varchar', '100', '', '', 'not null', 'name'); - table_column('dst_preset', '', 'year', 'int', '10', '', '0', 'not null', 'family'); - } - - if ($oldversion < 2005030501) { - table_column('user', '', 'msn', 'varchar', '50', '', '', '', 'icq'); - table_column('user', '', 'aim', 'varchar', '50', '', '', '', 'icq'); - table_column('user', '', 'yahoo', 'varchar', '50', '', '', '', 'icq'); - table_column('user', '', 'skype', 'varchar', '50', '', '', '', 'icq'); - } - - if ($oldversion < 2005032300) { - table_column('user', 'dstpreset', 'timezonename', 'varchar', '100'); - execute_sql('UPDATE '.$CFG->prefix.'user SET timezonename = \'\''); - } - - - if ($oldversion < 2005032600) { - execute_sql('DROP TABLE '.$CFG->prefix.'dst_preset', false); - modify_database('',"CREATE TABLE prefix_timezone ( - id SERIAL PRIMARY KEY, - name varchar(100) NOT NULL default '', - year integer NOT NULL default '0', - rule varchar(20) NOT NULL default '', - gmtoff integer NOT NULL default '0', - dstoff integer NOT NULL default '0', - dst_month integer NOT NULL default '0', - dst_startday integer NOT NULL default '0', - dst_weekday integer NOT NULL default '0', - dst_skipweeks integer NOT NULL default '0', - dst_time varchar(5) NOT NULL default '00:00', - std_month integer NOT NULL default '0', - std_startday integer NOT NULL default '0', - std_weekday integer NOT NULL default '0', - std_skipweeks integer NOT NULL default '0', - std_time varchar(5) NOT NULL default '00:00' - );"); - } - - if ($oldversion < 2005032800) { - modify_database('',"CREATE TABLE prefix_grade_category ( - id SERIAL PRIMARY KEY, - name varchar(64) default NULL, - courseid integer NOT NULL default '0', - drop_x_lowest integer NOT NULL default '0', - bonus_points integer NOT NULL default '0', - hidden integer NOT NULL default '0', - weight decimal(4,2) default '0.00' - );"); - - modify_database('',"CREATE INDEX prefix_grade_category_courseid_idx ON prefix_grade_category (courseid);"); - - modify_database('',"CREATE TABLE prefix_grade_exceptions ( - id SERIAL PRIMARY KEY, - courseid integer NOT NULL default '0', - grade_itemid integer NOT NULL default '0', - userid integer NOT NULL default '0' - );"); - - modify_database('',"CREATE INDEX prefix_grade_exceptions_courseid_idx ON prefix_grade_exceptions (courseid);"); - - - modify_database('',"CREATE TABLE prefix_grade_item ( - id SERIAL PRIMARY KEY, - courseid integer default NULL, - category integer default NULL, - modid integer default NULL, - cminstance integer default NULL, - scale_grade float(11) default '1.0000000000', - extra_credit integer NOT NULL default '0', - sort_order integer NOT NULL default '0' - );"); - - modify_database('',"CREATE INDEX prefix_grade_item_courseid_idx ON prefix_grade_item (courseid);"); - - modify_database('',"CREATE TABLE prefix_grade_letter ( - id SERIAL PRIMARY KEY, - courseid integer NOT NULL default '0', - letter varchar(8) NOT NULL default 'NA', - grade_high decimal(6,2) NOT NULL default '100.00', - grade_low decimal(6,2) NOT NULL default '0.00' - );"); - - modify_database('',"CREATE INDEX prefix_grade_letter_courseid_idx ON prefix_grade_letter (courseid);"); - - modify_database('',"CREATE TABLE prefix_grade_preferences ( - id SERIAL PRIMARY KEY, - courseid integer default NULL, - preference integer NOT NULL default '0', - value integer NOT NULL default '0' - );"); - - modify_database('',"CREATE UNIQUE INDEX prefix_grade_prefs_courseidpref_uk ON prefix_grade_preferences (courseid,preference);"); - } - - if ($oldversion < 2005033100) { // Get rid of defunct field from course modules table - delete_records('course_modules', 'deleted', 1); // Delete old records we don't need any more - execute_sql('DROP INDEX '.$CFG->prefix.'course_modules_deleted_idx;'); // Old index - execute_sql('ALTER TABLE '.$CFG->prefix.'course_modules DROP deleted;'); // Old field - } - - if ($oldversion < 2005040800) { - table_column('user', 'timezone', 'timezone', 'varchar', '100', '', '99'); - execute_sql(" ALTER TABLE {$CFG->prefix}user DROP timezonename "); - } - - if ($oldversion < 2005041101) { - require_once($CFG->libdir.'/filelib.php'); - if (is_readable($CFG->dirroot.'/lib/timezones.txt')) { // Distribution file - if ($timezones = get_records_csv($CFG->dirroot.'/lib/timezones.txt', 'timezone')) { - $db->debug = false; - update_timezone_records($timezones); - notify(count($timezones).' timezones installed'); - $db->debug = true; - } - } - } - - if ($oldversion < 2005041900) { // Copy all Dialogue entries into Messages, and hide Dialogue module - - if ($entries = get_records_sql('SELECT e.id, e.userid, c.recipientid, e.text, e.timecreated - FROM '.$CFG->prefix.'dialogue_conversations c, - '.$CFG->prefix.'dialogue_entries e - WHERE e.conversationid = c.id')) { - foreach ($entries as $entry) { - $message = NULL; - $message->useridfrom = $entry->userid; - $message->useridto = $entry->recipientid; - $message->message = addslashes($entry->text); - $message->format = FORMAT_HTML; - $message->timecreated = $entry->timecreated; - $message->messagetype = 'direct'; - - insert_record('message_read', $message); - } - } - - set_field('modules', 'visible', 0, 'name', 'dialogue'); - - notify('The Dialogue module has been disabled, and all the old Messages from it copied into the new standard Message feature. If you really want Dialogue back, you can enable it using the "eye" icon here: Admin >> Modules >> Dialogue'); - - } - - if ($oldversion < 2005042100) { - $result = table_column('event', '', 'repeatid', 'int', '10', 'unsigned', '0', 'not null', 'userid') && $result; - } - - if ($oldversion < 2005042400) { // Add user tracking prefs field. - table_column('user', '', 'trackforums', 'int', '4', 'unsigned', '0', 'not null', 'autosubscribe'); - } - - if ($oldversion < 2005051500) { // Add user tracking prefs field. - table_column('grade_category', 'weight', 'weight', 'numeric(5,2)', '', '', '0.00', '', ''); - } - - if ($oldversion < 2005053000 ) { // Add config_plugins table - - // this table was created on the MOODLE_15_STABLE branch - // so it may already exist. Therefore we hide potential errors - // (Postgres doesn't support CREATE TABLE IF NOT EXISTS) - execute_sql("CREATE TABLE {$CFG->prefix}config_plugins ( - id SERIAL PRIMARY KEY, - plugin varchar(100) NOT NULL default 'core', - name varchar(100) NOT NULL default '', - value text NOT NULL default '', - CONSTRAINT {$CFG->prefix}config_plugins_plugin_name_uk UNIQUE (plugin, name) - );", false); - - } - - if ($oldversion < 2005060200) { // migrate some config items to config_plugins table - - // NOTE: this block is in both postgres AND mysql upgrade - // files. If you edit either, update the otherone. - $user_fields = array("firstname", "lastname", "email", - "phone1", "phone2", "department", - "address", "city", "country", - "description", "idnumber", "lang"); - if (!empty($CFG->auth)) { // if we have no auth, just pass - foreach ($user_fields as $field) { - $suffixes = array('', '_editlock', '_updateremote', '_updatelocal'); - foreach ($suffixes as $suffix) { - $key = 'auth_user_' . $field . $suffix; - if (isset($CFG->$key)) { - - // translate keys & values - // to the new convention - // this should support upgrading - // even 1.5dev installs - $newkey = $key; - $newval = $CFG->$key; - if ($suffix === '') { - $newkey = 'field_map_' . $field; - } elseif ($suffix === '_editlock') { - $newkey = 'field_lock_' . $field; - $newval = ($newval==1) ? 'locked' : 'unlocked'; // translate 0/1 to locked/unlocked - } elseif ($suffix === '_updateremote') { - $newkey = 'field_updateremote_' . $field; - } elseif ($suffix === '_updatelocal') { - $newkey = 'field_updatelocal_' . $field; - $newval = ($newval==1) ? 'onlogin' : 'oncreate'; // translate 0/1 to locked/unlocked - } - - if (!(set_config($newkey, addslashes($newval), 'auth/'.$CFG->auth) - && delete_records('config', 'name', $key))) { - notify("Error updating Auth configuration $key to {$CFG->auth} $newkey ."); - $result = false; - } - } // end if isset key - } // end foreach suffix - } // end foreach field - } - } - - if ($oldversion < 2005060201) { // Close down the Attendance module, we are removing it from CVS. - if (!file_exists($CFG->dirroot.'/mod/attendance/lib.php')) { - if (count_records('attendance')) { // We have some data, so should keep it - - set_field('modules', 'visible', 0, 'name', 'attendance'); - notify('The Attendance module has been discontinued. If you really want to - continue using it, you should download it individually from - http://download.moodle.org/modules and install it, then - reactivate it from Admin >> Configuration >> Modules. - None of your existing data has been deleted, so all existing - Attendance activities should re-appear.'); - - } else { // No data, so do a complete delete - - execute_sql('DROP TABLE '.$CFG->prefix.'attendance', false); - delete_records('modules', 'name', 'attendance'); - notify("The Attendance module has been discontinued and removed from your site. - You weren't using it anyway. ;-)"); - } - } - } - - if ($oldversion < 2005060223) { // Mass cleanup of bad postgres upgrade scripts - execute_sql("DROP TABLE {$CFG->prefix}attendance_roll", false); // There are no attendance module anymore - modify_database('','ALTER TABLE prefix_config ALTER value SET NOT NULL'); - modify_database('','ALTER TABLE prefix_course ALTER metacourse SET NOT NULL'); - modify_database('','ALTER TABLE prefix_course ALTER theme SET NOT NULL'); - modify_database('','ALTER TABLE prefix_event ALTER repeatid SET NOT NULL'); - modify_database('','ALTER TABLE prefix_groups ALTER password SET NOT NULL'); - modify_database('','ALTER TABLE prefix_groups ALTER theme SET NOT NULL'); - modify_database('','ALTER TABLE prefix_message ALTER format SET NOT NULL'); - modify_database('','ALTER TABLE prefix_message_read ALTER format SET NOT NULL'); - modify_database('','ALTER TABLE prefix_groups ALTER theme SET NOT NULL'); - modify_database('','ALTER TABLE prefix_user ALTER aim DROP DEFAULT'); - modify_database('','ALTER TABLE prefix_user ALTER idnumber DROP DEFAULT'); - modify_database('','ALTER TABLE prefix_user ALTER msn DROP DEFAULT'); - modify_database('','ALTER TABLE prefix_user ALTER policyagreed SET NOT NULL'); - modify_database('','ALTER TABLE prefix_user ALTER skype DROP DEFAULT'); - modify_database('','ALTER TABLE prefix_user ALTER theme SET NOT NULL'); - modify_database('','ALTER TABLE prefix_user ALTER timezone SET NOT NULL'); - modify_database('','ALTER TABLE prefix_user ALTER trackforums SET NOT NULL'); - modify_database('','ALTER TABLE prefix_user ALTER yahoo DROP DEFAULT'); - modify_database('','ALTER TABLE prefix_user_students ALTER enrol SET NOT NULL'); - modify_database('','ALTER TABLE prefix_user_teachers ALTER enrol SET NOT NULL'); - } - - if ($oldversion < 2005071700) { // Close down the Dialogue module, we are removing it from CVS. - if (!file_exists($CFG->dirroot.'/mod/dialogue/lib.php')) { - if (count_records('dialogue')) { // We have some data, so should keep it - - set_field('modules', 'visible', 0, 'name', 'dialogue'); - notify('The Dialogue module has been discontinued. If you really want to - continue using it, you should download it individually from - http://download.moodle.org/modules and install it, then - reactivate it from Admin >> Configuration >> Modules. - None of your existing data has been deleted, so all existing - Dialogue activities should re-appear.'); - - } else { // No data, so do a complete delete - - execute_sql('DROP TABLE '.$CFG->prefix.'dialogue', false); - delete_records('modules', 'name', 'dialogue'); - notify("The Dialogue module has been discontinued and removed from your site. - You weren't using it anyway. ;-)"); - } - } - } - - if ($oldversion < 2005072000) { // Add a couple fields to mdl_event to work towards iCal import/export - table_column('event', '', 'uuid', 'char', '36', '', '', 'not null', 'visible'); - table_column('event', '', 'sequence', 'integer', '10', 'unsigned', '1', 'not null', 'uuid'); - } - - if ($oldversion < 2005072100) { // run the online assignment cleanup code - include($CFG->dirroot.'/'.$CFG->admin.'/oacleanup.php'); - if (function_exists('online_assignment_cleanup')) { - online_assignment_cleanup(); - } - } - - if ($oldversion < 2005072200) { // fix the mistakenly-added currency stuff from enrol/authorize - execute_sql("DROP TABLE {$CFG->prefix}currencies", false); // drop silently - execute_sql("ALTER TABLE {$CFG->prefix}course DROP currency", false); - $defaultcurrency = empty($CFG->enrol_currency) ? 'USD' : $CFG->enrol_currency; - table_column('course', '', 'currency', 'char', '3', '', $defaultcurrency, 'not null', 'cost'); - } - - if ($oldversion < 2005081600) { //set up the course requests table - modify_database('',"CREATE TABLE prefix_course_request ( - id SERIAL PRIMARY KEY, - fullname varchar(254) NOT NULL default '', - shortname varchar(15) NOT NULL default '', - summary text NOT NULL default '', - reason text NOT NULL default '', - requester INTEGER NOT NULL default 0 - );"); - - modify_database('','CREATE INDEX prefix_course_request_shortname_idx ON prefix_course_request (shortname);'); - - table_column('course','','requested'); - } - - if ($oldversion < 2005081601) { - modify_database('','CREATE TABLE prefix_course_allowed_modules ( - id SERIAL PRIMARY KEY, - course INTEGER NOT NULL default 0, - module INTEGER NOT NULL default 0 - );'); - - modify_database('','CREATE INDEX prefix_course_allowed_modules_course_idx ON prefix_course_allowed_modules (course);'); - modify_database('','CREATE INDEX prefix_course_allowed_modules_module_idx ON prefix_course_allowed_modules (module);'); - table_column('course','','restrictmodules','int','1','','0','not null'); - } - - if ($oldversion < 2005081700) { - table_column('course_categories','','depth','integer'); - table_column('course_categories','','path','varchar','255'); - } - - if ($oldversion < 2005090100) { // stats! - modify_database('','CREATE TABLE prefix_stats_daily ( - id SERIAL PRIMARY KEY, - courseid INTEGER NOT NULL default 0, - timeend INTEGER NOT NULL default 0, - students INTEGER NOT NULL default 0, - teachers INTEGER NOT NULL default 0, - activestudents INTEGER NOT NULL default 0, - activeteachers INTEGER NOT NULL default 0, - studentreads INTEGER NOT NULL default 0, - studentwrites INTEGER NOT NULL default 0, - teacherreads INTEGER NOT NULL default 0, - teacherwrites INTEGER NOT NULL default 0, - logins INTEGER NOT NULL default 0, - uniquelogins INTEGER NOT NULL default 0 - );'); - - modify_database('','CREATE INDEX prefix_stats_daily_courseid_idx ON prefix_stats_daily (courseid);'); - modify_database('','CREATE INDEX prefix_stats_daily_timeend_idx ON prefix_stats_daily (timeend);'); - - modify_database('','CREATE TABLE prefix_stats_weekly ( - id SERIAL PRIMARY KEY, - courseid INTEGER NOT NULL default 0, - timeend INTEGER NOT NULL default 0, - students INTEGER NOT NULL default 0, - teachers INTEGER NOT NULL default 0, - activestudents INTEGER NOT NULL default 0, - activeteachers INTEGER NOT NULL default 0, - studentreads INTEGER NOT NULL default 0, - studentwrites INTEGER NOT NULL default 0, - teacherreads INTEGER NOT NULL default 0, - teacherwrites INTEGER NOT NULL default 0, - logins INTEGER NOT NULL default 0, - uniquelogins INTEGER NOT NULL default 0 - );'); - - modify_database('','CREATE INDEX prefix_stats_weekly_courseid_idx ON prefix_stats_weekly (courseid);'); - modify_database('','CREATE INDEX prefix_stats_weekly_timeend_idx ON prefix_stats_weekly (timeend);'); - - modify_database('','CREATE TABLE prefix_stats_monthly ( - id SERIAL PRIMARY KEY, - courseid INTEGER NOT NULL default 0, - timeend INTEGER NOT NULL default 0, - students INTEGER NOT NULL default 0, - teachers INTEGER NOT NULL default 0, - activestudents INTEGER NOT NULL default 0, - activeteachers INTEGER NOT NULL default 0, - studentreads INTEGER NOT NULL default 0, - studentwrites INTEGER NOT NULL default 0, - teacherreads INTEGER NOT NULL default 0, - teacherwrites INTEGER NOT NULL default 0, - logins INTEGER NOT NULL default 0, - uniquelogins INTEGER NOT NULL default 0 - );'); - - modify_database('','CREATE INDEX prefix_stats_monthly_courseid_idx ON prefix_stats_monthly (courseid);'); - modify_database('','CREATE INDEX prefix_stats_monthly_timeend_idx ON prefix_stats_monthly (timeend);'); - - modify_database("","CREATE TABLE prefix_stats_user_daily ( - id SERIAL PRIMARY KEY, - courseid INTEGER NOT NULL default 0, - userid INTEGER NOT NULL default 0, - roleid INTEGER NOT NULL default 0, - timeend INTEGER NOT NULL default 0, - statsreads INTEGER NOT NULL default 0, - statswrites INTEGER NOT NULL default 0, - stattype varchar(30) NOT NULL default '' - );"); - - modify_database("","CREATE INDEX prefix_stats_user_daily_courseid_idx ON prefix_stats_user_daily (courseid);"); - modify_database("","CREATE INDEX prefix_stats_user_daily_userid_idx ON prefix_stats_user_daily (userid);"); - modify_database("","CREATE INDEX prefix_stats_user_daily_roleid_idx ON prefix_stats_user_daily (roleid);"); - modify_database("","CREATE INDEX prefix_stats_user_daily_timeend_idx ON prefix_stats_user_daily (timeend);"); - - modify_database("","CREATE TABLE prefix_stats_user_weekly ( - id SERIAL PRIMARY KEY, - courseid INTEGER NOT NULL default 0, - userid INTEGER NOT NULL default 0, - roleid INTEGER NOT NULL default 0, - timeend INTEGER NOT NULL default 0, - statsreads INTEGER NOT NULL default 0, - statswrites INTEGER NOT NULL default 0, - stattype varchar(30) NOT NULL default '' - );"); - - modify_database("","CREATE INDEX prefix_stats_user_weekly_courseid_idx ON prefix_stats_user_weekly (courseid);"); - modify_database("","CREATE INDEX prefix_stats_user_weekly_userid_idx ON prefix_stats_user_weekly (userid);"); - modify_database("","CREATE INDEX prefix_stats_user_weekly_roleid_idx ON prefix_stats_user_weekly (roleid);"); - modify_database("","CREATE INDEX prefix_stats_user_weekly_timeend_idx ON prefix_stats_user_weekly (timeend);"); - - modify_database("","CREATE TABLE prefix_stats_user_monthly ( - id SERIAL PRIMARY KEY, - courseid INTEGER NOT NULL default 0, - userid INTEGER NOT NULL default 0, - roleid INTEGER NOT NULL default 0, - timeend INTEGER NOT NULL default 0, - statsreads INTEGER NOT NULL default 0, - statswrites INTEGER NOT NULL default 0, - stattype varchar(30) NOT NULL default '' - );"); - - modify_database("","CREATE INDEX prefix_stats_user_monthly_courseid_idx ON prefix_stats_user_monthly (courseid);"); - modify_database("","CREATE INDEX prefix_stats_user_monthly_userid_idx ON prefix_stats_user_monthly (userid);"); - modify_database("","CREATE INDEX prefix_stats_user_monthly_roleid_idx ON prefix_stats_user_monthly (roleid);"); - modify_database("","CREATE INDEX prefix_stats_user_monthly_timeend_idx ON prefix_stats_user_monthly (timeend);"); - } - - if ($oldversion < 2005100300) { - table_column('course','','expirynotify','integer','1'); - table_column('course','','expirythreshold','integer'); - table_column('course','','notifystudents','integer','1'); - $new = new stdClass(); - $new->name = 'lastexpirynotify'; - $new->value = 0; - insert_record('config', $new); - } - - if ($oldversion < 2005100400) { - table_column('course','','enrollable','integer','1','unsigned','1'); - table_column('course','','enrolstartdate','integer'); - table_column('course','','enrolenddate','integer'); - } - - - if ($oldversion < 2005101200) { // add enrolment key to course_request. - table_column('course_request','','password','text'); - } - - if ($oldversion < 2006030800) { # add extra indexes to log (see bug #4112) - modify_database('',"CREATE INDEX prefix_log_userid_idx ON prefix_log (userid);"); - modify_database('',"CREATE INDEX prefix_log_info_idx ON prefix_log (info);"); - } - - if ($oldversion < 2006030900) { - table_column('course','','enrol','varchar','20','',''); - - if ($CFG->enrol == 'internal' || $CFG->enrol == 'manual') { - set_config('enrol_plugins_enabled', 'manual'); - set_config('enrol', 'manual'); - } else { - set_config('enrol_plugins_enabled', 'manual,'.$CFG->enrol); - } - - require_once("$CFG->dirroot/enrol/enrol.class.php"); - $defaultenrol = enrolment_factory::factory($CFG->enrol); - if (!method_exists($defaultenrol, 'print_entry')) { // switch enrollable to off for all courses in this case - modify_database('', 'UPDATE prefix_course SET enrollable = 0'); - } - - execute_sql("UPDATE {$CFG->prefix}user_students SET enrol='manual' WHERE enrol='' OR enrol='internal'"); - execute_sql("UPDATE {$CFG->prefix}user_teachers SET enrol='manual' WHERE enrol=''"); - - } - - if ($oldversion < 2006031000) { - - modify_database("","CREATE TABLE prefix_post ( - id SERIAL PRIMARY KEY, - userid INTEGER NOT NULL default 0, - courseid INTEGER NOT NULL default 0, - groupid INTEGER NOT NULL default 0, - moduleid INTEGER NOT NULL default 0, - coursemoduleid INTEGER NOT NULL default 0, - subject varchar(128) NOT NULL default '', - summary text, - content text, - uniquehash varchar(128) NOT NULL default '', - rating INTEGER NOT NULL default 0, - format INTEGER NOT NULL default 0, - publishstate varchar(10) CHECK (publishstate IN ('draft','site','public')) NOT NULL default 'draft', - lastmodified INTEGER NOT NULL default '0', - created INTEGER NOT NULL default '0' - );"); - - modify_database("","CREATE INDEX id_user_idx ON prefix_post (id, courseid);"); - modify_database("","CREATE INDEX post_lastmodified_idx ON prefix_post (lastmodified);"); - modify_database("","CREATE INDEX post_subject_idx ON prefix_post (subject);"); - - modify_database("","CREATE TABLE prefix_tags ( - id SERIAL PRIMARY KEY, - type varchar(255) NOT NULL default 'official', - userid INTEGER NOT NULL default 0, - text varchar(255) NOT NULL default '' - );"); - - modify_database("","CREATE TABLE prefix_blog_tag_instance ( - id SERIAL PRIMARY KEY, - entryid integer NOT NULL default 0, - tagid integer NOT NULL default 0, - groupid integer NOT NULL default 0, - courseid integer NOT NULL default 0, - userid integer NOT NULL default 0 - );"); - } - - if ($oldversion < 2006031400) { - require_once("$CFG->dirroot/enrol/enrol.class.php"); - $defaultenrol = enrolment_factory::factory($CFG->enrol); - if (!method_exists($defaultenrol, 'print_entry')) { - set_config('enrol', 'manual'); - } - } - - if ($oldversion < 2006032000) { - table_column('post','','module','varchar','20','','','not null', 'id'); - modify_database('',"CREATE INDEX post_module_idx ON prefix_post (module);"); - modify_database('',"UPDATE prefix_post SET module = 'blog';"); - } - - if ($oldversion < 2006032001) { - table_column('blog_tag_instance','','timemodified','integer','10','unsigned','0','not null', 'userid'); - modify_database('',"CREATE INDEX bti_entryid_idx ON prefix_blog_tag_instance (entryid);"); - modify_database('',"CREATE INDEX bti_tagid_idx ON prefix_blog_tag_instance (tagid);"); - modify_database('',"UPDATE prefix_blog_tag_instance SET timemodified = '".time()."';"); - } - - if ($oldversion < 2006040500) { // Add an index to course_sections that was never upgraded (bug 5100) - execute_sql(" CREATE INDEX {$CFG->prefix}course_sections_coursesection_idx ON {$CFG->prefix}course_sections (course,section) ", false); - } - - if ($oldversion < 2006041100) { - table_column('course_modules','','visibleold','integer','1','unsigned','1','not null', 'visible'); - } - - if ($oldversion < 2006042400) { - // Look through table log_display and get rid of duplicates. - $rs = get_recordset_sql('SELECT DISTINCT * FROM '.$CFG->prefix.'log_display'); - - // Drop the log_display table and create it back with an id field. - execute_sql("DROP TABLE {$CFG->prefix}log_display", false); - - modify_database('', "CREATE TABLE prefix_log_display ( - id SERIAL PRIMARY KEY, - module varchar(30) NOT NULL default '', - action varchar(40) NOT NULL default '', - mtable varchar(30) NOT NULL default '', - field varchar(50) NOT NULL default '')"); - - // Add index to ensure that module and action combination is unique. - modify_database('', 'CREATE INDEX prefix_log_display_moduleaction ON prefix_log_display (module,action)'); - - // Insert the records back in, sans duplicates. - if ($rs) { - while (!$rs->EOF) { - $sql = "INSERT INTO {$CFG->prefix}log_display ". - "VALUES('', '".$rs->fields['module']."', ". - "'".$rs->fields['action']."', ". - "'".$rs->fields['mtable']."', ". - "'".$rs->fields['field']."')"; - - execute_sql($sql, false); - $rs->MoveNext(); - } - rs_close($rs); - } - } - - // add 2 indexes to tags table - if ($oldversion < 2006042401) { - modify_database('',"CREATE INDEX tags_typeuserid_idx ON prefix_tags (type, userid);"); - modify_database('',"CREATE INDEX tags_text_idx ON prefix_tags (text);"); - } - - if ($oldversion < 2006050500) { - table_column('log', 'action', 'action', 'varchar', '40', '', '', 'not null'); - } - - if ($oldversion < 2006050502) { // Close down the Dialogue module, we are removing it from CVS. - if (!file_exists($CFG->dirroot.'/mod/dialogue/lib.php')) { - if (!count_records('dialogue_conversations')) { // no data, drop the extra tables - execute_sql('DROP TABLE '.$CFG->prefix.'dialogue_conversations', false); - execute_sql('DROP TABLE '.$CFG->prefix.'dialogue_entries', false); - notify("The Dialogue module has been discontinued and removed from your site. - You weren't using it anyway. ;-)"); - } - } - - table_column('course_request', 'password', 'password', 'varchar', '50', '', ''); - - table_column('course', 'currency', 'currency', 'varchar', '3'); - - modify_database('', 'ALTER TABLE prefix_course_categories - ALTER COLUMN path SET DEFAULT \'\''); - - table_column('log_display', 'module', 'module', 'varchar', '20'); - - modify_database("","DROP INDEX id_user_idx"); - modify_database("","DROP INDEX post_lastmodified_idx"); - modify_database("","DROP INDEX post_subject_idx"); - modify_database('',"DROP INDEX bti_entryid_idx"); - modify_database('',"DROP INDEX bti_tagid_idx"); - modify_database('',"DROP INDEX post_module_idx"); - modify_database('',"DROP INDEX tags_typeuserid_idx"); - modify_database('',"DROP INDEX tags_text_idx"); - - modify_database("","CREATE INDEX {$CFG->prefix}id_user_idx ON prefix_post (id, courseid);"); - modify_database("","CREATE INDEX {$CFG->prefix}post_lastmodified_idx ON prefix_post (lastmodified);"); - modify_database("","CREATE INDEX {$CFG->prefix}post_subject_idx ON prefix_post (subject);"); - modify_database('',"CREATE INDEX {$CFG->prefix}bti_entryid_idx ON prefix_blog_tag_instance (entryid);"); - modify_database('',"CREATE INDEX {$CFG->prefix}bti_tagid_idx ON prefix_blog_tag_instance (tagid);"); - modify_database('',"CREATE INDEX {$CFG->prefix}post_module_idx ON prefix_post (moduleid);"); - modify_database('',"CREATE INDEX {$CFG->prefix}tags_typeuserid_idx ON prefix_tags (type, userid);"); - modify_database('',"CREATE INDEX {$CFG->prefix}tags_text_idx ON prefix_tags (text);"); - - } - - // renaming of reads and writes for stats_user_xyz - if ($oldversion < 2006052400) { // change this later - - // we are using this because we want silent updates - - execute_sql("ALTER TABLE {$CFG->prefix}stats_user_daily RENAME COLUMN reads TO statsreads", false); - execute_sql("ALTER TABLE {$CFG->prefix}stats_user_daily RENAME COLUMN writes TO statswrites", false); - execute_sql("ALTER TABLE {$CFG->prefix}stats_user_weekly RENAME COLUMN reads TO statsreads", false); - execute_sql("ALTER TABLE {$CFG->prefix}stats_user_weekly RENAME COLUMN writes TO statswrites", false); - execute_sql("ALTER TABLE {$CFG->prefix}stats_user_monthly RENAME COLUMN reads TO statsreads", false); - execute_sql("ALTER TABLE {$CFG->prefix}stats_user_monthly RENAME COLUMN writes TO statswrites", false); - - } - - // Adding some missing log actions - if ($oldversion < 2006060400) { - // But only if they doesn't exist (because this was introduced after branch and we could be duplicating!) - if (!record_exists('log_display', 'module', 'course', 'action', 'report log')) { - execute_sql("INSERT INTO {$CFG->prefix}log_display (module, action, mtable, field) VALUES ('course', 'report log', 'course', 'fullname')"); - } - if (!record_exists('log_display', 'module', 'course', 'action', 'report live')) { - execute_sql("INSERT INTO {$CFG->prefix}log_display (module, action, mtable, field) VALUES ('course', 'report live', 'course', 'fullname')"); - } - if (!record_exists('log_display', 'module', 'course', 'action', 'report outline')) { - execute_sql("INSERT INTO {$CFG->prefix}log_display (module, action, mtable, field) VALUES ('course', 'report outline', 'course', 'fullname')"); - } - if (!record_exists('log_display', 'module', 'course', 'action', 'report participation')) { - execute_sql("INSERT INTO {$CFG->prefix}log_display (module, action, mtable, field) VALUES ('course', 'report participation', 'course', 'fullname')"); - } - if (!record_exists('log_display', 'module', 'course', 'action', 'report stats')) { - execute_sql("INSERT INTO {$CFG->prefix}log_display (module, action, mtable, field) VALUES ('course', 'report stats', 'course', 'fullname')"); - } - } - - //Renaming lastIP to lastip (all fields lowercase) - if ($oldversion < 2006060900) { - //Not needed unded PG because it stores fieldnames lowecase by default - //Only if it exists (because MOODLE_16_STABLE could have done this work before. Bug 5763) - //$fields = $db->MetaColumnNames($CFG->prefix.'user'); - //if (in_array('lastIP',$fields)) { - // table_column("user", "lastIP", "lastip", "varchar", "15", "", "", "", "currentlogin"); - //} - } - - - if ($oldversion < 2006080400) { - modify_database('', "CREATE TABLE prefix_role ( - id SERIAL PRIMARY KEY, - name varchar(255) NOT NULL default '', - shortname varchar(100) NOT NULL default '', - description text NOT NULL default '', - sortorder integer NOT NULL default '0' - );"); - - modify_database('', "CREATE TABLE prefix_context ( - id SERIAL PRIMARY KEY, - level integer NOT NULL default 0, - instanceid integer NOT NULL default 0 - );"); - - - modify_database('', "CREATE TABLE prefix_role_assignments ( - id SERIAL PRIMARY KEY, - roleid integer NOT NULL default 0, - contextid integer NOT NULL default 0, - userid integer NOT NULL default 0, - hidden integer NOT NULL default 0, - timestart integer NOT NULL default 0, - timeend integer NOT NULL default 0, - timemodified integer NOT NULL default 0, - modifierid integer NOT NULL default 0, - enrol varchar(20) NOT NULL default '', - sortorder integer NOT NULL default '0' - );"); - - modify_database('', "CREATE TABLE prefix_role_capabilities ( - id SERIAL PRIMARY KEY, - contextid integer NOT NULL default 0, - roleid integer NOT NULL default 0, - capability varchar(255) NOT NULL default '', - permission integer NOT NULL default 0, - timemodified integer NOT NULL default 0, - modifierid integer NOT NULL default 0 - );"); - - modify_database('', "CREATE TABLE prefix_role_deny_grant ( - id SERIAL PRIMARY KEY, - roleid integer NOT NULL default '0', - unviewableroleid integer NOT NULL default '0' - );"); - - modify_database('', "CREATE TABLE prefix_capabilities ( - id SERIAL PRIMARY KEY, - name varchar(255) NOT NULL default '', - captype varchar(50) NOT NULL default '', - contextlevel integer NOT NULL default 0, - component varchar(100) NOT NULL default '' - );"); - - modify_database('', "CREATE TABLE prefix_role_names ( - id SERIAL PRIMARY KEY, - roleid integer NOT NULL default 0, - contextid integer NOT NULL default 0, - text text NOT NULL default '' - );"); - - } - - if ($oldversion < 2006081000) { - modify_database('',"CREATE INDEX prefix_role_sortorder_idx ON prefix_role (sortorder);"); - modify_database('',"CREATE INDEX prefix_context_instanceid_idx ON prefix_context (instanceid);"); - modify_database('',"CREATE UNIQUE INDEX prefix_context_levelinstanceid_idx ON prefix_context (level, instanceid);"); - modify_database('',"CREATE INDEX prefix_role_assignments_roleid_idx ON prefix_role_assignments (roleid);"); - modify_database('',"CREATE INDEX prefix_role_assignments_contextidid_idx ON prefix_role_assignments (contextid);"); - modify_database('',"CREATE INDEX prefix_role_assignments_userid_idx ON prefix_role_assignments (userid);"); - modify_database('',"CREATE UNIQUE INDEX prefix_role_assignments_contextidroleiduserid_idx ON prefix_role_assignments (contextid, roleid, userid);"); - modify_database('',"CREATE INDEX prefix_role_assignments_sortorder_idx ON prefix_role_assignments (sortorder);"); - modify_database('',"CREATE INDEX prefix_role_capabilities_roleid_idx ON prefix_role_capabilities (roleid);"); - modify_database('',"CREATE INDEX prefix_role_capabilities_contextid_idx ON prefix_role_capabilities (contextid);"); - modify_database('',"CREATE INDEX prefix_role_capabilities_modifierid_idx ON prefix_role_capabilities (modifierid);"); - // MDL-10640 adding missing index from upgrade - modify_database('',"CREATE INDEX prefix_role_capabilities_capability_idx ON prefix_role_capabilities (capability);"); - modify_database('',"CREATE UNIQUE INDEX prefix_role_capabilities_roleidcontextidcapability_idx ON prefix_role_capabilities (roleid, contextid, capability);"); - modify_database('',"CREATE INDEX prefix_role_deny_grant_roleid_idx ON prefix_role_deny_grant (roleid);"); - modify_database('',"CREATE INDEX prefix_role_deny_grant_unviewableroleid_idx ON prefix_role_deny_grant (unviewableroleid);"); - modify_database('',"CREATE UNIQUE INDEX prefix_role_deny_grant_roleidunviewableroleid_idx ON prefix_role_deny_grant (roleid, unviewableroleid);"); - modify_database('',"CREATE UNIQUE INDEX prefix_capabilities_name_idx ON prefix_capabilities (name);"); - modify_database('',"CREATE INDEX prefix_role_names_roleid_idx ON prefix_role_names (roleid);"); - modify_database('',"CREATE INDEX prefix_role_names_contextid_idx ON prefix_role_names (contextid);"); - modify_database('',"CREATE UNIQUE INDEX prefix_role_names_roleidcontextid_idx ON prefix_role_names (roleid, contextid);"); - } - - if ($oldversion < 2006081700) { - modify_database('',"DROP TABLE prefix_role_deny_grant"); - - modify_database('',"CREATE TABLE prefix_role_allow_assign ( - id SERIAL PRIMARY KEY, - roleid integer NOT NULL default '0', - allowassign integer NOT NULL default '0' - );"); - - modify_database('',"CREATE INDEX prefix_role_allow_assign_roleid_idx ON prefix_role_allow_assign (roleid);"); - modify_database('',"CREATE INDEX prefix_role_allow_assign_allowassign_idx ON prefix_role_allow_assign (allowassign);"); - modify_database('',"CREATE UNIQUE INDEX prefix_role_allow_assign_roleidallowassign_idx ON prefix_role_allow_assign (roleid, allowassign);"); - - modify_database('',"CREATE TABLE prefix_role_allow_override ( - id SERIAL PRIMARY KEY, - roleid integer NOT NULL default '0', - allowoverride integer NOT NULL default '0' - );"); - - modify_database('',"CREATE INDEX prefix_role_allow_override_roleid_idx ON prefix_role_allow_override (roleid);"); - modify_database('',"CREATE INDEX prefix_role_allow_override_allowoverride_idx ON prefix_role_allow_override (allowoverride);"); - modify_database('',"CREATE UNIQUE INDEX prefix_role_allow_override_roleidallowoverride_idx ON prefix_role_allow_override (roleid, allowoverride);"); - - } - - if ($oldversion < 2006082100) { - execute_sql("DROP INDEX {$CFG->prefix}context_levelinstanceid_idx;",false); - table_column('context', 'level', 'aggregatelevel', 'integer', '10', 'unsigned', '0', 'not null', ''); - modify_database('',"CREATE UNIQUE INDEX prefix_context_aggregatelevelinstanceid_idx ON prefix_context (aggregatelevel, instanceid);"); - } - - if ($oldversion < 2006082200) { - table_column('timezone', 'rule', 'tzrule', 'varchar', '20', '', '', 'not null', ''); - } - - if ($oldversion < 2006082800) { - table_column('user', '', 'ajax', 'integer', '1', 'unsigned', '1', 'not null', 'htmleditor'); - } - - if ($oldversion < 2006082900) { - execute_sql("DROP TABLE {$CFG->prefix}sessions", true); - execute_sql(" - CREATE TABLE {$CFG->prefix}sessions2 ( - sesskey VARCHAR(255) NOT NULL default '', - expiry TIMESTAMP NOT NULL, - expireref VARCHAR(255), - created TIMESTAMP NOT NULL, - modified TIMESTAMP NOT NULL, - sessdata TEXT, - CONSTRAINT {$CFG->prefix}sess_ses_pk PRIMARY KEY (sesskey) - );", true); - - execute_sql(" - CREATE INDEX {$CFG->prefix}sess_exp_ix ON {$CFG->prefix}sessions2 (expiry);", true); - execute_sql(" - CREATE INDEX {$CFG->prefix}sess_exp2_ix ON {$CFG->prefix}sessions2 (expireref);", true); - } - - if ($oldversion < 2006083002) { - table_column('capabilities', '', 'riskbitmask', 'INTEGER', '10', 'unsigned', '0', 'not null', ''); - } - - if ($oldversion < 2006083100) { - execute_sql("ALTER TABLE {$CFG->prefix}course ALTER COLUMN modinfo DROP NOT NULL"); - execute_sql("ALTER TABLE {$CFG->prefix}course ALTER COLUMN modinfo DROP DEFAULT"); - } - - if ($oldversion < 2006083101) { - execute_sql("ALTER TABLE {$CFG->prefix}course_categories ALTER COLUMN description DROP NOT NULL"); - execute_sql("ALTER TABLE {$CFG->prefix}course_categories ALTER COLUMN description DROP DEFAULT"); - } - - if ($oldversion < 2006083102) { - execute_sql("ALTER TABLE {$CFG->prefix}user ALTER COLUMN description DROP NOT NULL"); - execute_sql("ALTER TABLE {$CFG->prefix}user ALTER COLUMN description DROP DEFAULT"); - } - - if ($oldversion < 2006090200) { - execute_sql("ALTER TABLE {$CFG->prefix}course_sections ALTER COLUMN summary DROP NOT NULL"); - execute_sql("ALTER TABLE {$CFG->prefix}course_sections ALTER COLUMN summary DROP DEFAULT"); - execute_sql("ALTER TABLE {$CFG->prefix}course_sections ALTER COLUMN sequence DROP NOT NULL"); - execute_sql("ALTER TABLE {$CFG->prefix}course_sections ALTER COLUMN sequence DROP DEFAULT"); - } - - // table to keep track of course page access times, used in online participants block, and participants list - if ($oldversion < 2006091200) { - execute_sql("CREATE TABLE {$CFG->prefix}user_lastaccess ( - id SERIAL PRIMARY KEY, - userid integer NOT NULL default 0, - courseid integer NOT NULL default 0, - timeaccess integer NOT NULL default 0 - );", true); - - execute_sql("CREATE INDEX {$CFG->prefix}user_lastaccess_userid_idx ON {$CFG->prefix}user_lastaccess (userid);", true); - execute_sql("CREATE INDEX {$CFG->prefix}user_lastaccess_courseid_idx ON {$CFG->prefix}user_lastaccess (courseid);", true); - execute_sql("CREATE UNIQUE INDEX {$CFG->prefix}user_lastaccess_useridcourseid_idx ON {$CFG->prefix}user_lastaccess (userid, courseid);", true); - - } - - if (!empty($CFG->rolesactive) and $oldversion < 2006091212) { // Reload the guest roles completely with new defaults - if ($guestroles = get_roles_with_capability('moodle/legacy:guest', CAP_ALLOW)) { - delete_records('capabilities'); - $sitecontext = get_context_instance(CONTEXT_SYSTEM); - foreach ($guestroles as $guestrole) { - delete_records('role_capabilities', 'roleid', $guestrole->id); - assign_capability('moodle/legacy:guest', CAP_ALLOW, $guestrole->id, $sitecontext->id); - } - } - } - - if ($oldversion < 2006091700) { - table_column('course','','defaultrole','integer','10', 'unsigned', '0', 'not null'); - } - - if ($oldversion < 2006091800) { - delete_records('config', 'name', 'showsiteparticipantslist'); - delete_records('config', 'name', 'requestedteachername'); - delete_records('config', 'name', 'requestedteachersname'); - delete_records('config', 'name', 'requestedstudentname'); - delete_records('config', 'name', 'requestedstudentsname'); - } - - if (!empty($CFG->rolesactive) and $oldversion < 2006091901) { - if ($roles = get_records('role')) { - $first = array_shift($roles); - if (!empty($first->shortname)) { - // shortnames already exist - } else { - table_column('role', '', 'shortname', 'varchar', '100', '', '', 'not null', 'name'); - $legacy_names = array('admin', 'coursecreator', 'editingteacher', 'teacher', 'student', 'guest'); - foreach ($legacy_names as $name) { - if ($roles = get_roles_with_capability('moodle/legacy:'.$name, CAP_ALLOW)) { - $i = ''; - foreach ($roles as $role) { - if (empty($role->shortname)) { - $updated = new object(); - $updated->id = $role->id; - $updated->shortname = $name.$i; - update_record('role', $updated); - $i++; - } - } - } - } - } - } - } - - /// Tables for customisable user profile fields - if ($oldversion < 2006092000) { - execute_sql("CREATE TABLE {$CFG->prefix}user_info_field ( - id BIGSERIAL, - name VARCHAR(255) NOT NULL default '', - datatype VARCHAR(255) NOT NULL default '', - categoryid BIGINT NOT NULL default 0, - sortorder BIGINT NOT NULL default 0, - required SMALLINT NOT NULL default 0, - locked SMALLINT NOT NULL default 0, - visible SMALLINT NOT NULL default 0, - defaultdata TEXT, - CONSTRAINT {$CFG->prefix}userinfofiel_id_pk PRIMARY KEY (id));", true); - - execute_sql("COMMENT ON TABLE {$CFG->prefix}user_info_field IS 'Customisable user profile fields';", true); - - execute_sql("CREATE TABLE {$CFG->prefix}user_info_category ( - id BIGSERIAL, - name VARCHAR(255) NOT NULL default '', - sortorder BIGINT NOT NULL default 0, - CONSTRAINT {$CFG->prefix}userinfocate_id_pk PRIMARY KEY (id));", true); - - execute_sql("COMMENT ON TABLE {$CFG->prefix}user_info_category IS 'Customisable fields categories';", true); - - execute_sql("CREATE TABLE {$CFG->prefix}user_info_data ( - id BIGSERIAL, - userid BIGINT NOT NULL default 0, - fieldid BIGINT NOT NULL default 0, - data TEXT NOT NULL, - CONSTRAINT {$CFG->prefix}userinfodata_id_pk PRIMARY KEY (id));", true); - - execute_sql("COMMENT ON TABLE {$CFG->prefix}user_info_data IS 'Data for the customisable user fields';", true); - - } - - if ($oldversion < 2006092200) { - table_column('context', 'aggregatelevel', 'contextlevel', 'int', '10', 'unsigned', '0', 'not null', ''); -/* execute_sql("ALTER TABLE `{$CFG->prefix}context` DROP INDEX `aggregatelevel-instanceid`;",false); - execute_sql("ALTER TABLE `{$CFG->prefix}context` ADD UNIQUE INDEX `contextlevel-instanceid` (`contextlevel`, `instanceid`)",false); // see 2006092409 below */ - } - - if ($oldversion < 2006092302) { - // fix sortorder first if needed - if ($roles = get_all_roles()) { - $i = 0; - foreach ($roles as $rolex) { - if ($rolex->sortorder != $i) { - $r = new object(); - $r->id = $rolex->id; - $r->sortorder = $i; - update_record('role', $r); - } - $i++; - } - } -/* execute_sql("ALTER TABLE {$CFG->prefix}role DROP INDEX {$CFG->prefix}role_sor_ix;"); - execute_sql("ALTER TABLE {$CFG->prefix}role ADD UNIQUE INDEX {$CFG->prefix}role_sor_uix (sortorder)");*/ - } - - if ($oldversion < 2006092400) { - table_column('user', '', 'trustbitmask', 'INTEGER', '10', 'unsigned', '0', 'not null', ''); - } - - if ($oldversion < 2006092409) { - // ok, once more and now correctly! - execute_sql("DROP INDEX \"aggregatelevel-instanceid\";", false); - execute_sql("DROP INDEX \"contextlevel-instanceid\";", false); - execute_sql("CREATE UNIQUE INDEX {$CFG->prefix}cont_conins_uix ON {$CFG->prefix}context (contextlevel, instanceid);", false); - - execute_sql("DROP INDEX {$CFG->prefix}role_sor_ix;", false); - execute_sql("DROP INDEX {$CFG->prefix}role_sor_uix;", false); - execute_sql("CREATE UNIQUE INDEX {$CFG->prefix}role_sor_uix ON {$CFG->prefix}role (sortorder);", false); - } - - if ($oldversion < 2006092410) { - /// Convert all the PG unique keys into their corresponding unique indexes - /// we don't want such keys inside Moodle 1.7 and above - /// Look for all the UNIQUE CONSTRAINSTS existing in DB - $uniquecons = get_records_sql ("SELECT conname, relname, conkey, clas.oid AS tableoid - FROM pg_constraint cons, - pg_class clas - WHERE cons.contype='u' - AND cons.conrelid = clas.oid"); - /// Iterate over every unique constraint, calculating its fields - if ($uniquecons) { - foreach ($uniquecons as $uniquecon) { - $conscols = trim(trim($uniquecon->conkey, '}'), '{'); - $conscols = explode(',', $conscols); - /// Iterate over each column to fetch its name - $indexcols = array(); - foreach ($conscols as $conscol) { - $column = get_record_sql ("SELECT attname, attname - FROM pg_attribute - WHERE attrelid = $uniquecon->tableoid - AND attnum = $conscol"); - $indexcols[] = $column->attname; - } - /// Drop the old UNIQUE CONSTRAINT - execute_sql ("ALTER TABLE $uniquecon->relname DROP CONSTRAINT $uniquecon->conname", false); - /// Create the new UNIQUE INDEX - execute_sql ("CREATE UNIQUE INDEX {$uniquecon->relname}_".implode('_', $indexcols)."_uix ON $uniquecon->relname (".implode(', ', $indexcols).')', false); - } - } - } - - if ($oldversion < 2006092601) { - table_column('log_display', 'field', 'field', 'varchar', '200', '', '', 'not null', ''); - } - - ////// DO NOT ADD NEW THINGS HERE!! USE upgrade.php and the lib/ddllib.php functions. - - return $result; -} - -?> diff --git a/lib/filelib.php b/lib/filelib.php index cf7df182c54fc..4dcd092b2a808 100644 --- a/lib/filelib.php +++ b/lib/filelib.php @@ -555,7 +555,7 @@ function get_mimetype_description($mimetype,$capitalise=false) { * @param string $mimetype Include to specify the MIME type; leave blank to have it guess the type from $filename */ function send_file($path, $filename, $lifetime=86400 , $filter=0, $pathisstring=false, $forcedownload=false, $mimetype='') { - global $CFG, $COURSE; + global $CFG, $COURSE, $SESSION; // Use given MIME type if specified, otherwise guess it using mimeinfo. // IE, Konqueror and Opera open html file directly in browser from web even when directed to save it to disk :-O @@ -670,7 +670,7 @@ function send_file($path, $filename, $lifetime=86400 , $filter=0, $pathisstring= //cookieless mode - rewrite links @header('Content-Type: text/html'); $path = $pathisstring ? $path : implode('', file($path)); - $path = sid_ob_rewrite($path); + $path = $SESSION->sid_ob_rewrite($path); $filesize = strlen($path); $pathisstring = true; } else if ($mimetype == 'text/plain') { @@ -696,7 +696,7 @@ function send_file($path, $filename, $lifetime=86400 , $filter=0, $pathisstring= $output = format_text($text, FORMAT_HTML, $options, $COURSE->id); if (!empty($CFG->usesid) && empty($_COOKIE['MoodleSession'.$CFG->sessioncookie])) { //cookieless mode - rewrite links - $output = sid_ob_rewrite($output); + $output = $SESSION->sid_ob_rewrite($output); } @header('Content-Length: '.strlen($output)); @@ -712,7 +712,7 @@ function send_file($path, $filename, $lifetime=86400 , $filter=0, $pathisstring= $output = '

'. format_text($text, FORMAT_MOODLE, $options, $COURSE->id) .'
'; if (!empty($CFG->usesid) && empty($_COOKIE['MoodleSession'.$CFG->sessioncookie])) { //cookieless mode - rewrite links - $output = sid_ob_rewrite($output); + $output = $SESSION->sid_ob_rewrite($output); } @header('Content-Length: '.strlen($output)); diff --git a/lib/form/modgroupmode.php b/lib/form/modgroupmode.php deleted file mode 100644 index 6651e0f618536..0000000000000 --- a/lib/form/modgroupmode.php +++ /dev/null @@ -1,58 +0,0 @@ -libdir/form/select.php"; - -/** - * HTML class for a drop down element to select groupmode in an activity mod update form - * - * @author Jamie Pratt - * @access public - */ -class MoodleQuickForm_modgroupmode extends MoodleQuickForm_select{ - /** - * Class constructor - * - * @param string Select name attribute - * @param mixed Label(s) for the select - * @param mixed Either a typical HTML attribute string or an associative array - * @param mixed $options ignored - * @access public - * @return void - */ - function MoodleQuickForm_modgroupmode($elementName=null, $elementLabel=null, $attributes=null, $options=null) - { - HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel, $attributes, null); - $this->_type = 'modgroupmode'; - - - } //end constructor - - /** - * Called by HTML_QuickForm whenever form event is made on this element - * - * @param string $event Name of event - * @param mixed $arg event arguments - * @param object $caller calling object - * @since 1.0 - * @access public - * @return mixed - */ - function onQuickFormEvent($event, $arg, &$caller) - { - switch ($event) { - case 'createElement': - $choices = array(); - - $choices[NOGROUPS] = get_string('groupsnone'); - $choices[SEPARATEGROUPS] = get_string('groupsseparate'); - $choices[VISIBLEGROUPS] = get_string('groupsvisible'); - - $this->setHelpButton(array('groupmode', get_string('groupmode'))); - $this->load($choices); - break; - } - return parent::onQuickFormEvent($event, $arg, $caller); - } - -} -?> diff --git a/lib/form/selectallornone.php b/lib/form/selectallornone.php deleted file mode 100644 index 32e099d00f253..0000000000000 --- a/lib/form/selectallornone.php +++ /dev/null @@ -1,126 +0,0 @@ - - * @version 1.0 - * @since PHP4.04pl1 - * @access public - */ -class MoodleQuickForm_selectallornone extends HTML_QuickForm_link { - /** - * The original state of the checkboxes controlled by this element. This determines whether the first click of this element will switch them all to - * checked or to unchecked. It doesn't change the checked state of the original elements (there could be a mixed of checked/unchecked there), but - * there has to be a decision as to which action will be taken by clicking "select all/select none" the first time. - * @var int $originalValue - */ - var $_originalValue = 0; - - /** - * Constructor - * @param string $elementName The name of the group of advcheckboxes this element controls - * @param string $text The text of the link. Defaults to "select all/none" - * @param array $attributes associative array of HTML attributes - * @param int $originalValue The original general state of the checkboxes before the user first clicks this element - */ - function MoodleQuickForm_selectallornone($elementName=null, $text=null, $attributes=null, $originalValue=0) { - if (is_null($originalValue)) { - $originalValue = 0; - } - - global $FULLME; - $this->_originalValue = $originalValue; - - if (is_null($elementName)) { - return; - } - $elementLabel = ' '; - $strselectallornone = get_string('selectallornone', 'form'); - $attributes['onmouseover'] = "window.status='" . $strselectallornone . "';"; - $attributes['onmouseout'] = "window.status='';"; - $attributes['onclick'] = "html_quickform_toggle_checkboxes($elementName); return false;"; - $select_value = optional_param('select'. $elementName, $originalValue, PARAM_INT); - - if ($select_value == 0) { - $new_select_value = 1; - } else { - $new_select_value = 0; - } - - $old_selectstr = "&select$elementName=$select_value"; - $new_selectstr = "&select$elementName=$new_select_value"; - $new_fullme = str_replace($old_selectstr, '', $FULLME); - - $href = "$new_fullme$new_selectstr"; - - if (empty($text)) { - $text = $strselectallornone; - } - $this->HTML_QuickForm_link($elementName, $elementLabel, $href, $text, $attributes); - } - - function toHtml() { - if (is_null($this->_originalValue)) { - return false; - } - - $group = $this->_attributes['name']; - if ($this->_flagFrozen) { - $js = ''; - } else { - $js = ""; - } - return $js . parent::toHtml(); - } -} -?> diff --git a/lib/grade/lib_wrapper.php b/lib/grade/lib_wrapper.php deleted file mode 100644 index d566388a88e17..0000000000000 --- a/lib/grade/lib_wrapper.php +++ /dev/null @@ -1,125 +0,0 @@ - diff --git a/lib/javascript-mod.php b/lib/javascript-mod.php index 35e59eff067f6..22dc0cb4b39a5 100644 --- a/lib/javascript-mod.php +++ b/lib/javascript-mod.php @@ -3,7 +3,7 @@ /// Searches modules, filters and blocks for any Javascript files /// that should be called on every page - $nomoodlecookie = true; + define('NO_MOODLE_COOKIES', true); include('../config.php'); diff --git a/lib/pear/System.php b/lib/pear/System.php deleted file mode 100644 index 7289016da52a6..0000000000000 --- a/lib/pear/System.php +++ /dev/null @@ -1,540 +0,0 @@ - | -// +----------------------------------------------------------------------+ -// -// $Id$ -// - -require_once 'PEAR.php'; -require_once 'Console/Getopt.php'; - -$GLOBALS['_System_temp_files'] = array(); - -/** -* System offers cross plattform compatible system functions -* -* Static functions for different operations. Should work under -* Unix and Windows. The names and usage has been taken from its respectively -* GNU commands. The functions will return (bool) false on error and will -* trigger the error with the PHP trigger_error() function (you can silence -* the error by prefixing a '@' sign after the function call). -* -* Documentation on this class you can find in: -* http://pear.php.net/manual/ -* -* Example usage: -* if (!@System::rm('-r file1 dir1')) { -* print "could not delete file1 or dir1"; -* } -* -* In case you need to to pass file names with spaces, -* pass the params as an array: -* -* System::rm(array('-r', $file1, $dir1)); -* -* @package System -* @author Tomas V.V.Cox -* @version $Revision$ -* @access public -* @see http://pear.php.net/manual/ -*/ -class System -{ - /** - * returns the commandline arguments of a function - * - * @param string $argv the commandline - * @param string $short_options the allowed option short-tags - * @param string $long_options the allowed option long-tags - * @return array the given options and there values - * @access private - */ - function _parseArgs($argv, $short_options, $long_options = null) - { - if (!is_array($argv) && $argv !== null) { - $argv = preg_split('/\s+/', $argv); - } - return Console_Getopt::getopt2($argv, $short_options); - } - - /** - * Output errors with PHP trigger_error(). You can silence the errors - * with prefixing a "@" sign to the function call: @System::mkdir(..); - * - * @param mixed $error a PEAR error or a string with the error message - * @return bool false - * @access private - */ - function raiseError($error) - { - if (PEAR::isError($error)) { - $error = $error->getMessage(); - } - trigger_error($error, E_USER_WARNING); - return false; - } - - /** - * Creates a nested array representing the structure of a directory - * - * System::_dirToStruct('dir1', 0) => - * Array - * ( - * [dirs] => Array - * ( - * [0] => dir1 - * ) - * - * [files] => Array - * ( - * [0] => dir1/file2 - * [1] => dir1/file3 - * ) - * ) - * @param string $sPath Name of the directory - * @param integer $maxinst max. deep of the lookup - * @param integer $aktinst starting deep of the lookup - * @return array the structure of the dir - * @access private - */ - - function _dirToStruct($sPath, $maxinst, $aktinst = 0) - { - $struct = array('dirs' => array(), 'files' => array()); - if (($dir = @opendir($sPath)) === false) { - System::raiseError("Could not open dir $sPath"); - return $struct; // XXX could not open error - } - $struct['dirs'][] = $sPath; // XXX don't add if '.' or '..' ? - $list = array(); - while ($file = readdir($dir)) { - if ($file != '.' && $file != '..') { - $list[] = $file; - } - } - closedir($dir); - sort($list); - if ($aktinst < $maxinst || $maxinst == 0) { - foreach($list as $val) { - $path = $sPath . DIRECTORY_SEPARATOR . $val; - if (is_dir($path)) { - $tmp = System::_dirToStruct($path, $maxinst, $aktinst+1); - $struct = array_merge_recursive($tmp, $struct); - } else { - $struct['files'][] = $path; - } - } - } - return $struct; - } - - /** - * Creates a nested array representing the structure of a directory and files - * - * @param array $files Array listing files and dirs - * @return array - * @see System::_dirToStruct() - */ - function _multipleToStruct($files) - { - $struct = array('dirs' => array(), 'files' => array()); - settype($files, 'array'); - foreach ($files as $file) { - if (is_dir($file)) { - $tmp = System::_dirToStruct($file, 0); - $struct = array_merge_recursive($tmp, $struct); - } else { - $struct['files'][] = $file; - } - } - return $struct; - } - - /** - * The rm command for removing files. - * Supports multiple files and dirs and also recursive deletes - * - * @param string $args the arguments for rm - * @return mixed PEAR_Error or true for success - * @access public - */ - function rm($args) - { - $opts = System::_parseArgs($args, 'rf'); // "f" do nothing but like it :-) - if (PEAR::isError($opts)) { - return System::raiseError($opts); - } - foreach($opts[0] as $opt) { - if ($opt[0] == 'r') { - $do_recursive = true; - } - } - $ret = true; - if (isset($do_recursive)) { - $struct = System::_multipleToStruct($opts[1]); - foreach($struct['files'] as $file) { - if (!@unlink($file)) { - $ret = false; - } - } - foreach($struct['dirs'] as $dir) { - if (!@rmdir($dir)) { - $ret = false; - } - } - } else { - foreach ($opts[1] as $file) { - $delete = (is_dir($file)) ? 'rmdir' : 'unlink'; - if (!@$delete($file)) { - $ret = false; - } - } - } - return $ret; - } - - /** - * Make directories. Note that we use call_user_func('mkdir') to avoid - * a problem with ZE2 calling System::mkDir instead of the native PHP func. - * - * @param string $args the name of the director(y|ies) to create - * @return bool True for success - * @access public - */ - function mkDir($args) - { - $opts = System::_parseArgs($args, 'pm:'); - if (PEAR::isError($opts)) { - return System::raiseError($opts); - } - $mode = 0777; // default mode - foreach($opts[0] as $opt) { - if ($opt[0] == 'p') { - $create_parents = true; - } elseif($opt[0] == 'm') { - // if the mode is clearly an octal number (starts with 0) - // convert it to decimal - if (strlen($opt[1]) && $opt[1]{0} == '0') { - $opt[1] = octdec($opt[1]); - } else { - // convert to int - $opt[1] += 0; - } - $mode = $opt[1]; - } - } - $ret = true; - if (isset($create_parents)) { - foreach($opts[1] as $dir) { - $dirstack = array(); - while (!@is_dir($dir) && $dir != DIRECTORY_SEPARATOR) { - array_unshift($dirstack, $dir); - $dir = dirname($dir); - } - while ($newdir = array_shift($dirstack)) { - if (!call_user_func('mkdir', $newdir, $mode)) { - $ret = false; - } - } - } - } else { - foreach($opts[1] as $dir) { - if (!@is_dir($dir) && !call_user_func('mkdir', $dir, $mode)) { - $ret = false; - } - } - } - return $ret; - } - - /** - * Concatenate files - * - * Usage: - * 1) $var = System::cat('sample.txt test.txt'); - * 2) System::cat('sample.txt test.txt > final.txt'); - * 3) System::cat('sample.txt test.txt >> final.txt'); - * - * Note: as the class use fopen, urls should work also (test that) - * - * @param string $args the arguments - * @return boolean true on success - * @access public - */ - function &cat($args) - { - $ret = null; - $files = array(); - if (!is_array($args)) { - $args = preg_split('/\s+/', $args); - } - for($i=0; $i < count($args); $i++) { - if ($args[$i] == '>') { - $mode = 'wb'; - $outputfile = $args[$i+1]; - break; - } elseif ($args[$i] == '>>') { - $mode = 'ab+'; - $outputfile = $args[$i+1]; - break; - } else { - $files[] = $args[$i]; - } - } - if (isset($mode)) { - if (!$outputfd = fopen($outputfile, $mode)) { - $err = System::raiseError("Could not open $outputfile"); - return $err; - } - $ret = true; - } - foreach ($files as $file) { - if (!$fd = fopen($file, 'r')) { - System::raiseError("Could not open $file"); - continue; - } - while ($cont = fread($fd, 2048)) { - if (isset($outputfd)) { - fwrite($outputfd, $cont); - } else { - $ret .= $cont; - } - } - fclose($fd); - } - if (@is_resource($outputfd)) { - fclose($outputfd); - } - return $ret; - } - - /** - * Creates temporary files or directories. This function will remove - * the created files when the scripts finish its execution. - * - * Usage: - * 1) $tempfile = System::mktemp("prefix"); - * 2) $tempdir = System::mktemp("-d prefix"); - * 3) $tempfile = System::mktemp(); - * 4) $tempfile = System::mktemp("-t /var/tmp prefix"); - * - * prefix -> The string that will be prepended to the temp name - * (defaults to "tmp"). - * -d -> A temporary dir will be created instead of a file. - * -t -> The target dir where the temporary (file|dir) will be created. If - * this param is missing by default the env vars TMP on Windows or - * TMPDIR in Unix will be used. If these vars are also missing - * c:\windows\temp or /tmp will be used. - * - * @param string $args The arguments - * @return mixed the full path of the created (file|dir) or false - * @see System::tmpdir() - * @access public - */ - function mktemp($args = null) - { - static $first_time = true; - $opts = System::_parseArgs($args, 't:d'); - if (PEAR::isError($opts)) { - return System::raiseError($opts); - } - foreach($opts[0] as $opt) { - if($opt[0] == 'd') { - $tmp_is_dir = true; - } elseif($opt[0] == 't') { - $tmpdir = $opt[1]; - } - } - $prefix = (isset($opts[1][0])) ? $opts[1][0] : 'tmp'; - if (!isset($tmpdir)) { - $tmpdir = System::tmpdir(); - } - if (!System::mkDir("-p $tmpdir")) { - return false; - } - $tmp = tempnam($tmpdir, $prefix); - if (isset($tmp_is_dir)) { - unlink($tmp); // be careful possible race condition here - if (!call_user_func('mkdir', $tmp, 0700)) { - return System::raiseError("Unable to create temporary directory $tmpdir"); - } - } - $GLOBALS['_System_temp_files'][] = $tmp; - if ($first_time) { - PEAR::registerShutdownFunc(array('System', '_removeTmpFiles')); - $first_time = false; - } - return $tmp; - } - - /** - * Remove temporary files created my mkTemp. This function is executed - * at script shutdown time - * - * @access private - */ - function _removeTmpFiles() - { - if (count($GLOBALS['_System_temp_files'])) { - $delete = $GLOBALS['_System_temp_files']; - array_unshift($delete, '-r'); - System::rm($delete); - } - } - - /** - * Get the path of the temporal directory set in the system - * by looking in its environments variables. - * Note: php.ini-recommended removes the "E" from the variables_order setting, - * making unavaible the $_ENV array, that s why we do tests with _ENV - * - * @return string The temporal directory on the system - */ - function tmpdir() - { - if (OS_WINDOWS) { - if ($var = isset($_ENV['TEMP']) ? $_ENV['TEMP'] : getenv('TEMP')) { - return $var; - } - if ($var = isset($_ENV['TMP']) ? $_ENV['TMP'] : getenv('TMP')) { - return $var; - } - if ($var = isset($_ENV['windir']) ? $_ENV['windir'] : getenv('windir')) { - return $var; - } - return getenv('SystemRoot') . '\temp'; - } - if ($var = isset($_ENV['TMPDIR']) ? $_ENV['TMPDIR'] : getenv('TMPDIR')) { - return $var; - } - return '/tmp'; - } - - /** - * The "which" command (show the full path of a command) - * - * @param string $program The command to search for - * @return mixed A string with the full path or false if not found - * @author Stig Bakken - */ - function which($program, $fallback = false) - { - // is_executable() is not available on windows - if (OS_WINDOWS) { - $pear_is_executable = 'is_file'; - } else { - $pear_is_executable = 'is_executable'; - } - - // full path given - if (basename($program) != $program) { - return (@$pear_is_executable($program)) ? $program : $fallback; - } - - // XXX FIXME honor safe mode - $path_delim = OS_WINDOWS ? ';' : ':'; - $exe_suffixes = OS_WINDOWS ? array('.exe','.bat','.cmd','.com') : array(''); - $path_elements = explode($path_delim, getenv('PATH')); - foreach ($exe_suffixes as $suff) { - foreach ($path_elements as $dir) { - $file = $dir . DIRECTORY_SEPARATOR . $program . $suff; - if (@is_file($file) && @$pear_is_executable($file)) { - return $file; - } - } - } - return $fallback; - } - - /** - * The "find" command - * - * Usage: - * - * System::find($dir); - * System::find("$dir -type d"); - * System::find("$dir -type f"); - * System::find("$dir -name *.php"); - * System::find("$dir -name *.php -name *.htm*"); - * System::find("$dir -maxdepth 1"); - * - * Params implmented: - * $dir -> Start the search at this directory - * -type d -> return only directories - * -type f -> return only files - * -maxdepth -> max depth of recursion - * -name -> search pattern (bash style). Multiple -name param allowed - * - * @param mixed Either array or string with the command line - * @return array Array of found files - * - */ - function find($args) - { - if (!is_array($args)) { - $args = preg_split('/\s+/', $args, -1, PREG_SPLIT_NO_EMPTY); - } - $dir = array_shift($args); - $patterns = array(); - $depth = 0; - $do_files = $do_dirs = true; - for ($i = 0; $i < count($args); $i++) { - switch ($args[$i]) { - case '-type': - if (in_array($args[$i+1], array('d', 'f'))) { - if ($args[$i+1] == 'd') { - $do_files = false; - } else { - $do_dirs = false; - } - } - $i++; - break; - case '-name': - $patterns[] = "(" . preg_replace(array('/\./', '/\*/'), - array('\.', '.*'), - $args[$i+1]) - . ")"; - $i++; - break; - case '-maxdepth': - $depth = $args[$i+1]; - break; - } - } - $path = System::_dirToStruct($dir, $depth); - if ($do_files && $do_dirs) { - $files = array_merge($path['files'], $path['dirs']); - } elseif ($do_dirs) { - $files = $path['dirs']; - } else { - $files = $path['files']; - } - if (count($patterns)) { - $patterns = implode('|', $patterns); - $ret = array(); - for ($i = 0; $i < count($files); $i++) { - if (preg_match("#^$patterns\$#", $files[$i])) { - $ret[] = $files[$i]; - } - } - return $ret; - } - return $files; - } -} -?> diff --git a/lib/session-test.php b/lib/session-test.php index 32aa7b91de4cb..f73da062eae8b 100644 --- a/lib/session-test.php +++ b/lib/session-test.php @@ -6,17 +6,10 @@ /// set a new variable, and after that it will try to find it again. /// The random number is just to prevent browser caching. -session_start(); +require '../config.php'; -if (!isset($_SESSION["test"])) { // First time you call it. - echo "

No session found - starting a session now."; - $_SESSION["test"] = "welcome back!"; +error('session test not reimplemented yet'); -} else { // Subsequent times you call it - echo "

Session found - ".$_SESSION["test"]; - echo "

Sessions are working correctly

"; -} - -echo "

Reload this page

"; +//TODO: add code that actually tests moodle sessions, the old one only tested PHP sessions used from installer, not the real moodle sessions ?> diff --git a/lib/setup.php b/lib/setup.php index c5ba97153c48a..87a2f6cbc7612 100644 --- a/lib/setup.php +++ b/lib/setup.php @@ -44,7 +44,7 @@ * @global object(session) $SESSION */ global $SESSION; -/** +/** * Definition of shared memory cache */ global $MCACHE; @@ -70,8 +70,8 @@ global $THEME; /** - * HTTPSPAGEREQUIRED is a global to define if the page being displayed must run under HTTPS. - * + * HTTPSPAGEREQUIRED is a global to define if the page being displayed must run under HTTPS. + * * It's primary goal is to allow 100% HTTPS pages when $CFG->loginhttps is enabled. Default to false. * It's enabled only by the httpsrequired() function and used in some pages to update some URLs */ @@ -100,9 +100,9 @@ require_once($CFG->libdir .'/setuplib.php'); // Functions that MUST be loaded first -/// Time to start counting - init_performance_info(); - +/// Time to start counting + init_performance_info(); + /// If there are any errors in the standard libraries we want to know! error_reporting(E_ALL); @@ -110,7 +110,7 @@ /// Just say no to link prefetching (Moz prefetching, Google Web Accelerator, others) /// http://www.google.com/webmasters/faq.html#prefetchblock if (!empty($_SERVER['HTTP_X_moz']) && $_SERVER['HTTP_X_moz'] === 'prefetch'){ - header($_SERVER['SERVER_PROTOCOL'] . ' 404 Prefetch Forbidden'); + header($_SERVER['SERVER_PROTOCOL'] . ' 404 Prefetch Forbidden'); trigger_error('Prefetch request forbidden.'); exit; } @@ -133,6 +133,7 @@ require_once($CFG->libdir .'/moodlelib.php'); // Other general-purpose functions require_once($CFG->libdir .'/eventslib.php'); // Events functions require_once($CFG->libdir .'/grouplib.php'); // Groups functions + require_once($CFG->libdir .'/sessionlib.php'); // All session and cookie related stuff //point pear include path to moodles lib/pear so that includes and requires will search there for files before anywhere else //the problem is that we need specific version of quickforms and hacked excel files :-( @@ -207,7 +208,7 @@ $CFG->debug = $originaldatabasedebug; } if ($originalconfigdebug !== -1) { - $CFG->debug = $originalconfigdebug; + $CFG->debug = $originalconfigdebug; } unset($originalconfigdebug); unset($originaldatabasedebug); @@ -265,7 +266,7 @@ if (!init_eaccelerator()) { debugging("Error initialising eaccelerator cache"); $CFG->cachetype = ''; - $CFG->rcache = false; + $CFG->rcache = false; } } @@ -309,69 +310,13 @@ make_upload_directory('cache'); } -/// Set up smarty template system - //require_once($CFG->libdir .'/smarty/Smarty.class.php'); - //$smarty = new Smarty; - //$smarty->template_dir = $CFG->dirroot .'/templates/'. $CFG->template; - //if (!file_exists($CFG->dataroot .'/cache/smarty')) { - // make_upload_directory('cache/smarty'); - //} - //$smarty->compile_dir = $CFG->dataroot .'/cache/smarty'; - -/// Set up session handling - if(empty($CFG->respectsessionsettings)) { - if (empty($CFG->dbsessions)) { /// File-based sessions - - // Some distros disable GC by setting probability to 0 - // overriding the PHP default of 1 - // (gc_probability is divided by gc_divisor, which defaults to 1000) - if (ini_get('session.gc_probability') == 0) { - ini_set('session.gc_probability', 1); - } - - if (!empty($CFG->sessiontimeout)) { - ini_set('session.gc_maxlifetime', $CFG->sessiontimeout); - } - - if (!file_exists($CFG->dataroot .'/sessions')) { - make_upload_directory('sessions'); - } - ini_set('session.save_path', $CFG->dataroot .'/sessions'); - - } else { /// Database sessions - ini_set('session.save_handler', 'user'); - - $ADODB_SESSION_DRIVER = $CFG->dbtype; - $ADODB_SESSION_CONNECT = $CFG->dbhost; - $ADODB_SESSION_USER = $CFG->dbuser; - $ADODB_SESSION_PWD = $CFG->dbpass; - $ADODB_SESSION_DB = $CFG->dbname; - $ADODB_SESSION_TBL = $CFG->prefix.'sessions2'; - if (!empty($CFG->sessiontimeout)) { - $ADODB_SESS_LIFE = $CFG->sessiontimeout; - } - - require_once($CFG->libdir. '/adodb/session/adodb-session2.php'); - } - } -/// Set sessioncookie and sessioncookiepath variable if it isn't already - if (!isset($CFG->sessioncookie)) { - $CFG->sessioncookie = ''; - } - if (!isset($CFG->sessioncookiepath)) { - $CFG->sessioncookiepath = '/'; - } - /// Configure ampersands in URLs - @ini_set('arg_separator.output', '&'); /// Work around for a PHP bug see MDL-11237 - - @ini_set('pcre.backtrack_limit', 20971520); // 20 MB + @ini_set('pcre.backtrack_limit', 20971520); // 20 MB /// Location of standard files - $CFG->wordlist = $CFG->libdir .'/wordlist.txt'; $CFG->javascript = $CFG->libdir .'/javascript.php'; $CFG->moddata = 'moddata'; @@ -415,60 +360,13 @@ function stripslashes_deep($value) { } } -/// Load up global environment variables - - if (!isset($CFG->cookiesecure) or strpos($CFG->wwwroot, 'https://') !== 0) { - $CFG->cookiesecure = false; - } +/// start session and prepare global $SESSION + $SESSION = new moodle_session(); - if (!isset($CFG->cookiehttponly)) { - $CFG->cookiehttponly = false; - } - - //discard session ID from POST, GET and globals to tighten security, - //this session fixation prevention can not be used in cookieless mode - if (empty($CFG->usesid) && !defined('MOODLE_SANE_INPUT')) { - unset(${'MoodleSession'.$CFG->sessioncookie}); - unset($_GET['MoodleSession'.$CFG->sessioncookie]); - unset($_POST['MoodleSession'.$CFG->sessioncookie]); - } - //compatibility hack for Moodle Cron, cookies not deleted, but set to "deleted" - should not be needed with $nomoodlecookie in cron.php now - if (!empty($_COOKIE['MoodleSession'.$CFG->sessioncookie]) && $_COOKIE['MoodleSession'.$CFG->sessioncookie] == "deleted") { - unset($_COOKIE['MoodleSession'.$CFG->sessioncookie]); - } - if (!empty($_COOKIE['MoodleSessionTest'.$CFG->sessioncookie]) && $_COOKIE['MoodleSessionTest'.$CFG->sessioncookie] == "deleted") { - unset($_COOKIE['MoodleSessionTest'.$CFG->sessioncookie]); - } - if (!empty($CFG->usesid) && empty($_COOKIE['MoodleSession'.$CFG->sessioncookie])) { - require_once("$CFG->dirroot/lib/cookieless.php"); - sid_start_ob(); - } - - if (empty($nomoodlecookie)) { - session_name('MoodleSession'.$CFG->sessioncookie); - session_set_cookie_params(0, $CFG->sessioncookiepath, '', $CFG->cookiesecure, $CFG->cookiehttponly); - @session_start(); - if (! isset($_SESSION['SESSION'])) { - $_SESSION['SESSION'] = new object; - $_SESSION['SESSION']->session_test = random_string(10); - if (!empty($_COOKIE['MoodleSessionTest'.$CFG->sessioncookie])) { - $_SESSION['SESSION']->has_timed_out = true; - } - setcookie('MoodleSessionTest'.$CFG->sessioncookie, $_SESSION['SESSION']->session_test, 0, $CFG->sessioncookiepath, '', $CFG->cookiesecure, $CFG->cookiehttponly); - $_COOKIE['MoodleSessionTest'.$CFG->sessioncookie] = $_SESSION['SESSION']->session_test; - } - if (! isset($_SESSION['USER'])) { - $_SESSION['USER'] = new object; - } - - $SESSION = &$_SESSION['SESSION']; // Makes them easier to reference - $USER = &$_SESSION['USER']; - if (!isset($USER->id)) { - $USER->id = 0; // to enable proper function of $CFG->notloggedinroleid hack - } - } - else { - $SESSION = NULL; +/// set up global $USER + if (!NO_MOODLE_COOKIES) { + $USER = &$_SESSION['USER']; + } else { $USER = new object(); $USER->id = 0; // user not logged in when session disabled if (isset($CFG->mnet_localhost_id)) { @@ -490,7 +388,7 @@ function stripslashes_deep($value) { $CFG->themedir = $CFG->dirroot.'/theme'; $CFG->themewww = $CFG->wwwroot.'/theme'; } - $CFG->httpsthemewww = $CFG->themewww; + $CFG->httpsthemewww = $CFG->themewww; if (isset($_GET['theme'])) { if ($CFG->allowthemechangeonurl || confirm_sesskey()) { @@ -507,27 +405,17 @@ function stripslashes_deep($value) { } /// now do a session test to prevent random user switching - observed on some PHP/Apache combinations, -/// disable checks when working in cookieless mode - if (empty($CFG->usesid) || !empty($_COOKIE['MoodleSession'.$CFG->sessioncookie])) { - if ($SESSION != NULL) { - if (empty($_COOKIE['MoodleSessionTest'.$CFG->sessioncookie])) { - report_session_error(); - } else if (isset($SESSION->session_test) && $_COOKIE['MoodleSessionTest'.$CFG->sessioncookie] != $SESSION->session_test) { - report_session_error(); - } - } - } - + $SESSION->session_verify(); /// Set language/locale of printed times. If user has chosen a language that /// that is different from the site language, then use the locale specified /// in the language file. Otherwise, if the admin hasn't specified a locale /// then use the one from the default language. Otherwise (and this is the /// majority of cases), use the stored locale specified by admin. - if ($SESSION !== NULL && isset($_GET['lang']) && ($lang = clean_param($_GET['lang'], PARAM_SAFEDIR))) { + if (isset($_GET['lang']) && ($lang = clean_param($_GET['lang'], PARAM_SAFEDIR))) { if (file_exists($CFG->dataroot .'/lang/'. $lang) or file_exists($CFG->dirroot .'/lang/'. $lang)) { $SESSION->lang = $lang; - } else if (file_exists($CFG->dataroot.'/lang/'.$lang.'_utf8') or + } else if (file_exists($CFG->dataroot.'/lang/'.$lang.'_utf8') or file_exists($CFG->dirroot .'/lang/'.$lang.'_utf8')) { $SESSION->lang = $lang.'_utf8'; } @@ -544,12 +432,12 @@ function stripslashes_deep($value) { $CFG->lang = $SESSION->lang; } } - + // set default locale and themes - might be changed again later from require_login() course_setup(); if (!empty($CFG->opentogoogle)) { - if (empty($USER->id)) { // Ignore anyone logged in + if (!NO_MOODLE_COOKIES and empty($USER->id)) { // Ignore anyone logged in, or scripts without cookies if (!empty($_SERVER['HTTP_USER_AGENT'])) { if (strpos($_SERVER['HTTP_USER_AGENT'], 'Googlebot') !== false ) { $USER = guest_user(); @@ -570,14 +458,14 @@ function stripslashes_deep($value) { $USER = guest_user(); } } - if (!empty($USER)) { + if (!empty($USER->id)) { load_all_capabilities(); } } } if ($CFG->theme == 'standard' or $CFG->theme == 'standardwhite') { // Temporary measure to help with XHTML validation - if (isset($_SERVER['HTTP_USER_AGENT']) and empty($_SESSION['USER']->id)) { // Allow W3CValidator in as user called w3cvalidator (or guest) + if (isset($_SERVER['HTTP_USER_AGENT']) and empty($USER->id)) { // Allow W3CValidator in as user called w3cvalidator (or guest) if ((strpos($_SERVER['HTTP_USER_AGENT'], 'W3C_Validator') !== false) or (strpos($_SERVER['HTTP_USER_AGENT'], 'Cynthia') !== false )) { if ($USER = get_complete_user_data("username", "w3cvalidator")) { diff --git a/lib/simpletest/testdmllib.php b/lib/simpletest/testdmllib.php deleted file mode 100644 index 6767e227b6fe3..0000000000000 --- a/lib/simpletest/testdmllib.php +++ /dev/null @@ -1,345 +0,0 @@ -libdir . '/simpletestlib/web_tester.php'); -require_once($CFG->libdir . '/dmllib.php'); - -class datalib_test extends prefix_changing_test_case { - var $table = 'table'; - var $data = array( - array('id', 'textfield', 'numberfield'), - array( 1, 'frog', 101), - array( 2, 'toad', 102), - array( 3, 'tadpole', 103), - array( 4, 'tadpole', 104), - array( 5, 'nothing', NULL), - ); - var $objects = array(); - - function setUp() { - global $CFG, $db; - parent::setUp(); - load_test_table($CFG->prefix . $this->table, $this->data, $db); - $keys = reset($this->data); - foreach ($this->data as $row=>$datum) { - if ($row == 0) { - continue; - } - $this->objects[$datum[0]] = (object) array_combine($keys, $datum); - } - } - - function tearDown() { - global $CFG, $db; - remove_test_table($CFG->prefix . $this->table, $db); - parent::tearDown(); - } - - function test_where_clause() { - $this->assertEqual(where_clause('f1', 'v1'), "WHERE f1 = 'v1'"); - $this->assertEqual(where_clause('f1', 'v1', 'f2', 2), "WHERE f1 = 'v1' AND f2 = '2'"); - $this->assertEqual(where_clause('f1', 'v1', 'f2', 1.75, 'f3', 'v3'), "WHERE f1 = 'v1' AND f2 = '1.75' AND f3 = 'v3'"); - $this->assertEqual(where_clause('f1', NULL), "WHERE f1 IS NULL"); - } - - function test_record_exists() { - $this->assertTrue(record_exists($this->table, 'numberfield', 101, 'id', 1)); - $this->assertFalse(record_exists($this->table, 'numberfield', 102, 'id', 1)); - $this->assertTrue(record_exists($this->table, 'numberfield', NULL)); - } - - function test_record_exists_select() { - $this->assertTrue(record_exists_select($this->table, 'numberfield = 101 AND id = 1')); - $this->assertFalse(record_exists_select($this->table, 'numberfield = 102 AND id = 1')); - $this->assertTrue(record_exists_select($this->table, 'numberfield IS NULL')); - } - - function test_record_exists_sql() { - global $CFG; - $this->assertTrue(record_exists_sql("SELECT * FROM {$CFG->prefix}$this->table WHERE numberfield = 101 AND id = 1")); - $this->assertFalse(record_exists_sql("SELECT * FROM {$CFG->prefix}$this->table WHERE numberfield = 102 AND id = 1")); - $this->assertTrue(record_exists_sql("SELECT * FROM {$CFG->prefix}$this->table WHERE numberfield IS NULL")); - } - - - function test_get_record() { - // Get particular records. - $this->assert(new CheckSpecifiedFieldsExpectation($this->objects[1]), get_record($this->table, 'id', 1)); - $this->assert(new CheckSpecifiedFieldsExpectation($this->objects[3]), get_record($this->table, 'textfield', 'tadpole', 'numberfield', 103)); - $this->assert(new CheckSpecifiedFieldsExpectation($this->objects[5]), get_record($this->table, 'numberfield', null)); - - // Abiguous get attempt, should return one, and print a warning in debug mode. - global $CFG; - $old_debug = $CFG->debug; - $CFG->debug = 0; - - ob_start(); - $record = get_record($this->table, 'textfield', 'tadpole'); - $result = ob_get_contents(); - ob_end_clean(); - $this->assertEqual('', $result, '%s (No error ouside debug mode).'); - - $CFG->debug = DEBUG_DEVELOPER; - ob_start(); - $record = get_record($this->table, 'textfield', 'tadpole'); - $result = ob_get_contents(); - ob_end_clean(); - $this->assert(new TextExpectation('Error:'), $result, 'Error in debug mode.'); - - $CFG->debug = $old_debug; - - // Return only specified fields - $expected = new stdClass; - $expected->id = 3; - $expected->textfield = 'tadpole'; - $result = get_record($this->table, 'id', '3', '', '', '', '', 'id,textfield'); - $this->assert(new CheckSpecifiedFieldsExpectation($expected), $result); - $this->assertFalse(isset($result->numberfield)); - $expected = new stdClass; - $expected->textfield = 'tadpole'; - $expected->numberfield = 103; - $result = get_record($this->table, 'id', '3', '', '', '', '', 'textfield,numberfield'); - $this->assert(new CheckSpecifiedFieldsExpectation($expected), $result); - $this->assertFalse(isset($result->id)); - - // Attempting to get a non-existant records should return false. - $this->assertFalse(get_record($this->table, 'textfield', 'not there'), 'attempt to get non-existant record'); - } - - function test_get_record_sql() { - global $CFG; - // Get particular records. - $this->assert(new CheckSpecifiedFieldsExpectation($this->objects[1]), get_record_sql("SELECT * FROM {$CFG->prefix}" . $this->table . " WHERE id = '1'", 'id = 1')); - - // Abiguous get attempt, should return one, and print a warning in debug mode, unless $expectmultiple is used. - $old_debug = $CFG->debug; - $CFG->debug = 0; - - ob_start(); - $record = get_record_sql("SELECT * FROM {$CFG->prefix}" . $this->table . " WHERE textfield = 'tadpole'"); - $result = ob_get_contents(); - ob_end_clean(); - $this->assertEqual('', $result, '%s (No error ouside debug mode).'); - - $CFG->debug = DEBUG_DEVELOPER; - ob_start(); - $record = get_record_sql("SELECT * FROM {$CFG->prefix}" . $this->table . " WHERE textfield = 'tadpole'"); - $result = ob_get_contents(); - ob_end_clean(); - $this->assert(new TextExpectation('Error:'), $result, 'Error in debug mode.'); - - ob_start(); - $record = get_record_sql("SELECT * FROM {$CFG->prefix}" . $this->table . " WHERE textfield = 'tadpole'", true); - $result = ob_get_contents(); - ob_end_clean(); - $this->assertEqual('', $result, '%s (No error ouside debug mode).'); - - $CFG->debug = $old_debug; - - // Attempting to get a non-existant records should return false. - $this->assertFalse(get_record_sql("SELECT * FROM {$CFG->prefix}" . $this->table . " WHERE textfield = 'not there'"), 'attempt to get non-existant record'); - } - - function test_get_record_select() { - // Get particular records. - $this->assert(new CheckSpecifiedFieldsExpectation($this->objects[2]), get_record_select($this->table, 'id > 1 AND id < 3'), 'id > 1 AND id < 3'); - - // Abiguous get attempt, should return one, and print a warning in debug mode. - global $CFG; - $old_debug = $CFG->debug; - $CFG->debug = 0; - - ob_start(); - $record = get_record_select($this->table, "textfield = 'tadpole'"); - $result = ob_get_contents(); - ob_end_clean(); - $this->assertEqual('', $result, '%s (No error ouside debug mode).'); - - $CFG->debug = DEBUG_DEVELOPER; - ob_start(); - $record = get_record_select($this->table, "textfield = 'tadpole'"); - $result = ob_get_contents(); - ob_end_clean(); - $this->assert(new TextExpectation('Error:'), $result, 'Error in debug mode.'); - - $CFG->debug = $old_debug; - - // Return only specified fields - $expected = new stdClass; - $expected->id = 1; - $expected->textfield = 'frog'; - $result = get_record_select($this->table, "textfield = 'frog'", 'id,textfield'); - $this->assert(new CheckSpecifiedFieldsExpectation($expected), $result); - $this->assertFalse(isset($result->numberfield)); - - // Attempting to get a non-existant records should return false. - $this->assertFalse(get_record_select($this->table, 'id > 666'), 'attempt to get non-existant record'); - } - - function test_get_field() { - $this->assertEqual(get_field($this->table, 'numberfield', 'id', 1), 101); - $this->assertEqual(get_field($this->table, 'textfield', 'numberfield', 102), 'toad'); - $this->assertEqual(get_field($this->table, 'numberfield', 'textfield', 'tadpole', 'id', 4), 104); - $this->assertEqual(get_field($this->table, 'numberfield + id', 'textfield', 'tadpole', 'id', 4), 108); - $this->assertNull(get_field($this->table, 'numberfield', 'id', 5)); - } - - function test_get_field_select() { - $this->assertEqual(get_field_select($this->table, 'numberfield', 'id = 1'), 101); - } - - function test_get_field_sql() { - global $CFG; - $this->assertEqual(get_field_sql("SELECT numberfield FROM {$CFG->prefix}$this->table WHERE id = 1"), 101); - } - - function test_set_field() { - set_field($this->table, 'numberfield', 12345, 'id', 1); - $this->assertEqual(get_field($this->table, 'numberfield', 'id', 1), 12345); - - set_field($this->table, 'textfield', 'newvalue', 'numberfield', 102); - $this->assertEqual(get_field($this->table, 'textfield', 'numberfield', 102), 'newvalue'); - - set_field($this->table, 'numberfield', -1, 'textfield', 'tadpole', 'id', 4); - $this->assertEqual(get_field($this->table, 'numberfield', 'textfield', 'tadpole', 'id', 4), -1); - - set_field($this->table, 'textfield', null, 'id', 5); - $this->assertNull(get_field($this->table, 'textfield', 'id', 5)); - } - - function test_delete_records() { - delete_records($this->table, 'id', 666); - $this->assertEqual(count_records($this->table), 5); - delete_records($this->table, 'id', 1); - $this->assertEqual(count_records($this->table), 4); - delete_records($this->table, 'textfield', 'tadpole'); - $this->assertEqual(count_records($this->table), 2); - delete_records($this->table, 'numberfield', NULL); - $this->assertEqual(count_records($this->table), 1); - } - - function test_delete_records2() { - delete_records($this->table, 'textfield', 'tadpole', 'id', 4); - $this->assertEqual(count_records($this->table), 4); - delete_records($this->table); - $this->assertEqual(count_records($this->table), 0); - } - - function test_delete_records_select() { - delete_records_select($this->table, "textfield LIKE 't%'"); - $this->assertEqual(count_records($this->table), 2); - delete_records_select($this->table, "'1' = '1'"); - $this->assertEqual(count_records($this->table), 0); - } - - function test_update_record() { - global $CFG; - - // Simple update - $obj = new stdClass; - $obj->id = 1; - $obj->textfield = 'changed entry'; - $obj->numberfield = 123; - $this->assertTrue(update_record($this->table, $obj)); - $this->assert(new CheckSpecifiedFieldsExpectation($obj, 'Simple update (%s)'), get_record($this->table, 'id', $obj->id)); - - // Simple incomplete update - $obj = new stdClass; - $obj->id = 2; - $obj->numberfield = 123; - $this->assertTrue(update_record($this->table, $obj)); - $obj->textfield = 'toad'; - $this->assert(new CheckSpecifiedFieldsExpectation($obj, 'Simple update (%s)'), get_record($this->table, 'id', $obj->id)); - - // Simple incomplete update - $obj = new stdClass; - $obj->id = 3; - $obj->numberfield = 123; - $obj->textfield = null; - $this->assertTrue(update_record($this->table, $obj)); - $this->assert(new CheckSpecifiedFieldsExpectation($obj, 'Simple update (%s)'), get_record($this->table, 'id', $obj->id)); - - } - -//function insert_record($table, $dataobject, $returnid=true, $primarykey='id', $feedback=true) { - function test_insert_record() { - global $CFG; - - // Simple insert with $returnid - $obj = new stdClass; - $obj->textfield = 'new entry'; - $obj->numberfield = 123; - $this->assertEqual(insert_record($this->table, $obj), 6); - $obj->id = 6; - $this->assert(new CheckSpecifiedFieldsExpectation($obj, 'Simple insert with returnid (%s)'), get_record($this->table, 'id', $obj->id)); - - // Simple insert without $returnid - $obj = new stdClass; - $obj->textfield = 'newer entry'; - $obj->numberfield = 321; - $this->assertEqual(insert_record($this->table, $obj, false), true); - $obj->id = 7; - $this->assert(new CheckSpecifiedFieldsExpectation($obj, 'Simple insert without returnid (%s)'), get_record($this->table, 'id', $obj->id)); - - // Insert with missing columns - should get defaults. - $obj = new stdClass; - $obj->textfield = 'partial entry'; - $this->assertEqual(insert_record($this->table, $obj), 8); - $obj->id = 8; - $obj->numberfield = 0xDefa; - $got = get_record($this->table, 'id', 8); - $this->assert(new CheckSpecifiedFieldsExpectation($obj, 'Insert with missing columns - should get defaults (%s)'), get_record($this->table, 'id', $obj->id)); - - // Insert with extra columns - should be ingnored. - $obj = new stdClass; - $obj->textfield = 'entry with extra'; - $obj->numberfield = 747; - $obj->unused = 666; - $this->assertEqual(insert_record($this->table, $obj), 9); - $obj->id = 9; - unset($obj->unused); - $this->assert(new CheckSpecifiedFieldsExpectation($obj, 'Insert with extra columns - should be ingnored (%s)'), get_record($this->table, 'id', $obj->id)); - - // Simple insert with $returnid and NULL values - $obj = new stdClass; - $obj->textfield = null; - $obj->numberfield = null; - $this->assertEqual(insert_record($this->table, $obj), 10); - $obj->id = 10; - $new = get_record($this->table, 'id', $obj->id); - $this->assert(new CheckSpecifiedFieldsExpectation($obj, 'Simple insert with returnid (%s)'), $new); - $this->assertNull($new->textfield); - $this->assertNull($new->numberfield); - - // Insert into nonexistant table - should fail. - $obj = new stdClass; - $obj->textfield = 'new entry'; - $obj->numberfield = 123; - $this->assertFalse(insert_record('nonexistant_table', $obj), 'Insert into nonexistant table'); - - // Insert bad data - error should be printed - mysql not tested - if ($CFG->dbfamily != 'mysql') { - $obj = new stdClass; - $obj->textfield = 'new entry'; - $obj->numberfield = 'not a number'; - ob_start(); - $this->assertFalse(insert_record($this->table, $obj), 'Insert bad data - should fail.'); - $result = ob_get_contents(); - ob_end_clean(); - $this->assert(new TextExpectation('ERROR:'), $result, 'Insert bad data - error should have been printed. This is known not to work on MySQL.'); - } - } -} - -?> diff --git a/lib/timezones.txt b/lib/timezones.txt deleted file mode 100644 index 4afca0eaf12b3..0000000000000 --- a/lib/timezones.txt +++ /dev/null @@ -1,1940 +0,0 @@ -id,name,year,tzrule,gmtoff,dstoff,dst_month,dst_startday,dst_weekday,dst_skipweeks,dst_time,std_month,std_startday,std_weekday,std_skipweeks,std_time -1,Africa/Algiers,1970,Algeria,0,60,4,1,1,0,02:00,9,16,-1,0,00:00 -2,Africa/Algiers,1971,Algeria,0,60,4,25,-1,0,23:00,9,26,-1,0,23:00 -3,Africa/Algiers,1977,Algeria,60,60,5,6,-1,0,01:00,10,21,-1,0,00:00 -4,Africa/Algiers,1978,Algeria,60,60,3,24,-1,0,02:00,9,22,-1,0,03:00 -5,Africa/Algiers,1979,Algeria,0,60,3,24,-1,0,01:00,9,22,-1,0,02:00 -6,Africa/Algiers,1980,Algeria,0,60,4,25,-1,0,00:00,10,31,-1,0,01:00 -7,Africa/Algiers,1981,,60,0,0,0,0,0,,0,0,0,0, -8,Africa/Luanda,1970,,60,0,0,0,0,0,,0,0,0,0, -9,Africa/Porto-Novo,1970,,60,0,0,0,0,0,,0,0,0,0, -10,Africa/Gaborone,1970,,120,0,0,0,0,0,,0,0,0,0, -11,Africa/Ouagadougou,1970,,0,0,0,0,0,0,,0,0,0,0, -12,Africa/Bujumbura,1970,,120,0,0,0,0,0,,0,0,0,0, -13,Africa/Douala,1970,,60,0,0,0,0,0,,0,0,0,0, -14,Atlantic/Cape_Verde,1970,,-120,0,0,0,0,0,,0,0,0,0, -15,Atlantic/Cape_Verde,1975,,-60,0,0,0,0,0,,0,0,0,0, -16,Africa/Bangui,1970,,60,0,0,0,0,0,,0,0,0,0, -17,Africa/Ndjamena,1970,,60,0,0,0,0,0,,0,0,0,0, -18,Africa/Ndjamena,1979,,60,0,0,0,0,0,,0,0,0,0, -19,Indian/Comoro,1970,,180,0,0,0,0,0,,0,0,0,0, -20,Africa/Kinshasa,1970,,60,0,0,0,0,0,,0,0,0,0, -21,Africa/Lubumbashi,1970,,120,0,0,0,0,0,,0,0,0,0, -22,Africa/Brazzaville,1970,,60,0,0,0,0,0,,0,0,0,0, -23,Africa/Abidjan,1970,,0,0,0,0,0,0,,0,0,0,0, -24,Africa/Djibouti,1970,,180,0,0,0,0,0,,0,0,0,0, -25,Africa/Cairo,1970,Egypt,120,60,5,1,-1,0,03:00,10,1,-1,0,04:00 -26,Africa/Cairo,1982,Egypt,120,60,7,25,-1,0,03:00,10,1,-1,0,04:00 -27,Africa/Cairo,1983,Egypt,120,60,7,12,-1,0,03:00,10,1,-1,0,04:00 -28,Africa/Cairo,1984,Egypt,120,60,5,1,-1,0,03:00,10,1,-1,0,04:00 -29,Africa/Cairo,1989,Egypt,120,60,5,6,-1,0,03:00,10,1,-1,0,04:00 -30,Africa/Cairo,1990,Egypt,120,60,5,1,-1,0,03:00,10,1,-1,0,04:00 -31,Africa/Cairo,1995,Egypt,120,60,4,-1,5,0,02:00,9,-1,4,0,25:00 -32,Africa/Cairo,2006,Egypt,120,60,4,-1,5,0,02:00,9,21,-1,0,25:00 -33,Africa/Cairo,2007,Egypt,120,60,4,-1,5,0,02:00,9,-1,4,0,25:00 -34,Africa/Malabo,1970,,60,0,0,0,0,0,,0,0,0,0, -35,Africa/Asmara,1970,,180,0,0,0,0,0,,0,0,0,0, -36,Africa/Addis_Ababa,1970,,180,0,0,0,0,0,,0,0,0,0, -37,Africa/Libreville,1970,,60,0,0,0,0,0,,0,0,0,0, -38,Africa/Banjul,1970,,0,0,0,0,0,0,,0,0,0,0, -39,Africa/Accra,1970,Ghana,0,0,9,1,-1,0,00:00,12,31,-1,0,-1:00 -40,Africa/Conakry,1970,,0,0,0,0,0,0,,0,0,0,0, -41,Africa/Bissau,1970,,-60,0,0,0,0,0,,0,0,0,0, -42,Africa/Bissau,1975,,0,0,0,0,0,0,,0,0,0,0, -43,Africa/Nairobi,1970,,180,0,0,0,0,0,,0,0,0,0, -44,Africa/Maseru,1970,,120,0,0,0,0,0,,0,0,0,0, -45,Africa/Monrovia,1970,,-44,0,0,0,0,0,,0,0,0,0, -46,Africa/Monrovia,1972,,0,0,0,0,0,0,,0,0,0,0, -47,Africa/Tripoli,1970,,120,0,0,0,0,0,,0,0,0,0, -48,Africa/Tripoli,1982,Libya,60,60,4,1,-1,0,01:00,10,1,-1,0,00:00 -49,Africa/Tripoli,1985,Libya,60,60,4,6,-1,0,01:00,10,1,-1,0,00:00 -50,Africa/Tripoli,1986,Libya,60,60,4,4,-1,0,01:00,10,3,-1,0,00:00 -51,Africa/Tripoli,1987,Libya,60,60,4,1,-1,0,01:00,10,1,-1,0,00:00 -52,Africa/Tripoli,1989,Libya,60,0,4,1,-1,0,01:00,10,1,-1,0,00:00 -53,Africa/Tripoli,1990,,120,0,0,0,0,0,,0,0,0,0, -54,Africa/Tripoli,1996,,60,0,0,0,0,0,,0,0,0,0, -55,Africa/Tripoli,1997,,120,0,0,0,0,0,,0,0,0,0, -56,Indian/Antananarivo,1970,,180,0,0,0,0,0,,0,0,0,0, -57,Africa/Blantyre,1970,,120,0,0,0,0,0,,0,0,0,0, -58,Africa/Bamako,1970,,0,0,0,0,0,0,,0,0,0,0, -59,Africa/Nouakchott,1970,,0,0,0,0,0,0,,0,0,0,0, -60,Indian/Mauritius,1970,,240,0,0,0,0,0,,0,0,0,0, -61,Indian/Mayotte,1970,,180,0,0,0,0,0,,0,0,0,0, -62,Africa/Casablanca,1970,Morocco,0,60,6,3,-1,0,12:00,10,1,-1,0,-1:00 -63,Africa/Casablanca,1974,Morocco,0,60,6,24,-1,0,00:00,9,1,-1,0,-1:00 -64,Africa/Casablanca,1976,Morocco,0,60,5,1,-1,0,00:00,8,1,-1,0,-1:00 -65,Africa/Casablanca,1977,Morocco,0,60,5,1,-1,0,00:00,9,28,-1,0,-1:00 -66,Africa/Casablanca,1978,Morocco,0,60,6,1,-1,0,00:00,8,4,-1,0,-1:00 -67,Africa/Casablanca,1979,Morocco,0,0,6,1,-1,0,00:00,8,4,-1,0,-1:00 -68,Africa/Casablanca,1984,,60,0,0,0,0,0,,0,0,0,0, -69,Africa/Casablanca,1986,,0,0,0,0,0,0,,0,0,0,0, -70,Africa/El_Aaiun,1970,,-60,0,0,0,0,0,,0,0,0,0, -71,Africa/El_Aaiun,1976,,0,0,0,0,0,0,,0,0,0,0, -72,Africa/Maputo,1970,,120,0,0,0,0,0,,0,0,0,0, -73,Africa/Windhoek,1970,,120,0,0,0,0,0,,0,0,0,0, -74,Africa/Windhoek,1990,,120,0,0,0,0,0,,0,0,0,0, -75,Africa/Windhoek,1994,Namibia,60,60,9,1,0,0,03:00,1,1,-1,0,12:00 -76,Africa/Windhoek,1995,Namibia,60,60,9,1,0,0,03:00,4,1,0,0,02:00 -77,Africa/Niamey,1970,,60,0,0,0,0,0,,0,0,0,0, -78,Africa/Lagos,1970,,60,0,0,0,0,0,,0,0,0,0, -79,Indian/Reunion,1970,,240,0,0,0,0,0,,0,0,0,0, -80,Africa/Kigali,1970,,120,0,0,0,0,0,,0,0,0,0, -81,Atlantic/St_Helena,1970,,0,0,0,0,0,0,,0,0,0,0, -82,Africa/Sao_Tome,1970,,0,0,0,0,0,0,,0,0,0,0, -83,Africa/Dakar,1970,,0,0,0,0,0,0,,0,0,0,0, -84,Indian/Mahe,1970,,240,0,0,0,0,0,,0,0,0,0, -85,Africa/Freetown,1970,SL,0,0,6,1,-1,0,00:00,9,1,-1,0,-1:00 -86,Africa/Mogadishu,1970,,180,0,0,0,0,0,,0,0,0,0, -87,Africa/Johannesburg,1970,SA,120,0,12,31,-1,0,14:00,3,15,0,0,03:00 -88,Africa/Khartoum,1970,Sudan,120,60,5,1,-1,0,02:00,10,15,-1,0,01:00 -89,Africa/Khartoum,1971,Sudan,120,60,4,30,-1,0,02:00,10,15,-1,0,01:00 -90,Africa/Khartoum,1972,Sudan,120,60,4,-1,0,0,02:00,10,15,-1,0,01:00 -91,Africa/Khartoum,1985,Sudan,120,0,4,-1,0,0,02:00,10,15,-1,0,01:00 -92,Africa/Khartoum,2000,,180,0,0,0,0,0,,0,0,0,0, -93,Africa/Mbabane,1970,,120,0,0,0,0,0,,0,0,0,0, -94,Africa/Dar_es_Salaam,1970,,180,0,0,0,0,0,,0,0,0,0, -95,Africa/Lome,1970,,0,0,0,0,0,0,,0,0,0,0, -96,Africa/Tunis,1970,Tunisia,60,60,4,1,1,0,03:00,9,16,-1,0,00:00 -97,Africa/Tunis,1977,Tunisia,60,60,4,30,-1,0,01:00,9,24,-1,0,01:00 -98,Africa/Tunis,1978,Tunisia,60,60,5,1,-1,0,01:00,10,1,-1,0,01:00 -99,Africa/Tunis,1988,Tunisia,60,60,6,1,-1,0,01:00,9,-1,0,0,01:00 -100,Africa/Tunis,1989,Tunisia,60,60,3,26,-1,0,01:00,9,-1,0,0,01:00 -101,Africa/Tunis,1990,Tunisia,60,60,5,1,-1,0,01:00,9,-1,0,0,01:00 -102,Africa/Tunis,2005,Tunisia,60,60,5,1,-1,0,01:00,9,30,-1,0,02:00 -103,Africa/Tunis,2006,Tunisia,60,60,3,-1,0,0,03:00,10,-1,0,0,03:00 -104,Africa/Kampala,1970,,180,0,0,0,0,0,,0,0,0,0, -105,Africa/Lusaka,1970,,120,0,0,0,0,0,,0,0,0,0, -106,Africa/Harare,1970,,120,0,0,0,0,0,,0,0,0,0, -107,Antarctica/Casey,1970,,480,0,0,0,0,0,,0,0,0,0, -108,Antarctica/Davis,1970,,420,0,0,0,0,0,,0,0,0,0, -109,Antarctica/Mawson,1970,,360,0,0,0,0,0,,0,0,0,0, -110,Indian/Kerguelen,1970,,300,0,0,0,0,0,,0,0,0,0, -111,Antarctica/DumontDUrville,1970,,600,0,0,0,0,0,,0,0,0,0, -112,Antarctica/Syowa,1970,,180,0,0,0,0,0,,0,0,0,0, -113,Antarctica/Vostok,1970,,360,0,0,0,0,0,,0,0,0,0, -114,Antarctica/Rothera,1970,,0,0,0,0,0,0,,0,0,0,0, -115,Antarctica/Rothera,1976,,-180,0,0,0,0,0,,0,0,0,0, -116,Antarctica/Palmer,1970,ArgAQ,-180,0,12,31,-1,0,09:00,4,1,0,0,-4:00 -117,Antarctica/Palmer,1974,ArgAQ,-180,60,1,23,-1,0,-3:00,5,1,-1,0,-4:00 -118,Antarctica/Palmer,1975,ArgAQ,-180,0,1,23,-1,0,-3:00,5,1,-1,0,-4:00 -119,Antarctica/Palmer,1982,ChileAQ,-240,60,10,9,0,0,4:00,3,9,0,0,3:00 -120,Antarctica/Palmer,1987,ChileAQ,-240,60,10,9,0,0,4:00,4,12,-1,0,3:00 -121,Antarctica/Palmer,1988,ChileAQ,-240,60,10,1,0,0,4:00,3,9,0,0,3:00 -122,Antarctica/Palmer,1989,ChileAQ,-240,60,10,9,0,0,4:00,3,9,0,0,3:00 -123,Antarctica/Palmer,1990,ChileAQ,-240,60,9,16,-1,0,4:00,3,18,-1,0,3:00 -124,Antarctica/Palmer,1991,ChileAQ,-240,60,10,9,0,0,4:00,3,9,0,0,3:00 -125,Antarctica/Palmer,1997,ChileAQ,-240,60,10,9,0,0,4:00,3,30,-1,0,3:00 -126,Antarctica/Palmer,1998,ChileAQ,-240,60,9,27,-1,0,4:00,3,9,0,0,3:00 -127,Antarctica/Palmer,1999,ChileAQ,-240,60,10,9,0,0,4:00,4,4,-1,0,3:00 -128,Antarctica/Palmer,2000,ChileAQ,-240,60,10,9,0,0,4:00,3,9,0,0,3:00 -129,Antarctica/McMurdo,1970,NZAQ,720,0,0,0,0,0,,0,0,0,0, -130,Antarctica/McMurdo,1974,NZAQ,720,60,11,3,-1,0,14:00,1,1,-1,0,23:00 -131,Antarctica/McMurdo,1975,NZAQ,720,60,10,-1,0,0,14:00,2,23,-1,0,14:00 -132,Antarctica/McMurdo,1976,NZAQ,720,60,10,-1,0,0,14:00,3,1,0,0,14:00 -133,Antarctica/McMurdo,1989,NZAQ,720,60,10,8,-1,0,14:00,3,1,0,0,14:00 -134,Antarctica/McMurdo,1990,NZAQ,720,60,10,1,0,0,14:00,3,15,0,0,14:00 -135,Asia/Kabul,1970,,270,0,0,0,0,0,,0,0,0,0, -136,Asia/Yerevan,1970,RussiaAsia,240,0,0,0,0,0,,0,0,0,0, -137,Asia/Yerevan,1981,RussiaAsia,240,60,4,1,-1,0,04:00,10,1,-1,0,03:00 -138,Asia/Yerevan,1984,RussiaAsia,240,60,4,1,-1,0,04:00,9,-1,0,0,06:00 -139,Asia/Yerevan,1985,RussiaAsia,240,60,3,-1,0,0,06:00,9,-1,0,0,06:00 -140,Asia/Yerevan,1991,RussiaAsia,180,60,3,-1,0,0,05:00,9,-1,0,0,05:00 -141,Asia/Yerevan,1992,RussiaAsia,180,60,3,-1,6,0,26:00,9,-1,6,0,25:00 -142,Asia/Yerevan,1993,RussiaAsia,180,60,3,-1,0,0,05:00,9,-1,0,0,05:00 -143,Asia/Yerevan,1995,,240,0,0,0,0,0,,0,0,0,0, -144,Asia/Yerevan,1997,RussiaAsia,240,60,3,-1,0,0,06:00,10,-1,0,0,06:00 -145,Asia/Baku,1970,RussiaAsia,240,0,0,0,0,0,,0,0,0,0, -146,Asia/Baku,1981,RussiaAsia,240,60,4,1,-1,0,04:00,10,1,-1,0,03:00 -147,Asia/Baku,1984,RussiaAsia,240,60,4,1,-1,0,04:00,9,-1,0,0,06:00 -148,Asia/Baku,1985,RussiaAsia,240,60,3,-1,0,0,06:00,9,-1,0,0,06:00 -149,Asia/Baku,1991,RussiaAsia,180,60,3,-1,0,0,05:00,9,-1,0,0,05:00 -150,Asia/Baku,1992,,240,0,0,0,0,0,,0,0,0,0, -151,Asia/Baku,1996,EUAsia,240,60,3,-1,0,0,1:00,10,-1,0,0,1:00 -152,Asia/Baku,1997,Azer,240,60,3,-1,0,0,08:00,10,-1,0,0,08:00 -153,Asia/Bahrain,1970,,240,0,0,0,0,0,,0,0,0,0, -154,Asia/Bahrain,1972,,180,0,0,0,0,0,,0,0,0,0, -155,Asia/Dhaka,1970,,360,0,0,0,0,0,,0,0,0,0, -156,Asia/Dhaka,1971,,360,0,0,0,0,0,,0,0,0,0, -157,Asia/Thimphu,1970,,330,0,0,0,0,0,,0,0,0,0, -158,Asia/Thimphu,1987,,360,0,0,0,0,0,,0,0,0,0, -159,Indian/Chagos,1970,,300,0,0,0,0,0,,0,0,0,0, -160,Indian/Chagos,1996,,360,0,0,0,0,0,,0,0,0,0, -161,Asia/Brunei,1970,,480,0,0,0,0,0,,0,0,0,0, -162,Asia/Rangoon,1970,,390,0,0,0,0,0,,0,0,0,0, -163,Asia/Phnom_Penh,1970,,420,0,0,0,0,0,,0,0,0,0, -164,Asia/Harbin,1970,,510,0,0,0,0,0,,0,0,0,0, -165,Asia/Harbin,1980,PRC,480,0,0,0,0,0,,0,0,0,0, -166,Asia/Harbin,1986,PRC,480,60,5,4,-1,0,08:00,9,11,0,0,07:00 -167,Asia/Harbin,1987,PRC,480,60,4,10,0,0,08:00,9,11,0,0,07:00 -168,Asia/Harbin,1991,PRC,480,0,4,10,0,0,08:00,9,11,0,0,07:00 -169,Asia/Shanghai,1970,PRC,480,0,0,0,0,0,,0,0,0,0, -170,Asia/Shanghai,1986,PRC,480,60,5,4,-1,0,08:00,9,11,0,0,07:00 -171,Asia/Shanghai,1987,PRC,480,60,4,10,0,0,08:00,9,11,0,0,07:00 -172,Asia/Shanghai,1991,PRC,480,0,4,10,0,0,08:00,9,11,0,0,07:00 -173,Asia/Chongqing,1970,,420,0,0,0,0,0,,0,0,0,0, -174,Asia/Chongqing,1980,PRC,480,0,0,0,0,0,,0,0,0,0, -175,Asia/Chongqing,1986,PRC,480,60,5,4,-1,0,08:00,9,11,0,0,07:00 -176,Asia/Chongqing,1987,PRC,480,60,4,10,0,0,08:00,9,11,0,0,07:00 -177,Asia/Chongqing,1991,PRC,480,0,4,10,0,0,08:00,9,11,0,0,07:00 -178,Asia/Urumqi,1970,,360,0,0,0,0,0,,0,0,0,0, -179,Asia/Urumqi,1980,PRC,480,0,0,0,0,0,,0,0,0,0, -180,Asia/Urumqi,1986,PRC,480,60,5,4,-1,0,08:00,9,11,0,0,07:00 -181,Asia/Urumqi,1987,PRC,480,60,4,10,0,0,08:00,9,11,0,0,07:00 -182,Asia/Urumqi,1991,PRC,480,0,4,10,0,0,08:00,9,11,0,0,07:00 -183,Asia/Kashgar,1970,,300,0,0,0,0,0,,0,0,0,0, -184,Asia/Kashgar,1980,PRC,480,0,0,0,0,0,,0,0,0,0, -185,Asia/Kashgar,1986,PRC,480,60,5,4,-1,0,08:00,9,11,0,0,07:00 -186,Asia/Kashgar,1987,PRC,480,60,4,10,0,0,08:00,9,11,0,0,07:00 -187,Asia/Kashgar,1991,PRC,480,0,4,10,0,0,08:00,9,11,0,0,07:00 -188,Asia/Hong_Kong,1970,HK,480,60,4,16,0,0,11:30,10,16,0,0,10:30 -189,Asia/Hong_Kong,1979,HK,480,60,5,8,0,0,11:30,10,16,0,0,10:30 -190,Asia/Hong_Kong,1980,HK,480,0,5,8,0,0,11:30,10,16,0,0,10:30 -191,Asia/Taipei,1970,Taiwan,480,60,6,1,-1,0,08:00,10,1,-1,0,07:00 -192,Asia/Taipei,1974,Taiwan,480,60,4,1,-1,0,08:00,10,1,-1,0,07:00 -193,Asia/Taipei,1980,Taiwan,480,60,6,30,-1,0,08:00,9,30,-1,0,07:00 -194,Asia/Taipei,1981,Taiwan,480,0,6,30,-1,0,08:00,9,30,-1,0,07:00 -195,Asia/Macau,1970,Macau,480,60,4,16,0,0,11:30,10,16,0,0,10:30 -196,Asia/Macau,1972,Macau,480,60,4,15,0,0,08:00,10,15,0,0,07:00 -197,Asia/Macau,1974,Macau,480,60,4,15,0,0,08:00,10,15,0,0,10:30 -198,Asia/Macau,1975,Macau,480,60,4,15,0,0,11:30,10,15,0,0,10:30 -199,Asia/Macau,1978,Macau,480,60,4,15,0,0,08:00,10,15,0,0,07:00 -200,Asia/Macau,1980,Macau,480,0,4,15,0,0,08:00,10,15,0,0,07:00 -201,Asia/Macau,1999,PRC,480,0,4,15,0,0,08:00,10,15,0,0,07:00 -202,Asia/Nicosia,1970,Cyprus,120,0,0,0,0,0,,0,0,0,0, -203,Asia/Nicosia,1975,Cyprus,120,60,4,13,-1,0,02:00,10,12,-1,0,01:00 -204,Asia/Nicosia,1976,Cyprus,120,60,5,15,-1,0,02:00,10,11,-1,0,01:00 -205,Asia/Nicosia,1977,Cyprus,120,60,4,1,0,0,02:00,9,25,-1,0,01:00 -206,Asia/Nicosia,1978,Cyprus,120,60,4,1,0,0,02:00,10,2,-1,0,01:00 -207,Asia/Nicosia,1979,Cyprus,120,60,4,1,0,0,02:00,9,-1,0,0,01:00 -208,Asia/Nicosia,1981,Cyprus,120,60,3,-1,0,0,02:00,9,-1,0,0,01:00 -209,Asia/Nicosia,1998,EUAsia,120,60,3,-1,0,0,1:00,10,-1,0,0,1:00 -210,Asia/Tbilisi,1970,RussiaAsia,240,0,0,0,0,0,,0,0,0,0, -211,Asia/Tbilisi,1981,RussiaAsia,240,60,4,1,-1,0,04:00,10,1,-1,0,03:00 -212,Asia/Tbilisi,1984,RussiaAsia,240,60,4,1,-1,0,04:00,9,-1,0,0,06:00 -213,Asia/Tbilisi,1985,RussiaAsia,240,60,3,-1,0,0,06:00,9,-1,0,0,06:00 -214,Asia/Tbilisi,1991,RussiaAsia,180,60,3,-1,0,0,05:00,9,-1,0,0,05:00 -215,Asia/Tbilisi,1992,E-EurAsia,180,60,3,-1,0,0,03:00,9,-1,0,0,02:00 -216,Asia/Tbilisi,1994,E-EurAsia,240,60,3,-1,0,0,04:00,9,-1,0,0,03:00 -217,Asia/Tbilisi,1995,E-EurAsia,240,0,12,31,-1,0,16:00,9,-1,0,0,03:00 -218,Asia/Tbilisi,1996,,240,0,0,0,0,0,,0,0,0,0, -219,Asia/Tbilisi,1997,E-EurAsia,240,60,3,-1,0,0,04:00,10,-1,0,0,03:00 -220,Asia/Tbilisi,2004,RussiaAsia,180,60,3,-1,0,0,05:00,10,-1,0,0,05:00 -221,Asia/Tbilisi,2005,,240,0,0,0,0,0,,0,0,0,0, -222,Asia/Dili,1970,,540,0,0,0,0,0,,0,0,0,0, -223,Asia/Dili,1976,,480,0,0,0,0,0,,0,0,0,0, -224,Asia/Dili,2000,,540,0,0,0,0,0,,0,0,0,0, -225,Asia/Calcutta,1970,,330,0,0,0,0,0,,0,0,0,0, -226,Asia/Jakarta,1970,,420,0,0,0,0,0,,0,0,0,0, -227,Asia/Pontianak,1970,,480,0,0,0,0,0,,0,0,0,0, -228,Asia/Pontianak,1988,,420,0,0,0,0,0,,0,0,0,0, -229,Asia/Makassar,1970,,480,0,0,0,0,0,,0,0,0,0, -230,Asia/Jayapura,1970,,540,0,0,0,0,0,,0,0,0,0, -231,Asia/Tehran,1970,,210,0,0,0,0,0,,0,0,0,0, -232,Asia/Tehran,1977,Iran,240,0,0,0,0,0,,0,0,0,0, -233,Asia/Tehran,1978,Iran,240,60,3,21,-1,0,04:00,10,21,-1,0,03:00 -234,Asia/Tehran,1979,Iran,210,60,3,21,-1,0,03:30,9,19,-1,0,02:30 -235,Asia/Tehran,1980,Iran,210,60,3,21,-1,0,03:30,9,23,-1,0,02:30 -236,Asia/Tehran,1991,Iran,210,60,5,3,-1,0,03:30,9,22,-1,0,02:30 -237,Asia/Tehran,1992,Iran,210,60,3,22,-1,0,03:30,9,22,-1,0,02:30 -238,Asia/Tehran,1996,Iran,210,60,3,21,-1,0,03:30,9,21,-1,0,02:30 -239,Asia/Tehran,1997,Iran,210,60,3,22,-1,0,03:30,9,22,-1,0,02:30 -240,Asia/Tehran,2000,Iran,210,60,3,21,-1,0,03:30,9,21,-1,0,02:30 -241,Asia/Tehran,2001,Iran,210,60,3,22,-1,0,03:30,9,22,-1,0,02:30 -242,Asia/Tehran,2004,Iran,210,60,3,21,-1,0,03:30,9,21,-1,0,02:30 -243,Asia/Tehran,2005,Iran,210,60,3,22,-1,0,03:30,9,22,-1,0,02:30 -244,Asia/Tehran,2006,Iran,210,0,3,22,-1,0,03:30,9,22,-1,0,02:30 -245,Asia/Baghdad,1970,,180,0,0,0,0,0,,0,0,0,0, -246,Asia/Baghdad,1982,Iraq,180,60,5,1,-1,0,03:00,10,1,-1,0,02:00 -247,Asia/Baghdad,1983,Iraq,180,60,3,31,-1,0,03:00,10,1,-1,0,02:00 -248,Asia/Baghdad,1984,Iraq,180,60,4,1,-1,0,03:00,10,1,-1,0,02:00 -249,Asia/Baghdad,1985,Iraq,180,60,4,1,-1,0,03:00,9,-1,0,0,04:00 -250,Asia/Baghdad,1986,Iraq,180,60,3,-1,0,0,04:00,9,-1,0,0,04:00 -251,Asia/Baghdad,1991,Iraq,180,60,4,1,-1,0,06:00,10,1,-1,0,06:00 -252,Asia/Jerusalem,1970,Zion,120,60,4,29,-1,0,04:00,9,22,-1,0,01:00 -253,Asia/Jerusalem,1974,Zion,120,60,7,7,-1,0,02:00,10,13,-1,0,01:00 -254,Asia/Jerusalem,1975,Zion,120,60,4,20,-1,0,02:00,8,31,-1,0,01:00 -255,Asia/Jerusalem,1985,Zion,120,60,4,14,-1,0,02:00,9,15,-1,0,01:00 -256,Asia/Jerusalem,1986,Zion,120,60,5,18,-1,0,02:00,9,7,-1,0,01:00 -257,Asia/Jerusalem,1987,Zion,120,60,4,15,-1,0,02:00,9,13,-1,0,01:00 -258,Asia/Jerusalem,1988,Zion,120,60,4,9,-1,0,02:00,9,3,-1,0,01:00 -259,Asia/Jerusalem,1989,Zion,120,60,4,30,-1,0,02:00,9,3,-1,0,01:00 -260,Asia/Jerusalem,1990,Zion,120,60,3,25,-1,0,02:00,8,26,-1,0,01:00 -261,Asia/Jerusalem,1991,Zion,120,60,3,24,-1,0,02:00,9,1,-1,0,01:00 -262,Asia/Jerusalem,1992,Zion,120,60,3,29,-1,0,02:00,9,6,-1,0,01:00 -263,Asia/Jerusalem,1993,Zion,120,60,4,2,-1,0,02:00,9,5,-1,0,01:00 -264,Asia/Jerusalem,1994,Zion,120,60,4,1,-1,0,02:00,8,28,-1,0,01:00 -265,Asia/Jerusalem,1995,Zion,120,60,3,31,-1,0,02:00,9,3,-1,0,01:00 -266,Asia/Jerusalem,1996,Zion,120,60,3,15,-1,0,02:00,9,16,-1,0,01:00 -267,Asia/Jerusalem,1997,Zion,120,60,3,21,-1,0,02:00,9,14,-1,0,01:00 -268,Asia/Jerusalem,1998,Zion,120,60,3,20,-1,0,02:00,9,6,-1,0,01:00 -269,Asia/Jerusalem,1999,Zion,120,60,4,2,-1,0,04:00,9,3,-1,0,03:00 -270,Asia/Jerusalem,2000,Zion,120,60,4,14,-1,0,04:00,10,6,-1,0,02:00 -271,Asia/Jerusalem,2001,Zion,120,60,4,9,-1,0,03:00,9,24,-1,0,02:00 -272,Asia/Jerusalem,2002,Zion,120,60,3,29,-1,0,03:00,10,7,-1,0,02:00 -273,Asia/Jerusalem,2003,Zion,120,60,3,28,-1,0,03:00,10,3,-1,0,02:00 -274,Asia/Jerusalem,2004,Zion,120,60,4,7,-1,0,03:00,9,22,-1,0,02:00 -275,Asia/Jerusalem,2005,Zion,120,60,4,1,-1,0,04:00,10,9,-1,0,03:00 -276,Asia/Jerusalem,2006,Zion,120,60,3,26,5,0,04:00,10,1,-1,0,03:00 -277,Asia/Jerusalem,2007,Zion,120,60,3,26,5,0,04:00,9,16,-1,0,03:00 -278,Asia/Jerusalem,2008,Zion,120,60,3,26,5,0,04:00,10,5,-1,0,03:00 -279,Asia/Jerusalem,2009,Zion,120,60,3,26,5,0,04:00,9,27,-1,0,03:00 -280,Asia/Jerusalem,2010,Zion,120,60,3,26,5,0,04:00,9,12,-1,0,03:00 -281,Asia/Jerusalem,2011,Zion,120,60,4,1,-1,0,04:00,10,2,-1,0,03:00 -282,Asia/Jerusalem,2012,Zion,120,60,3,26,5,0,04:00,9,23,-1,0,03:00 -283,Asia/Jerusalem,2013,Zion,120,60,3,26,5,0,04:00,9,8,-1,0,03:00 -284,Asia/Jerusalem,2014,Zion,120,60,3,26,5,0,04:00,9,28,-1,0,03:00 -285,Asia/Jerusalem,2015,Zion,120,60,3,26,5,0,04:00,9,20,-1,0,03:00 -286,Asia/Jerusalem,2016,Zion,120,60,4,1,-1,0,04:00,10,9,-1,0,03:00 -287,Asia/Tokyo,1970,Japan,540,0,5,1,0,0,11:00,9,8,6,0,10:00 -288,Asia/Amman,1970,Jordan,120,0,0,0,0,0,,0,0,0,0, -289,Asia/Amman,1973,Jordan,120,60,6,6,-1,0,02:00,10,1,-1,0,01:00 -290,Asia/Amman,1974,Jordan,120,60,5,1,-1,0,02:00,10,1,-1,0,01:00 -291,Asia/Amman,1976,Jordan,120,60,5,1,-1,0,02:00,11,1,-1,0,01:00 -292,Asia/Amman,1977,Jordan,120,60,5,1,-1,0,02:00,10,1,-1,0,01:00 -293,Asia/Amman,1978,Jordan,120,60,4,30,-1,0,02:00,9,30,-1,0,01:00 -294,Asia/Amman,1985,Jordan,120,60,4,1,-1,0,02:00,10,1,-1,0,01:00 -295,Asia/Amman,1986,Jordan,120,60,4,1,5,0,02:00,10,1,5,0,01:00 -296,Asia/Amman,1989,Jordan,120,60,5,8,-1,0,02:00,10,1,5,0,01:00 -297,Asia/Amman,1990,Jordan,120,60,4,27,-1,0,02:00,10,1,5,0,01:00 -298,Asia/Amman,1991,Jordan,120,60,4,17,-1,0,02:00,9,27,-1,0,01:00 -299,Asia/Amman,1992,Jordan,120,60,4,10,-1,0,02:00,10,1,5,0,01:00 -300,Asia/Amman,1993,Jordan,120,60,4,1,5,0,02:00,10,1,5,0,01:00 -301,Asia/Amman,1994,Jordan,120,60,4,1,5,0,02:00,9,15,5,0,01:00 -302,Asia/Amman,1995,Jordan,120,60,4,1,5,0,02:00,9,15,5,0,02:00 -303,Asia/Amman,1999,Jordan,120,60,7,1,-1,0,02:00,9,-1,4,0,02:00 -304,Asia/Amman,2000,Jordan,120,60,3,-1,4,0,02:00,9,-1,4,0,02:00 -305,Asia/Amman,2003,Jordan,120,60,3,-1,4,0,02:00,10,24,-1,0,02:00 -306,Asia/Amman,2004,Jordan,120,60,3,-1,4,0,02:00,10,15,-1,0,02:00 -307,Asia/Amman,2005,Jordan,120,60,3,-1,4,0,02:00,9,-1,5,0,02:00 -308,Asia/Amman,2006,Jordan,120,60,3,-1,4,0,02:00,10,-1,5,0,02:00 -309,Asia/Almaty,1970,RussiaAsia,360,0,0,0,0,0,,0,0,0,0, -310,Asia/Almaty,1981,RussiaAsia,360,60,4,1,-1,0,06:00,10,1,-1,0,05:00 -311,Asia/Almaty,1984,RussiaAsia,360,60,4,1,-1,0,06:00,9,-1,0,0,08:00 -312,Asia/Almaty,1985,RussiaAsia,360,60,3,-1,0,0,08:00,9,-1,0,0,08:00 -313,Asia/Almaty,1991,,360,0,0,0,0,0,,0,0,0,0, -314,Asia/Almaty,1992,RussiaAsia,360,60,3,-1,6,0,29:00,9,-1,6,0,28:00 -315,Asia/Almaty,1993,RussiaAsia,360,60,3,-1,0,0,08:00,9,-1,0,0,08:00 -316,Asia/Almaty,1996,RussiaAsia,360,60,3,-1,0,0,08:00,10,-1,0,0,08:00 -317,Asia/Almaty,2005,,360,0,0,0,0,0,,0,0,0,0, -318,Asia/Qyzylorda,1970,,300,0,0,0,0,0,,0,0,0,0, -319,Asia/Qyzylorda,1981,,360,0,0,0,0,0,,0,0,0,0, -320,Asia/Qyzylorda,1982,RussiaAsia,300,60,4,1,-1,0,05:00,10,1,-1,0,04:00 -321,Asia/Qyzylorda,1984,RussiaAsia,300,60,4,1,-1,0,05:00,9,-1,0,0,07:00 -322,Asia/Qyzylorda,1985,RussiaAsia,300,60,3,-1,0,0,07:00,9,-1,0,0,07:00 -323,Asia/Qyzylorda,1991,,300,0,0,0,0,0,,0,0,0,0, -324,Asia/Qyzylorda,1992,RussiaAsia,360,60,3,-1,6,0,29:00,9,-1,6,0,28:00 -325,Asia/Qyzylorda,1993,RussiaAsia,360,60,3,-1,0,0,08:00,9,-1,0,0,08:00 -326,Asia/Qyzylorda,1996,RussiaAsia,360,60,3,-1,0,0,08:00,10,-1,0,0,08:00 -327,Asia/Qyzylorda,2005,,360,0,0,0,0,0,,0,0,0,0, -328,Asia/Aqtobe,1970,,300,0,0,0,0,0,,0,0,0,0, -329,Asia/Aqtobe,1981,,360,0,0,0,0,0,,0,0,0,0, -330,Asia/Aqtobe,1982,RussiaAsia,300,60,4,1,-1,0,05:00,10,1,-1,0,04:00 -331,Asia/Aqtobe,1984,RussiaAsia,300,60,4,1,-1,0,05:00,9,-1,0,0,07:00 -332,Asia/Aqtobe,1985,RussiaAsia,300,60,3,-1,0,0,07:00,9,-1,0,0,07:00 -333,Asia/Aqtobe,1992,RussiaAsia,300,60,3,-1,6,0,28:00,9,-1,6,0,27:00 -334,Asia/Aqtobe,1993,RussiaAsia,300,60,3,-1,0,0,07:00,9,-1,0,0,07:00 -335,Asia/Aqtobe,1996,RussiaAsia,300,60,3,-1,0,0,07:00,10,-1,0,0,07:00 -336,Asia/Aqtobe,2005,,300,0,0,0,0,0,,0,0,0,0, -337,Asia/Aqtau,1970,,300,0,0,0,0,0,,0,0,0,0, -338,Asia/Aqtau,1981,,360,0,0,0,0,0,,0,0,0,0, -339,Asia/Aqtau,1982,RussiaAsia,300,60,4,1,-1,0,05:00,10,1,-1,0,04:00 -340,Asia/Aqtau,1984,RussiaAsia,300,60,4,1,-1,0,05:00,9,-1,0,0,07:00 -341,Asia/Aqtau,1985,RussiaAsia,300,60,3,-1,0,0,07:00,9,-1,0,0,07:00 -342,Asia/Aqtau,1992,RussiaAsia,300,60,3,-1,6,0,28:00,9,-1,6,0,27:00 -343,Asia/Aqtau,1993,RussiaAsia,300,60,3,-1,0,0,07:00,9,-1,0,0,07:00 -344,Asia/Aqtau,1995,RussiaAsia,240,60,3,-1,0,0,06:00,9,-1,0,0,06:00 -345,Asia/Aqtau,1996,RussiaAsia,240,60,3,-1,0,0,06:00,10,-1,0,0,06:00 -346,Asia/Aqtau,2005,,300,0,0,0,0,0,,0,0,0,0, -347,Asia/Oral,1970,,300,0,0,0,0,0,,0,0,0,0, -348,Asia/Oral,1981,,360,0,0,0,0,0,,0,0,0,0, -349,Asia/Oral,1982,RussiaAsia,300,60,4,1,-1,0,05:00,10,1,-1,0,04:00 -350,Asia/Oral,1984,RussiaAsia,300,60,4,1,-1,0,05:00,9,-1,0,0,07:00 -351,Asia/Oral,1985,RussiaAsia,300,60,3,-1,0,0,07:00,9,-1,0,0,07:00 -352,Asia/Oral,1989,RussiaAsia,240,60,3,-1,0,0,06:00,9,-1,0,0,06:00 -353,Asia/Oral,1992,RussiaAsia,240,60,3,-1,6,0,27:00,9,-1,6,0,26:00 -354,Asia/Oral,1993,RussiaAsia,240,60,3,-1,0,0,06:00,9,-1,0,0,06:00 -355,Asia/Oral,1996,RussiaAsia,240,60,3,-1,0,0,06:00,10,-1,0,0,06:00 -356,Asia/Oral,2005,,300,0,0,0,0,0,,0,0,0,0, -357,Asia/Bishkek,1970,RussiaAsia,360,0,0,0,0,0,,0,0,0,0, -358,Asia/Bishkek,1981,RussiaAsia,360,60,4,1,-1,0,06:00,10,1,-1,0,05:00 -359,Asia/Bishkek,1984,RussiaAsia,360,60,4,1,-1,0,06:00,9,-1,0,0,08:00 -360,Asia/Bishkek,1985,RussiaAsia,360,60,3,-1,0,0,08:00,9,-1,0,0,08:00 -361,Asia/Bishkek,1991,Kyrgyz,300,60,3,-1,0,0,07:00,9,-1,0,0,07:00 -362,Asia/Bishkek,1992,Kyrgyz,300,60,4,7,0,0,05:00,9,-1,0,0,04:00 -363,Asia/Bishkek,1997,Kyrgyz,300,60,3,-1,0,0,07:30,10,-1,0,0,06:30 -364,Asia/Bishkek,2005,,360,0,0,0,0,0,,0,0,0,0, -365,Asia/Seoul,1970,ROK,540,60,5,15,-1,0,09:00,9,13,-1,0,08:00 -366,Asia/Seoul,1987,ROK,540,60,5,8,0,0,09:00,10,8,0,0,08:00 -367,Asia/Seoul,1988,ROK,540,0,5,8,0,0,09:00,10,8,0,0,08:00 -368,Asia/Pyongyang,1970,,540,0,0,0,0,0,,0,0,0,0, -369,Asia/Kuwait,1970,,180,0,0,0,0,0,,0,0,0,0, -370,Asia/Vientiane,1970,,420,0,0,0,0,0,,0,0,0,0, -371,Asia/Beirut,1970,Lebanon,120,60,5,1,-1,0,02:00,10,1,-1,0,01:00 -372,Asia/Beirut,1972,Lebanon,120,60,6,22,-1,0,02:00,10,1,-1,0,01:00 -373,Asia/Beirut,1973,Lebanon,120,60,5,1,-1,0,02:00,10,1,-1,0,01:00 -374,Asia/Beirut,1978,Lebanon,120,60,4,30,-1,0,02:00,9,30,-1,0,01:00 -375,Asia/Beirut,1984,Lebanon,120,60,5,1,-1,0,02:00,10,16,-1,0,01:00 -376,Asia/Beirut,1988,Lebanon,120,60,6,1,-1,0,02:00,10,16,-1,0,01:00 -377,Asia/Beirut,1989,Lebanon,120,60,5,10,-1,0,02:00,10,16,-1,0,01:00 -378,Asia/Beirut,1990,Lebanon,120,60,5,1,-1,0,02:00,10,16,-1,0,01:00 -379,Asia/Beirut,1992,Lebanon,120,60,5,1,-1,0,02:00,10,4,-1,0,01:00 -380,Asia/Beirut,1993,Lebanon,120,60,3,-1,0,0,02:00,9,-1,0,0,01:00 -381,Asia/Beirut,1999,Lebanon,120,60,3,-1,0,0,02:00,10,-1,0,0,01:00 -382,Asia/Kuala_Lumpur,1970,,450,0,0,0,0,0,,0,0,0,0, -383,Asia/Kuala_Lumpur,1982,,480,0,0,0,0,0,,0,0,0,0, -384,Asia/Kuching,1970,,480,0,0,0,0,0,,0,0,0,0, -385,Asia/Kuching,1982,,480,0,0,0,0,0,,0,0,0,0, -386,Indian/Maldives,1970,,300,0,0,0,0,0,,0,0,0,0, -387,Asia/Hovd,1970,,360,0,0,0,0,0,,0,0,0,0, -388,Asia/Hovd,1978,Mongol,420,0,0,0,0,0,,0,0,0,0, -389,Asia/Hovd,1983,Mongol,420,60,4,1,-1,0,07:00,10,1,-1,0,06:00 -390,Asia/Hovd,1984,Mongol,420,60,4,1,-1,0,07:00,9,-1,0,0,06:00 -391,Asia/Hovd,1985,Mongol,420,60,3,-1,0,0,07:00,9,-1,0,0,06:00 -392,Asia/Hovd,2001,Mongol,420,60,4,-1,6,0,09:00,9,-1,6,0,08:00 -393,Asia/Hovd,2002,Mongol,420,60,3,-1,6,0,09:00,9,-1,6,0,08:00 -394,Asia/Ulaanbaatar,1970,,420,0,0,0,0,0,,0,0,0,0, -395,Asia/Ulaanbaatar,1978,Mongol,480,0,0,0,0,0,,0,0,0,0, -396,Asia/Ulaanbaatar,1983,Mongol,480,60,4,1,-1,0,08:00,10,1,-1,0,07:00 -397,Asia/Ulaanbaatar,1984,Mongol,480,60,4,1,-1,0,08:00,9,-1,0,0,07:00 -398,Asia/Ulaanbaatar,1985,Mongol,480,60,3,-1,0,0,08:00,9,-1,0,0,07:00 -399,Asia/Ulaanbaatar,2001,Mongol,480,60,4,-1,6,0,10:00,9,-1,6,0,09:00 -400,Asia/Ulaanbaatar,2002,Mongol,480,60,3,-1,6,0,10:00,9,-1,6,0,09:00 -401,Asia/Choibalsan,1970,,420,0,0,0,0,0,,0,0,0,0, -402,Asia/Choibalsan,1978,,480,0,0,0,0,0,,0,0,0,0, -403,Asia/Choibalsan,1983,Mongol,540,60,4,1,-1,0,09:00,10,1,-1,0,08:00 -404,Asia/Choibalsan,1984,Mongol,540,60,4,1,-1,0,09:00,9,-1,0,0,08:00 -405,Asia/Choibalsan,1985,Mongol,540,60,3,-1,0,0,09:00,9,-1,0,0,08:00 -406,Asia/Choibalsan,2001,Mongol,540,60,4,-1,6,0,11:00,9,-1,6,0,10:00 -407,Asia/Choibalsan,2002,Mongol,540,60,3,-1,6,0,11:00,9,-1,6,0,10:00 -408,Asia/Katmandu,1970,,330,0,0,0,0,0,,0,0,0,0, -409,Asia/Katmandu,1986,,345,0,0,0,0,0,,0,0,0,0, -410,Asia/Muscat,1970,,240,0,0,0,0,0,,0,0,0,0, -411,Asia/Karachi,1970,,300,0,0,0,0,0,,0,0,0,0, -412,Asia/Karachi,1971,Pakistan,300,0,0,0,0,0,,0,0,0,0, -413,Asia/Karachi,2002,Pakistan,300,60,4,2,0,0,05:01,10,2,0,0,04:01 -414,Asia/Karachi,2003,Pakistan,300,0,4,2,0,0,05:01,10,2,0,0,04:01 -415,Asia/Gaza,1970,Zion,120,60,4,29,-1,0,04:00,9,22,-1,0,01:00 -416,Asia/Gaza,1974,Zion,120,60,7,7,-1,0,02:00,10,13,-1,0,01:00 -417,Asia/Gaza,1975,Zion,120,60,4,20,-1,0,02:00,8,31,-1,0,01:00 -418,Asia/Gaza,1985,Zion,120,60,4,14,-1,0,02:00,9,15,-1,0,01:00 -419,Asia/Gaza,1986,Zion,120,60,5,18,-1,0,02:00,9,7,-1,0,01:00 -420,Asia/Gaza,1987,Zion,120,60,4,15,-1,0,02:00,9,13,-1,0,01:00 -421,Asia/Gaza,1988,Zion,120,60,4,9,-1,0,02:00,9,3,-1,0,01:00 -422,Asia/Gaza,1989,Zion,120,60,4,30,-1,0,02:00,9,3,-1,0,01:00 -423,Asia/Gaza,1990,Zion,120,60,3,25,-1,0,02:00,8,26,-1,0,01:00 -424,Asia/Gaza,1991,Zion,120,60,3,24,-1,0,02:00,9,1,-1,0,01:00 -425,Asia/Gaza,1992,Zion,120,60,3,29,-1,0,02:00,9,6,-1,0,01:00 -426,Asia/Gaza,1993,Zion,120,60,4,2,-1,0,02:00,9,5,-1,0,01:00 -427,Asia/Gaza,1994,Zion,120,60,4,1,-1,0,02:00,8,28,-1,0,01:00 -428,Asia/Gaza,1995,Zion,120,60,3,31,-1,0,02:00,9,3,-1,0,01:00 -429,Asia/Gaza,1996,Jordan,120,60,4,1,5,0,02:00,9,15,5,0,02:00 -430,Asia/Gaza,1999,Palestine,120,60,4,15,5,0,02:00,10,15,5,0,01:00 -431,Asia/Gaza,2004,Palestine,120,60,4,15,5,0,02:00,10,1,-1,0,02:00 -432,Asia/Gaza,2005,Palestine,120,60,4,15,5,0,02:00,10,4,-1,0,03:00 -433,Asia/Gaza,2006,Palestine,120,60,4,1,-1,0,02:00,9,22,-1,0,01:00 -434,Asia/Gaza,2007,Palestine,120,60,4,1,-1,0,02:00,10,15,5,0,01:00 -435,Asia/Manila,1970,Phil,480,60,4,12,-1,0,08:00,7,1,-1,0,07:00 -436,Asia/Manila,1978,Phil,480,60,3,22,-1,0,08:00,9,21,-1,0,07:00 -437,Asia/Manila,1979,Phil,480,0,3,22,-1,0,08:00,9,21,-1,0,07:00 -438,Asia/Qatar,1970,,240,0,0,0,0,0,,0,0,0,0, -439,Asia/Qatar,1972,,180,0,0,0,0,0,,0,0,0,0, -440,Asia/Riyadh,1970,,180,0,0,0,0,0,,0,0,0,0, -441,Asia/Singapore,1970,,450,0,0,0,0,0,,0,0,0,0, -442,Asia/Singapore,1982,,480,0,0,0,0,0,,0,0,0,0, -443,Asia/Colombo,1970,,330,0,0,0,0,0,,0,0,0,0, -444,Asia/Colombo,1996,,360,0,0,0,0,0,,0,0,0,0, -445,Asia/Colombo,2006,,330,0,0,0,0,0,,0,0,0,0, -446,Asia/Damascus,1970,Syria,120,60,5,1,-1,0,04:00,10,1,-1,0,03:00 -447,Asia/Damascus,1977,Syria,120,60,5,1,-1,0,04:00,9,1,-1,0,03:00 -448,Asia/Damascus,1983,Syria,120,60,4,9,-1,0,04:00,10,1,-1,0,03:00 -449,Asia/Damascus,1986,Syria,120,60,2,16,-1,0,04:00,10,9,-1,0,03:00 -450,Asia/Damascus,1987,Syria,120,60,3,1,-1,0,04:00,10,31,-1,0,03:00 -451,Asia/Damascus,1988,Syria,120,60,3,15,-1,0,04:00,10,31,-1,0,03:00 -452,Asia/Damascus,1989,Syria,120,60,3,31,-1,0,04:00,10,1,-1,0,03:00 -453,Asia/Damascus,1990,Syria,120,60,4,1,-1,0,04:00,9,30,-1,0,03:00 -454,Asia/Damascus,1991,Syria,120,60,4,1,-1,0,02:00,10,1,-1,0,01:00 -455,Asia/Damascus,1992,Syria,120,60,4,8,-1,0,02:00,10,1,-1,0,01:00 -456,Asia/Damascus,1993,Syria,120,60,3,26,-1,0,02:00,9,25,-1,0,01:00 -457,Asia/Damascus,1994,Syria,120,60,4,1,-1,0,02:00,10,1,-1,0,01:00 -458,Asia/Damascus,1997,Syria,120,60,3,-1,1,0,02:00,10,1,-1,0,01:00 -459,Asia/Damascus,1999,Syria,120,60,4,1,-1,0,02:00,10,1,-1,0,01:00 -460,Asia/Damascus,2006,Syria,120,60,4,1,-1,0,02:00,9,22,-1,0,01:00 -461,Asia/Damascus,2007,Syria,120,60,4,1,-1,0,02:00,10,1,-1,0,01:00 -462,Asia/Dushanbe,1970,RussiaAsia,360,0,0,0,0,0,,0,0,0,0, -463,Asia/Dushanbe,1981,RussiaAsia,360,60,4,1,-1,0,06:00,10,1,-1,0,05:00 -464,Asia/Dushanbe,1984,RussiaAsia,360,60,4,1,-1,0,06:00,9,-1,0,0,08:00 -465,Asia/Dushanbe,1985,RussiaAsia,360,60,3,-1,0,0,08:00,9,-1,0,0,08:00 -466,Asia/Dushanbe,1991,,300,0,0,0,0,0,,0,0,0,0, -467,Asia/Bangkok,1970,,420,0,0,0,0,0,,0,0,0,0, -468,Asia/Ashgabat,1970,RussiaAsia,300,0,0,0,0,0,,0,0,0,0, -469,Asia/Ashgabat,1981,RussiaAsia,300,60,4,1,-1,0,05:00,10,1,-1,0,04:00 -470,Asia/Ashgabat,1984,RussiaAsia,300,60,4,1,-1,0,05:00,9,-1,0,0,07:00 -471,Asia/Ashgabat,1985,RussiaAsia,300,60,3,-1,0,0,07:00,9,-1,0,0,07:00 -472,Asia/Ashgabat,1991,RussiaAsia,240,60,3,-1,0,0,06:00,9,-1,0,0,06:00 -473,Asia/Ashgabat,1992,,300,0,0,0,0,0,,0,0,0,0, -474,Asia/Dubai,1970,,240,0,0,0,0,0,,0,0,0,0, -475,Asia/Samarkand,1970,,300,0,0,0,0,0,,0,0,0,0, -476,Asia/Samarkand,1981,,360,0,0,0,0,0,,0,0,0,0, -477,Asia/Samarkand,1982,RussiaAsia,300,60,4,1,-1,0,05:00,10,1,-1,0,04:00 -478,Asia/Samarkand,1984,RussiaAsia,300,60,4,1,-1,0,05:00,9,-1,0,0,07:00 -479,Asia/Samarkand,1985,RussiaAsia,300,60,3,-1,0,0,07:00,9,-1,0,0,07:00 -480,Asia/Samarkand,1992,,300,0,0,0,0,0,,0,0,0,0, -481,Asia/Tashkent,1970,RussiaAsia,360,0,0,0,0,0,,0,0,0,0, -482,Asia/Tashkent,1981,RussiaAsia,360,60,4,1,-1,0,06:00,10,1,-1,0,05:00 -483,Asia/Tashkent,1984,RussiaAsia,360,60,4,1,-1,0,06:00,9,-1,0,0,08:00 -484,Asia/Tashkent,1985,RussiaAsia,360,60,3,-1,0,0,08:00,9,-1,0,0,08:00 -485,Asia/Tashkent,1991,RussiaAsia,300,60,3,-1,0,0,07:00,9,-1,0,0,07:00 -486,Asia/Tashkent,1992,,300,0,0,0,0,0,,0,0,0,0, -487,Asia/Saigon,1970,,420,0,0,0,0,0,,0,0,0,0, -488,Asia/Aden,1970,,180,0,0,0,0,0,,0,0,0,0, -489,Australia/Darwin,1970,Aus,570,0,12,31,-1,0,21:30,3,-1,0,0,10:30 -490,Australia/Perth,1970,AW,480,0,0,0,0,0,,0,0,0,0, -491,Australia/Perth,1974,AW,480,60,10,-1,0,0,10:00,1,1,-1,0,19:00 -492,Australia/Perth,1975,AW,480,0,12,31,-1,0,20:00,3,1,0,0,10:00 -493,Australia/Perth,1983,AW,480,60,10,-1,0,0,10:00,1,1,-1,0,19:00 -494,Australia/Perth,1984,AW,480,0,12,31,-1,0,20:00,3,1,0,0,10:00 -495,Australia/Perth,1991,AW,480,60,11,17,-1,0,10:00,1,1,-1,0,19:00 -496,Australia/Perth,1992,AW,480,0,12,31,-1,0,20:00,3,1,0,0,10:00 -497,Australia/Perth,2006,AW,480,60,12,3,-1,0,10:00,1,1,-1,0,19:00 -498,Australia/Perth,2007,AW,480,60,10,-1,0,0,10:00,3,-1,0,0,10:00 -499,Australia/Perth,2009,AW,480,0,12,31,-1,0,20:00,3,-1,0,0,10:00 -500,Australia/Eucla,1970,AW,525,0,0,0,0,0,,0,0,0,0, -501,Australia/Eucla,1974,AW,525,60,10,-1,0,0,10:45,1,1,-1,0,19:45 -502,Australia/Eucla,1975,AW,525,0,12,31,-1,0,20:45,3,1,0,0,10:45 -503,Australia/Eucla,1983,AW,525,60,10,-1,0,0,10:45,1,1,-1,0,19:45 -504,Australia/Eucla,1984,AW,525,0,12,31,-1,0,20:45,3,1,0,0,10:45 -505,Australia/Eucla,1991,AW,525,60,11,17,-1,0,10:45,1,1,-1,0,19:45 -506,Australia/Eucla,1992,AW,525,0,12,31,-1,0,20:45,3,1,0,0,10:45 -507,Australia/Eucla,2006,AW,525,60,12,3,-1,0,10:45,1,1,-1,0,19:45 -508,Australia/Eucla,2007,AW,525,60,10,-1,0,0,10:45,3,-1,0,0,10:45 -509,Australia/Eucla,2009,AW,525,0,12,31,-1,0,20:45,3,-1,0,0,10:45 -510,Australia/Brisbane,1970,Aus,600,0,12,31,-1,0,22:00,3,-1,0,0,11:00 -511,Australia/Brisbane,1971,AQ,600,60,10,-1,0,0,12:00,1,1,-1,0,21:00 -512,Australia/Brisbane,1972,AQ,600,0,12,31,-1,0,22:00,2,-1,0,0,12:00 -513,Australia/Brisbane,1989,AQ,600,60,10,-1,0,0,12:00,1,1,-1,0,21:00 -514,Australia/Brisbane,1990,AQ,600,60,10,-1,0,0,12:00,3,1,0,0,12:00 -515,Australia/Brisbane,1992,AQ,600,0,12,31,-1,0,22:00,3,1,0,0,12:00 -516,Australia/Lindeman,1970,Aus,600,0,12,31,-1,0,22:00,3,-1,0,0,11:00 -517,Australia/Lindeman,1971,AQ,600,60,10,-1,0,0,12:00,1,1,-1,0,21:00 -518,Australia/Lindeman,1972,AQ,600,0,12,31,-1,0,22:00,2,-1,0,0,12:00 -519,Australia/Lindeman,1989,AQ,600,60,10,-1,0,0,12:00,1,1,-1,0,21:00 -520,Australia/Lindeman,1990,AQ,600,60,10,-1,0,0,12:00,3,1,0,0,12:00 -521,Australia/Lindeman,1992,Holiday,600,60,10,-1,0,0,12:00,1,1,-1,0,21:00 -522,Australia/Lindeman,1993,Holiday,600,60,10,-1,0,0,12:00,3,1,0,0,12:00 -523,Australia/Lindeman,1994,Holiday,600,0,12,31,-1,0,22:00,3,1,0,0,12:00 -524,Australia/Adelaide,1970,Aus,570,0,12,31,-1,0,21:30,3,-1,0,0,10:30 -525,Australia/Adelaide,1971,AS,570,60,10,-1,0,0,11:30,1,1,-1,0,20:30 -526,Australia/Adelaide,1972,AS,570,60,10,-1,0,0,11:30,2,27,-1,0,11:30 -527,Australia/Adelaide,1973,AS,570,60,10,-1,0,0,11:30,3,1,0,0,11:30 -528,Australia/Adelaide,1986,AS,570,60,10,19,-1,0,11:30,3,15,0,0,11:30 -529,Australia/Adelaide,1987,AS,570,60,10,-1,0,0,11:30,3,15,0,0,11:30 -530,Australia/Adelaide,1990,AS,570,60,10,-1,0,0,11:30,3,18,0,0,11:30 -531,Australia/Adelaide,1991,AS,570,60,10,-1,0,0,11:30,3,1,0,0,11:30 -532,Australia/Adelaide,1992,AS,570,60,10,-1,0,0,11:30,3,18,0,0,11:30 -533,Australia/Adelaide,1993,AS,570,60,10,-1,0,0,11:30,3,1,0,0,11:30 -534,Australia/Adelaide,1994,AS,570,60,10,-1,0,0,11:30,3,18,0,0,11:30 -535,Australia/Adelaide,1995,AS,570,60,10,-1,0,0,11:30,3,-1,0,0,11:30 -536,Australia/Adelaide,2006,AS,570,60,10,-1,0,0,11:30,4,1,0,0,11:30 -537,Australia/Adelaide,2007,AS,570,60,10,-1,0,0,11:30,3,-1,0,0,11:30 -538,Australia/Hobart,1970,AT,600,60,10,-1,0,0,12:00,3,8,0,0,12:00 -539,Australia/Hobart,1972,AT,600,60,10,-1,0,0,12:00,2,-1,0,0,12:00 -540,Australia/Hobart,1973,AT,600,60,10,-1,0,0,12:00,3,1,0,0,12:00 -541,Australia/Hobart,1982,AT,600,60,10,-1,0,0,12:00,3,-1,0,0,12:00 -542,Australia/Hobart,1984,AT,600,60,10,-1,0,0,12:00,3,1,0,0,12:00 -543,Australia/Hobart,1986,AT,600,60,10,15,0,0,12:00,3,1,0,0,12:00 -544,Australia/Hobart,1987,AT,600,60,10,22,0,0,12:00,3,15,0,0,12:00 -545,Australia/Hobart,1988,AT,600,60,10,-1,0,0,12:00,3,15,0,0,12:00 -546,Australia/Hobart,1991,AT,600,60,10,1,0,0,12:00,3,-1,0,0,12:00 -547,Australia/Hobart,2000,AT,600,60,8,-1,0,0,12:00,3,-1,0,0,12:00 -548,Australia/Hobart,2001,AT,600,60,10,1,0,0,12:00,3,-1,0,0,12:00 -549,Australia/Hobart,2006,AT,600,60,10,1,0,0,12:00,4,1,0,0,12:00 -550,Australia/Hobart,2007,AT,600,60,10,1,0,0,12:00,3,-1,0,0,12:00 -551,Australia/Currie,1970,Aus,600,0,12,31,-1,0,22:00,3,-1,0,0,11:00 -552,Australia/Currie,1971,AT,600,60,10,-1,0,0,12:00,3,8,0,0,12:00 -553,Australia/Currie,1972,AT,600,60,10,-1,0,0,12:00,2,-1,0,0,12:00 -554,Australia/Currie,1973,AT,600,60,10,-1,0,0,12:00,3,1,0,0,12:00 -555,Australia/Currie,1982,AT,600,60,10,-1,0,0,12:00,3,-1,0,0,12:00 -556,Australia/Currie,1984,AT,600,60,10,-1,0,0,12:00,3,1,0,0,12:00 -557,Australia/Currie,1986,AT,600,60,10,15,0,0,12:00,3,1,0,0,12:00 -558,Australia/Currie,1987,AT,600,60,10,22,0,0,12:00,3,15,0,0,12:00 -559,Australia/Currie,1988,AT,600,60,10,-1,0,0,12:00,3,15,0,0,12:00 -560,Australia/Currie,1991,AT,600,60,10,1,0,0,12:00,3,-1,0,0,12:00 -561,Australia/Currie,2000,AT,600,60,8,-1,0,0,12:00,3,-1,0,0,12:00 -562,Australia/Currie,2001,AT,600,60,10,1,0,0,12:00,3,-1,0,0,12:00 -563,Australia/Currie,2006,AT,600,60,10,1,0,0,12:00,4,1,0,0,12:00 -564,Australia/Currie,2007,AT,600,60,10,1,0,0,12:00,3,-1,0,0,12:00 -565,Australia/Melbourne,1970,Aus,600,0,12,31,-1,0,22:00,3,-1,0,0,11:00 -566,Australia/Melbourne,1971,AV,600,60,10,-1,0,0,12:00,1,1,-1,0,21:00 -567,Australia/Melbourne,1972,AV,600,60,10,-1,0,0,12:00,2,-1,0,0,12:00 -568,Australia/Melbourne,1973,AV,600,60,10,-1,0,0,12:00,3,1,0,0,12:00 -569,Australia/Melbourne,1986,AV,600,60,10,15,0,0,12:00,3,15,0,0,12:00 -570,Australia/Melbourne,1988,AV,600,60,10,-1,0,0,12:00,3,15,0,0,12:00 -571,Australia/Melbourne,1991,AV,600,60,10,-1,0,0,12:00,3,1,0,0,12:00 -572,Australia/Melbourne,1995,AV,600,60,10,-1,0,0,12:00,3,-1,0,0,12:00 -573,Australia/Melbourne,2000,AV,600,60,8,-1,0,0,12:00,3,-1,0,0,12:00 -574,Australia/Melbourne,2001,AV,600,60,10,-1,0,0,12:00,3,-1,0,0,12:00 -575,Australia/Melbourne,2006,AV,600,60,10,-1,0,0,12:00,4,1,0,0,12:00 -576,Australia/Melbourne,2007,AV,600,60,10,-1,0,0,12:00,3,-1,0,0,12:00 -577,Australia/Sydney,1970,Aus,600,0,12,31,-1,0,22:00,3,-1,0,0,11:00 -578,Australia/Sydney,1971,AN,600,60,10,-1,0,0,12:00,1,1,-1,0,21:00 -579,Australia/Sydney,1972,AN,600,60,10,-1,0,0,12:00,2,27,-1,0,12:00 -580,Australia/Sydney,1973,AN,600,60,10,-1,0,0,12:00,3,1,0,0,12:00 -581,Australia/Sydney,1982,AN,600,60,10,-1,0,0,12:00,4,1,0,0,12:00 -582,Australia/Sydney,1983,AN,600,60,10,-1,0,0,12:00,3,1,0,0,12:00 -583,Australia/Sydney,1986,AN,600,60,10,19,-1,0,12:00,3,15,0,0,12:00 -584,Australia/Sydney,1987,AN,600,60,10,-1,0,0,12:00,3,15,0,0,12:00 -585,Australia/Sydney,1990,AN,600,60,10,-1,0,0,12:00,3,1,0,0,12:00 -586,Australia/Sydney,1996,AN,600,60,10,-1,0,0,12:00,3,-1,0,0,12:00 -587,Australia/Sydney,2000,AN,600,60,8,-1,0,0,12:00,3,-1,0,0,12:00 -588,Australia/Sydney,2001,AN,600,60,10,-1,0,0,12:00,3,-1,0,0,12:00 -589,Australia/Sydney,2006,AN,600,60,10,-1,0,0,12:00,4,1,0,0,12:00 -590,Australia/Sydney,2007,AN,600,60,10,-1,0,0,12:00,3,-1,0,0,12:00 -591,Australia/Broken_Hill,1970,Aus,570,0,12,31,-1,0,21:30,3,-1,0,0,10:30 -592,Australia/Broken_Hill,1971,AN,570,60,10,-1,0,0,11:30,1,1,-1,0,20:30 -593,Australia/Broken_Hill,1972,AN,570,60,10,-1,0,0,11:30,2,27,-1,0,11:30 -594,Australia/Broken_Hill,1973,AN,570,60,10,-1,0,0,11:30,3,1,0,0,11:30 -595,Australia/Broken_Hill,1982,AN,570,60,10,-1,0,0,11:30,4,1,0,0,11:30 -596,Australia/Broken_Hill,1983,AN,570,60,10,-1,0,0,11:30,3,1,0,0,11:30 -597,Australia/Broken_Hill,1986,AN,570,60,10,19,-1,0,11:30,3,15,0,0,11:30 -598,Australia/Broken_Hill,1987,AN,570,60,10,-1,0,0,11:30,3,15,0,0,11:30 -599,Australia/Broken_Hill,1990,AN,570,60,10,-1,0,0,11:30,3,1,0,0,11:30 -600,Australia/Broken_Hill,1996,AN,570,60,10,-1,0,0,11:30,3,-1,0,0,11:30 -601,Australia/Broken_Hill,2000,AS,570,60,10,-1,0,0,11:30,3,-1,0,0,11:30 -602,Australia/Broken_Hill,2006,AS,570,60,10,-1,0,0,11:30,4,1,0,0,11:30 -603,Australia/Broken_Hill,2007,AS,570,60,10,-1,0,0,11:30,3,-1,0,0,11:30 -604,Australia/Lord_Howe,1970,,600,0,0,0,0,0,,0,0,0,0, -605,Australia/Lord_Howe,1981,LH,630,60,10,-1,0,0,12:30,1,1,-1,0,21:30 -606,Australia/Lord_Howe,1982,LH,630,60,10,-1,0,0,12:30,3,1,0,0,11:30 -607,Australia/Lord_Howe,1985,LH,630,30,10,-1,0,0,12:30,3,1,0,0,11:30 -608,Australia/Lord_Howe,1986,LH,630,30,10,19,-1,0,12:30,3,15,0,0,11:30 -609,Australia/Lord_Howe,1987,LH,630,30,10,-1,0,0,12:30,3,15,0,0,11:30 -610,Australia/Lord_Howe,1990,LH,630,30,10,-1,0,0,12:30,3,1,0,0,11:30 -611,Australia/Lord_Howe,1996,LH,630,30,10,-1,0,0,12:30,3,-1,0,0,11:30 -612,Australia/Lord_Howe,2000,LH,630,30,8,-1,0,0,12:30,3,-1,0,0,11:30 -613,Australia/Lord_Howe,2001,LH,630,30,10,-1,0,0,12:30,3,-1,0,0,11:30 -614,Australia/Lord_Howe,2006,LH,630,30,10,-1,0,0,12:30,4,1,0,0,11:30 -615,Australia/Lord_Howe,2007,LH,630,30,10,-1,0,0,12:30,3,-1,0,0,11:30 -616,Indian/Christmas,1970,,420,0,0,0,0,0,,0,0,0,0, -617,Pacific/Rarotonga,1970,,-630,0,0,0,0,0,,0,0,0,0, -618,Pacific/Rarotonga,1978,Cook,-600,30,11,12,-1,0,-10:0,1,1,-1,0,01:00 -619,Pacific/Rarotonga,1979,Cook,-600,30,10,-1,0,0,-10:0,3,1,0,0,-11:0 -620,Pacific/Rarotonga,1991,Cook,-600,0,12,31,-1,0,02:00,3,1,0,0,-11:0 -621,Indian/Cocos,1970,,390,0,0,0,0,0,,0,0,0,0, -622,Pacific/Fiji,1970,Fiji,720,0,0,0,0,0,,0,0,0,0, -623,Pacific/Fiji,1998,Fiji,720,60,11,1,0,0,14:00,1,1,-1,0,23:00 -624,Pacific/Fiji,1999,Fiji,720,60,11,1,0,0,14:00,2,-1,0,0,14:00 -625,Pacific/Fiji,2000,Fiji,720,0,12,31,-1,0,24:00,2,-1,0,0,14:00 -626,Pacific/Gambier,1970,,-540,0,0,0,0,0,,0,0,0,0, -627,Pacific/Marquesas,1970,,-570,0,0,0,0,0,,0,0,0,0, -628,Pacific/Tahiti,1970,,-600,0,0,0,0,0,,0,0,0,0, -629,Pacific/Guam,1970,,600,0,0,0,0,0,,0,0,0,0, -630,Pacific/Guam,2000,,600,0,0,0,0,0,,0,0,0,0, -631,Pacific/Tarawa,1970,,720,0,0,0,0,0,,0,0,0,0, -632,Pacific/Enderbury,1970,,-720,0,0,0,0,0,,0,0,0,0, -633,Pacific/Enderbury,1979,,-660,0,0,0,0,0,,0,0,0,0, -634,Pacific/Enderbury,1995,,780,0,0,0,0,0,,0,0,0,0, -635,Pacific/Kiritimati,1970,,-640,0,0,0,0,0,,0,0,0,0, -636,Pacific/Kiritimati,1979,,-600,0,0,0,0,0,,0,0,0,0, -637,Pacific/Kiritimati,1995,,840,0,0,0,0,0,,0,0,0,0, -638,Pacific/Saipan,1970,,600,0,0,0,0,0,,0,0,0,0, -639,Pacific/Saipan,2000,,600,0,0,0,0,0,,0,0,0,0, -640,Pacific/Majuro,1970,,720,0,0,0,0,0,,0,0,0,0, -641,Pacific/Kwajalein,1970,,-720,0,0,0,0,0,,0,0,0,0, -642,Pacific/Kwajalein,1993,,720,0,0,0,0,0,,0,0,0,0, -643,Pacific/Truk,1970,,600,0,0,0,0,0,,0,0,0,0, -644,Pacific/Ponape,1970,,660,0,0,0,0,0,,0,0,0,0, -645,Pacific/Kosrae,1970,,720,0,0,0,0,0,,0,0,0,0, -646,Pacific/Kosrae,1999,,660,0,0,0,0,0,,0,0,0,0, -647,Pacific/Nauru,1970,,690,0,0,0,0,0,,0,0,0,0, -648,Pacific/Nauru,1979,,720,0,0,0,0,0,,0,0,0,0, -649,Pacific/Noumea,1970,NC,660,0,0,0,0,0,,0,0,0,0, -650,Pacific/Noumea,1977,NC,660,60,12,1,0,0,11:00,1,1,-1,0,22:00 -651,Pacific/Noumea,1978,NC,660,60,12,1,0,0,11:00,2,27,-1,0,10:00 -652,Pacific/Noumea,1979,NC,660,0,12,31,-1,0,23:00,2,27,-1,0,10:00 -653,Pacific/Noumea,1996,NC,660,60,12,1,-1,0,13:00,1,1,-1,0,22:00 -654,Pacific/Noumea,1997,NC,660,0,12,31,-1,0,23:00,3,2,-1,0,13:00 -655,Pacific/Auckland,1970,NZ,720,0,12,31,-1,0,24:00,1,1,-1,0,11:00 -656,Pacific/Auckland,1974,NZ,720,60,11,1,0,0,14:00,1,1,-1,0,23:00 -657,Pacific/Auckland,1975,NZ,720,60,10,-1,0,0,14:00,2,-1,0,0,14:00 -658,Pacific/Auckland,1976,NZ,720,60,10,-1,0,0,14:00,3,1,0,0,14:00 -659,Pacific/Auckland,1989,NZ,720,60,10,8,0,0,14:00,3,1,0,0,14:00 -660,Pacific/Auckland,1990,NZ,720,60,10,1,0,0,14:00,3,15,0,0,14:00 -661,Pacific/Chatham,1970,Chatham,765,0,0,0,0,0,,0,0,0,0, -662,Pacific/Chatham,1974,Chatham,765,60,11,1,0,0,15:30,1,1,-1,0,23:45 -663,Pacific/Chatham,1975,Chatham,765,60,10,-1,0,0,15:30,2,-1,0,0,15:30 -664,Pacific/Chatham,1976,Chatham,765,60,10,-1,0,0,15:30,3,1,0,0,15:30 -665,Pacific/Chatham,1989,Chatham,765,60,10,8,0,0,15:30,3,1,0,0,15:30 -666,Pacific/Chatham,1990,Chatham,765,60,10,1,0,0,15:30,3,15,0,0,15:30 -667,Pacific/Niue,1970,,-690,0,0,0,0,0,,0,0,0,0, -668,Pacific/Niue,1978,,-660,0,0,0,0,0,,0,0,0,0, -669,Pacific/Norfolk,1970,,690,0,0,0,0,0,,0,0,0,0, -670,Pacific/Palau,1970,,540,0,0,0,0,0,,0,0,0,0, -671,Pacific/Port_Moresby,1970,,600,0,0,0,0,0,,0,0,0,0, -672,Pacific/Pitcairn,1970,,-510,0,0,0,0,0,,0,0,0,0, -673,Pacific/Pitcairn,1998,,-480,0,0,0,0,0,,0,0,0,0, -674,Pacific/Pago_Pago,1970,,-660,0,0,0,0,0,,0,0,0,0, -675,Pacific/Pago_Pago,1983,,-660,0,0,0,0,0,,0,0,0,0, -676,Pacific/Apia,1970,,-660,0,0,0,0,0,,0,0,0,0, -677,Pacific/Guadalcanal,1970,,660,0,0,0,0,0,,0,0,0,0, -678,Pacific/Fakaofo,1970,,-600,0,0,0,0,0,,0,0,0,0, -679,Pacific/Tongatapu,1970,,780,0,0,0,0,0,,0,0,0,0, -680,Pacific/Tongatapu,1999,Tonga,780,60,10,7,-1,0,15:00,1,1,-1,0,24:00 -681,Pacific/Tongatapu,2000,Tonga,780,60,11,1,0,0,15:00,3,19,-1,0,15:00 -682,Pacific/Tongatapu,2001,Tonga,780,60,11,1,0,0,15:00,1,-1,0,0,14:00 -683,Pacific/Tongatapu,2002,Tonga,780,0,12,31,-1,0,25:00,1,-1,0,0,14:00 -684,Pacific/Funafuti,1970,,720,0,0,0,0,0,,0,0,0,0, -685,Pacific/Johnston,1970,,-600,0,0,0,0,0,,0,0,0,0, -686,Pacific/Midway,1970,,-660,0,0,0,0,0,,0,0,0,0, -687,Pacific/Midway,1983,,-660,0,0,0,0,0,,0,0,0,0, -688,Pacific/Wake,1970,,720,0,0,0,0,0,,0,0,0,0, -689,Pacific/Efate,1970,Vanuatu,660,0,0,0,0,0,,0,0,0,0, -690,Pacific/Efate,1983,Vanuatu,660,60,9,25,-1,0,11:00,1,1,-1,0,22:00 -691,Pacific/Efate,1984,Vanuatu,660,60,10,23,-1,0,11:00,3,23,0,0,10:00 -692,Pacific/Efate,1985,Vanuatu,660,60,9,23,0,0,11:00,3,23,0,0,10:00 -693,Pacific/Efate,1992,Vanuatu,660,60,10,23,0,0,11:00,1,23,0,0,10:00 -694,Pacific/Efate,1993,Vanuatu,660,0,12,31,-1,0,23:00,1,23,0,0,10:00 -695,Pacific/Wallis,1970,,720,0,0,0,0,0,,0,0,0,0, -696,Europe/London,1970,,60,0,0,0,0,0,,0,0,0,0, -697,Europe/London,1971,GB-Eire,0,0,0,0,0,0,,0,0,0,0, -698,Europe/London,1972,GB-Eire,0,60,3,16,0,0,02:00,10,23,0,0,02:00 -699,Europe/London,1981,GB-Eire,0,60,3,-1,0,0,1:00,10,23,0,0,1:00 -700,Europe/London,1990,GB-Eire,0,60,3,-1,0,0,1:00,10,22,0,0,1:00 -701,Europe/London,1995,GB-Eire,0,0,3,-1,0,0,1:00,10,22,0,0,1:00 -702,Europe/London,1996,EU,0,60,3,-1,0,0,1:00,10,-1,0,0,1:00 -703,Europe/Dublin,1970,,60,0,0,0,0,0,,0,0,0,0, -704,Europe/Dublin,1971,GB-Eire,0,0,0,0,0,0,,0,0,0,0, -705,Europe/Dublin,1972,GB-Eire,0,60,3,16,0,0,02:00,10,23,0,0,02:00 -706,Europe/Dublin,1981,GB-Eire,0,60,3,-1,0,0,1:00,10,23,0,0,1:00 -707,Europe/Dublin,1990,GB-Eire,0,60,3,-1,0,0,1:00,10,22,0,0,1:00 -708,Europe/Dublin,1995,GB-Eire,0,0,3,-1,0,0,1:00,10,22,0,0,1:00 -709,Europe/Dublin,1996,EU,0,60,3,-1,0,0,1:00,10,-1,0,0,1:00 -710,WET,1970,EU,0,0,0,0,0,0,,0,0,0,0, -711,WET,1977,EU,0,60,4,1,0,0,1:00,9,-1,0,0,1:00 -712,WET,1978,EU,0,60,4,1,0,0,1:00,10,1,-1,0,1:00 -713,WET,1979,EU,0,60,4,1,0,0,1:00,9,-1,0,0,1:00 -714,WET,1981,EU,0,60,3,-1,0,0,1:00,9,-1,0,0,1:00 -715,WET,1996,EU,0,60,3,-1,0,0,1:00,10,-1,0,0,1:00 -716,CET,1970,C-Eur,60,60,4,3,-1,0,03:00,10,2,-1,0,03:00 -717,CET,1977,C-Eur,60,60,4,1,0,0,03:00,9,-1,0,0,03:00 -718,CET,1978,C-Eur,60,60,4,1,0,0,03:00,10,1,-1,0,03:00 -719,CET,1979,C-Eur,60,60,4,1,0,0,03:00,9,-1,0,0,03:00 -720,CET,1981,C-Eur,60,60,3,-1,0,0,03:00,9,-1,0,0,03:00 -721,CET,1996,C-Eur,60,60,3,-1,0,0,03:00,10,-1,0,0,03:00 -722,MET,1970,C-Eur,60,60,4,3,-1,0,03:00,10,2,-1,0,03:00 -723,MET,1977,C-Eur,60,60,4,1,0,0,03:00,9,-1,0,0,03:00 -724,MET,1978,C-Eur,60,60,4,1,0,0,03:00,10,1,-1,0,03:00 -725,MET,1979,C-Eur,60,60,4,1,0,0,03:00,9,-1,0,0,03:00 -726,MET,1981,C-Eur,60,60,3,-1,0,0,03:00,9,-1,0,0,03:00 -727,MET,1996,C-Eur,60,60,3,-1,0,0,03:00,10,-1,0,0,03:00 -728,EET,1970,EU,120,0,0,0,0,0,,0,0,0,0, -729,EET,1977,EU,120,60,4,1,0,0,1:00,9,-1,0,0,1:00 -730,EET,1978,EU,120,60,4,1,0,0,1:00,10,1,-1,0,1:00 -731,EET,1979,EU,120,60,4,1,0,0,1:00,9,-1,0,0,1:00 -732,EET,1981,EU,120,60,3,-1,0,0,1:00,9,-1,0,0,1:00 -733,EET,1996,EU,120,60,3,-1,0,0,1:00,10,-1,0,0,1:00 -734,Europe/Tirane,1970,Albania,60,60,3,29,-1,0,03:00,4,10,-1,0,03:00 -735,Europe/Tirane,1974,Albania,60,60,5,4,-1,0,01:00,10,2,-1,0,00:00 -736,Europe/Tirane,1975,Albania,60,60,5,1,-1,0,01:00,10,2,-1,0,00:00 -737,Europe/Tirane,1976,Albania,60,60,5,2,-1,0,01:00,10,3,-1,0,00:00 -738,Europe/Tirane,1977,Albania,60,60,5,8,-1,0,01:00,10,2,-1,0,00:00 -739,Europe/Tirane,1978,Albania,60,60,5,6,-1,0,01:00,10,1,-1,0,00:00 -740,Europe/Tirane,1979,Albania,60,60,5,5,-1,0,01:00,9,30,-1,0,00:00 -741,Europe/Tirane,1980,Albania,60,60,5,3,-1,0,01:00,10,4,-1,0,00:00 -742,Europe/Tirane,1981,Albania,60,60,4,26,-1,0,01:00,9,27,-1,0,00:00 -743,Europe/Tirane,1982,Albania,60,60,5,2,-1,0,01:00,10,3,-1,0,00:00 -744,Europe/Tirane,1983,Albania,60,60,4,18,-1,0,01:00,10,1,-1,0,00:00 -745,Europe/Tirane,1984,EU,60,60,3,-1,0,0,1:00,9,-1,0,0,1:00 -746,Europe/Tirane,1996,EU,60,60,3,-1,0,0,1:00,10,-1,0,0,1:00 -747,Europe/Andorra,1970,,60,0,0,0,0,0,,0,0,0,0, -748,Europe/Andorra,1985,EU,60,60,3,-1,0,0,1:00,9,-1,0,0,1:00 -749,Europe/Andorra,1996,EU,60,60,3,-1,0,0,1:00,10,-1,0,0,1:00 -750,Europe/Vienna,1970,Austria,60,60,4,18,-1,0,03:00,10,1,0,0,03:00 -751,Europe/Vienna,1980,Austria,60,60,4,6,-1,0,01:00,9,28,-1,0,00:00 -752,Europe/Vienna,1981,EU,60,60,3,-1,0,0,1:00,9,-1,0,0,1:00 -753,Europe/Vienna,1996,EU,60,60,3,-1,0,0,1:00,10,-1,0,0,1:00 -754,Europe/Minsk,1970,Russia,180,60,9,1,-1,0,03:00,10,1,-1,0,02:00 -755,Europe/Minsk,1981,Russia,180,60,4,1,-1,0,03:00,10,1,-1,0,02:00 -756,Europe/Minsk,1984,Russia,180,60,4,1,-1,0,03:00,9,-1,0,0,05:00 -757,Europe/Minsk,1985,Russia,180,60,3,-1,0,0,05:00,9,-1,0,0,05:00 -758,Europe/Minsk,1990,,180,0,0,0,0,0,,0,0,0,0, -759,Europe/Minsk,1991,,120,0,0,0,0,0,,0,0,0,0, -760,Europe/Minsk,1992,Russia,120,60,3,-1,6,0,25:00,9,-1,6,0,24:00 -761,Europe/Minsk,1993,Russia,120,60,3,-1,0,0,04:00,9,-1,0,0,04:00 -762,Europe/Minsk,1996,Russia,120,60,3,-1,0,0,04:00,10,-1,0,0,04:00 -763,Europe/Brussels,1970,Belgium,60,0,5,19,-1,0,03:00,10,7,-1,0,03:00 -764,Europe/Brussels,1977,EU,60,60,4,1,0,0,1:00,9,-1,0,0,1:00 -765,Europe/Brussels,1978,EU,60,60,4,1,0,0,1:00,10,1,-1,0,1:00 -766,Europe/Brussels,1979,EU,60,60,4,1,0,0,1:00,9,-1,0,0,1:00 -767,Europe/Brussels,1981,EU,60,60,3,-1,0,0,1:00,9,-1,0,0,1:00 -768,Europe/Brussels,1996,EU,60,60,3,-1,0,0,1:00,10,-1,0,0,1:00 -769,Europe/Sofia,1970,,120,0,0,0,0,0,,0,0,0,0, -770,Europe/Sofia,1979,Bulg,120,60,3,31,-1,0,25:00,10,1,-1,0,02:00 -771,Europe/Sofia,1980,Bulg,120,60,4,1,6,0,25:00,9,29,-1,0,02:00 -772,Europe/Sofia,1981,Bulg,120,60,4,1,6,0,25:00,9,27,-1,0,03:00 -773,Europe/Sofia,1982,C-Eur,120,60,3,-1,0,0,04:00,9,-1,0,0,04:00 -774,Europe/Sofia,1991,E-Eur,120,60,3,-1,0,0,02:00,9,-1,0,0,01:00 -775,Europe/Sofia,1996,E-Eur,120,60,3,-1,0,0,02:00,10,-1,0,0,01:00 -776,Europe/Sofia,1997,EU,120,60,3,-1,0,0,1:00,10,-1,0,0,1:00 -777,Europe/Prague,1970,Czech,60,0,4,9,-1,0,03:00,10,1,0,0,03:00 -778,Europe/Prague,1979,EU,60,60,4,1,0,0,1:00,9,-1,0,0,1:00 -779,Europe/Prague,1981,EU,60,60,3,-1,0,0,1:00,9,-1,0,0,1:00 -780,Europe/Prague,1996,EU,60,60,3,-1,0,0,1:00,10,-1,0,0,1:00 -781,Europe/Copenhagen,1970,Denmark,60,0,5,9,-1,0,03:00,8,8,-1,0,03:00 -782,Europe/Copenhagen,1980,EU,60,60,4,1,0,0,1:00,9,-1,0,0,1:00 -783,Europe/Copenhagen,1981,EU,60,60,3,-1,0,0,1:00,9,-1,0,0,1:00 -784,Europe/Copenhagen,1996,EU,60,60,3,-1,0,0,1:00,10,-1,0,0,1:00 -785,Atlantic/Faroe,1970,,0,0,0,0,0,0,,0,0,0,0, -786,Atlantic/Faroe,1981,EU,0,60,3,-1,0,0,1:00,9,-1,0,0,1:00 -787,Atlantic/Faroe,1996,EU,0,60,3,-1,0,0,1:00,10,-1,0,0,1:00 -788,America/Danmarkshavn,1970,,-180,0,0,0,0,0,,0,0,0,0, -789,America/Danmarkshavn,1980,EU,-180,60,4,1,0,0,1:00,9,-1,0,0,1:00 -790,America/Danmarkshavn,1981,EU,-180,60,3,-1,0,0,1:00,9,-1,0,0,1:00 -791,America/Danmarkshavn,1996,,0,0,0,0,0,0,,0,0,0,0, -792,America/Scoresbysund,1970,,-120,0,0,0,0,0,,0,0,0,0, -793,America/Scoresbysund,1980,C-Eur,-120,60,4,1,0,0,00:00,9,-1,0,0,00:00 -794,America/Scoresbysund,1981,EU,-60,60,3,-1,0,0,1:00,9,-1,0,0,1:00 -795,America/Scoresbysund,1996,EU,-60,60,3,-1,0,0,1:00,10,-1,0,0,1:00 -796,America/Godthab,1970,,-180,0,0,0,0,0,,0,0,0,0, -797,America/Godthab,1980,EU,-180,60,4,1,0,0,1:00,9,-1,0,0,1:00 -798,America/Godthab,1981,EU,-180,60,3,-1,0,0,1:00,9,-1,0,0,1:00 -799,America/Godthab,1996,EU,-180,60,3,-1,0,0,1:00,10,-1,0,0,1:00 -800,America/Thule,1970,Thule,-240,0,0,0,0,0,,0,0,0,0, -801,America/Thule,1991,Thule,-240,60,3,-1,0,0,-2:00,9,-1,0,0,-3:00 -802,America/Thule,1993,Thule,-240,60,4,1,0,0,-2:00,10,-1,0,0,-3:00 -803,America/Thule,2007,Thule,-240,60,3,8,0,0,-2:00,11,1,0,0,-3:00 -804,Europe/Tallinn,1970,Russia,180,60,9,1,-1,0,03:00,10,1,-1,0,02:00 -805,Europe/Tallinn,1981,Russia,180,60,4,1,-1,0,03:00,10,1,-1,0,02:00 -806,Europe/Tallinn,1984,Russia,180,60,4,1,-1,0,03:00,9,-1,0,0,05:00 -807,Europe/Tallinn,1985,Russia,180,60,3,-1,0,0,05:00,9,-1,0,0,05:00 -808,Europe/Tallinn,1989,C-Eur,120,60,3,-1,0,0,04:00,9,-1,0,0,04:00 -809,Europe/Tallinn,1996,C-Eur,120,60,3,-1,0,0,04:00,10,-1,0,0,04:00 -810,Europe/Tallinn,1998,EU,120,60,3,-1,0,0,1:00,10,-1,0,0,1:00 -811,Europe/Tallinn,1999,,120,0,0,0,0,0,,0,0,0,0, -812,Europe/Tallinn,2002,EU,120,60,3,-1,0,0,1:00,10,-1,0,0,1:00 -813,Europe/Helsinki,1970,Finland,120,0,4,3,-1,0,02:00,10,3,-1,0,01:00 -814,Europe/Helsinki,1981,EU,120,60,3,-1,0,0,1:00,9,-1,0,0,1:00 -815,Europe/Helsinki,1996,EU,120,60,3,-1,0,0,1:00,10,-1,0,0,1:00 -816,Europe/Paris,1970,France,60,120,4,2,-1,0,03:00,9,16,-1,0,03:00 -817,Europe/Paris,1976,France,60,60,3,28,-1,0,02:00,9,26,-1,0,01:00 -818,Europe/Paris,1977,EU,60,60,4,1,0,0,1:00,9,-1,0,0,1:00 -819,Europe/Paris,1978,EU,60,60,4,1,0,0,1:00,10,1,-1,0,1:00 -820,Europe/Paris,1979,EU,60,60,4,1,0,0,1:00,9,-1,0,0,1:00 -821,Europe/Paris,1981,EU,60,60,3,-1,0,0,1:00,9,-1,0,0,1:00 -822,Europe/Paris,1996,EU,60,60,3,-1,0,0,1:00,10,-1,0,0,1:00 -823,Europe/Berlin,1970,Germany,60,0,4,10,-1,0,03:00,10,1,0,0,03:00 -824,Europe/Berlin,1980,EU,60,60,4,1,0,0,1:00,9,-1,0,0,1:00 -825,Europe/Berlin,1981,EU,60,60,3,-1,0,0,1:00,9,-1,0,0,1:00 -826,Europe/Berlin,1996,EU,60,60,3,-1,0,0,1:00,10,-1,0,0,1:00 -827,Europe/Gibraltar,1970,,60,0,0,0,0,0,,0,0,0,0, -828,Europe/Gibraltar,1982,EU,60,60,3,-1,0,0,1:00,9,-1,0,0,1:00 -829,Europe/Gibraltar,1996,EU,60,60,3,-1,0,0,1:00,10,-1,0,0,1:00 -830,Europe/Athens,1970,Greece,120,60,7,1,-1,0,02:00,11,2,-1,0,01:00 -831,Europe/Athens,1975,Greece,120,60,4,12,-1,0,02:00,11,26,-1,0,02:00 -832,Europe/Athens,1976,Greece,120,60,4,11,-1,0,04:00,10,10,-1,0,04:00 -833,Europe/Athens,1977,Greece,120,60,4,1,0,0,04:00,9,26,-1,0,04:00 -834,Europe/Athens,1978,Greece,120,60,4,1,0,0,04:00,9,24,-1,0,05:00 -835,Europe/Athens,1979,Greece,120,60,4,1,-1,0,11:00,9,29,-1,0,03:00 -836,Europe/Athens,1980,Greece,120,60,4,1,-1,0,02:00,9,28,-1,0,01:00 -837,Europe/Athens,1981,EU,120,60,3,-1,0,0,1:00,9,-1,0,0,1:00 -838,Europe/Athens,1996,EU,120,60,3,-1,0,0,1:00,10,-1,0,0,1:00 -839,Europe/Budapest,1970,Hungary,60,60,6,1,0,0,02:00,9,-1,0,0,03:00 -840,Europe/Budapest,1980,EU,60,60,4,1,0,0,1:00,9,-1,0,0,1:00 -841,Europe/Budapest,1981,EU,60,60,3,-1,0,0,1:00,9,-1,0,0,1:00 -842,Europe/Budapest,1996,EU,60,60,3,-1,0,0,1:00,10,-1,0,0,1:00 -843,Atlantic/Reykjavik,1970,,0,0,0,0,0,0,,0,0,0,0, -844,Europe/Rome,1970,Italy,60,60,5,31,-1,0,01:00,9,-1,0,0,00:00 -845,Europe/Rome,1971,Italy,60,60,5,22,0,0,01:00,9,-1,0,0,01:00 -846,Europe/Rome,1972,Italy,60,60,5,22,0,0,01:00,10,1,-1,0,00:00 -847,Europe/Rome,1973,Italy,60,60,6,3,-1,0,01:00,9,-1,0,0,00:00 -848,Europe/Rome,1974,Italy,60,60,5,26,-1,0,01:00,9,-1,0,0,00:00 -849,Europe/Rome,1975,Italy,60,60,6,1,-1,0,01:00,9,-1,0,0,01:00 -850,Europe/Rome,1976,Italy,60,60,5,30,-1,0,01:00,9,-1,0,0,01:00 -851,Europe/Rome,1977,Italy,60,60,5,22,0,0,01:00,9,-1,0,0,01:00 -852,Europe/Rome,1978,Italy,60,60,5,22,0,0,01:00,10,1,-1,0,01:00 -853,Europe/Rome,1979,Italy,60,60,5,22,0,0,01:00,9,30,-1,0,01:00 -854,Europe/Rome,1980,EU,60,60,4,1,0,0,1:00,9,-1,0,0,1:00 -855,Europe/Rome,1981,EU,60,60,3,-1,0,0,1:00,9,-1,0,0,1:00 -856,Europe/Rome,1996,EU,60,60,3,-1,0,0,1:00,10,-1,0,0,1:00 -857,Europe/Riga,1970,Russia,180,60,9,1,-1,0,03:00,10,1,-1,0,02:00 -858,Europe/Riga,1981,Russia,180,60,4,1,-1,0,03:00,10,1,-1,0,02:00 -859,Europe/Riga,1984,Russia,180,60,4,1,-1,0,03:00,9,-1,0,0,05:00 -860,Europe/Riga,1985,Russia,180,60,3,-1,0,0,05:00,9,-1,0,0,05:00 -861,Europe/Riga,1989,Latvia,120,60,3,-1,0,0,04:00,9,-1,0,0,04:00 -862,Europe/Riga,1996,Latvia,120,0,3,-1,0,0,04:00,9,-1,0,0,04:00 -863,Europe/Riga,1997,EU,120,60,3,-1,0,0,1:00,10,-1,0,0,1:00 -864,Europe/Riga,2000,,120,0,0,0,0,0,,0,0,0,0, -865,Europe/Riga,2001,EU,120,60,3,-1,0,0,1:00,10,-1,0,0,1:00 -866,Europe/Vaduz,1970,,60,0,0,0,0,0,,0,0,0,0, -867,Europe/Vaduz,1981,EU,60,60,3,-1,0,0,1:00,9,-1,0,0,1:00 -868,Europe/Vaduz,1996,EU,60,60,3,-1,0,0,1:00,10,-1,0,0,1:00 -869,Europe/Vilnius,1970,Russia,180,60,9,1,-1,0,03:00,10,1,-1,0,02:00 -870,Europe/Vilnius,1981,Russia,180,60,4,1,-1,0,03:00,10,1,-1,0,02:00 -871,Europe/Vilnius,1984,Russia,180,60,4,1,-1,0,03:00,9,-1,0,0,05:00 -872,Europe/Vilnius,1985,Russia,180,60,3,-1,0,0,05:00,9,-1,0,0,05:00 -873,Europe/Vilnius,1991,C-Eur,120,60,3,-1,0,0,04:00,9,-1,0,0,04:00 -874,Europe/Vilnius,1996,C-Eur,120,60,3,-1,0,0,04:00,10,-1,0,0,04:00 -875,Europe/Vilnius,1998,EU,60,60,3,-1,0,0,1:00,10,-1,0,0,1:00 -876,Europe/Vilnius,1999,,120,0,0,0,0,0,,0,0,0,0, -877,Europe/Vilnius,2003,EU,120,60,3,-1,0,0,1:00,10,-1,0,0,1:00 -878,Europe/Luxembourg,1970,Belgium,60,0,5,19,-1,0,03:00,10,7,-1,0,03:00 -879,Europe/Luxembourg,1977,EU,60,60,4,1,0,0,1:00,9,-1,0,0,1:00 -880,Europe/Luxembourg,1978,EU,60,60,4,1,0,0,1:00,10,1,-1,0,1:00 -881,Europe/Luxembourg,1979,EU,60,60,4,1,0,0,1:00,9,-1,0,0,1:00 -882,Europe/Luxembourg,1981,EU,60,60,3,-1,0,0,1:00,9,-1,0,0,1:00 -883,Europe/Luxembourg,1996,EU,60,60,3,-1,0,0,1:00,10,-1,0,0,1:00 -884,Europe/Malta,1970,Italy,60,60,5,31,-1,0,01:00,9,-1,0,0,00:00 -885,Europe/Malta,1971,Italy,60,60,5,22,0,0,01:00,9,-1,0,0,01:00 -886,Europe/Malta,1972,Italy,60,60,5,22,0,0,01:00,10,1,-1,0,00:00 -887,Europe/Malta,1973,Malta,60,60,3,31,-1,0,01:00,9,29,-1,0,01:00 -888,Europe/Malta,1974,Malta,60,60,4,21,-1,0,01:00,9,16,-1,0,01:00 -889,Europe/Malta,1975,Malta,60,60,4,15,0,0,03:00,9,15,0,0,02:00 -890,Europe/Malta,1980,Malta,60,0,3,31,-1,0,03:00,9,15,0,0,02:00 -891,Europe/Malta,1981,EU,60,60,3,-1,0,0,1:00,9,-1,0,0,1:00 -892,Europe/Malta,1996,EU,60,60,3,-1,0,0,1:00,10,-1,0,0,1:00 -893,Europe/Chisinau,1970,Russia,180,60,9,1,-1,0,03:00,10,1,-1,0,02:00 -894,Europe/Chisinau,1981,Russia,180,60,4,1,-1,0,03:00,10,1,-1,0,02:00 -895,Europe/Chisinau,1984,Russia,180,60,4,1,-1,0,03:00,9,-1,0,0,05:00 -896,Europe/Chisinau,1985,Russia,180,60,3,-1,0,0,05:00,9,-1,0,0,05:00 -897,Europe/Chisinau,1990,,120,0,0,0,0,0,,0,0,0,0, -898,Europe/Chisinau,1991,Russia,120,60,3,-1,0,0,04:00,9,-1,0,0,04:00 -899,Europe/Chisinau,1992,E-Eur,120,60,3,-1,0,0,02:00,9,-1,0,0,01:00 -900,Europe/Chisinau,1996,E-Eur,120,60,3,-1,0,0,02:00,10,-1,0,0,01:00 -901,Europe/Chisinau,1997,EU,120,60,3,-1,0,0,1:00,10,-1,0,0,1:00 -902,Europe/Monaco,1970,France,60,120,4,2,-1,0,03:00,9,16,-1,0,03:00 -903,Europe/Monaco,1976,France,60,60,3,28,-1,0,02:00,9,26,-1,0,01:00 -904,Europe/Monaco,1977,EU,60,60,4,1,0,0,1:00,9,-1,0,0,1:00 -905,Europe/Monaco,1978,EU,60,60,4,1,0,0,1:00,10,1,-1,0,1:00 -906,Europe/Monaco,1979,EU,60,60,4,1,0,0,1:00,9,-1,0,0,1:00 -907,Europe/Monaco,1981,EU,60,60,3,-1,0,0,1:00,9,-1,0,0,1:00 -908,Europe/Monaco,1996,EU,60,60,3,-1,0,0,1:00,10,-1,0,0,1:00 -909,Europe/Amsterdam,1970,Neth,60,0,4,2,-1,0,03:00,9,16,-1,0,03:00 -910,Europe/Amsterdam,1977,EU,60,60,4,1,0,0,1:00,9,-1,0,0,1:00 -911,Europe/Amsterdam,1978,EU,60,60,4,1,0,0,1:00,10,1,-1,0,1:00 -912,Europe/Amsterdam,1979,EU,60,60,4,1,0,0,1:00,9,-1,0,0,1:00 -913,Europe/Amsterdam,1981,EU,60,60,3,-1,0,0,1:00,9,-1,0,0,1:00 -914,Europe/Amsterdam,1996,EU,60,60,3,-1,0,0,1:00,10,-1,0,0,1:00 -915,Europe/Oslo,1970,Norway,60,0,4,25,-1,0,03:00,9,15,0,0,03:00 -916,Europe/Oslo,1980,EU,60,60,4,1,0,0,1:00,9,-1,0,0,1:00 -917,Europe/Oslo,1981,EU,60,60,3,-1,0,0,1:00,9,-1,0,0,1:00 -918,Europe/Oslo,1996,EU,60,60,3,-1,0,0,1:00,10,-1,0,0,1:00 -919,Europe/Warsaw,1970,Poland,60,0,5,-1,0,0,02:00,9,-1,0,0,02:00 -920,Europe/Warsaw,1977,W-Eur,60,60,4,1,0,0,02:00,9,-1,0,0,02:00 -921,Europe/Warsaw,1978,W-Eur,60,60,4,1,0,0,02:00,10,1,-1,0,02:00 -922,Europe/Warsaw,1979,W-Eur,60,60,4,1,0,0,02:00,9,-1,0,0,02:00 -923,Europe/Warsaw,1981,W-Eur,60,60,3,-1,0,0,02:00,9,-1,0,0,02:00 -924,Europe/Warsaw,1988,EU,60,60,3,-1,0,0,1:00,9,-1,0,0,1:00 -925,Europe/Warsaw,1996,EU,60,60,3,-1,0,0,1:00,10,-1,0,0,1:00 -926,Europe/Lisbon,1970,,60,0,0,0,0,0,,0,0,0,0, -927,Europe/Lisbon,1976,Port,0,0,0,0,0,0,,0,0,0,0, -928,Europe/Lisbon,1977,Port,0,60,3,27,-1,0,00:00,9,25,-1,0,00:00 -929,Europe/Lisbon,1978,Port,0,60,4,1,0,0,00:00,10,1,-1,0,00:00 -930,Europe/Lisbon,1979,Port,0,60,4,1,0,0,00:00,9,-1,0,0,01:00 -931,Europe/Lisbon,1980,Port,0,60,3,-1,0,0,00:00,9,-1,0,0,01:00 -932,Europe/Lisbon,1981,Port,0,60,3,-1,0,0,01:00,9,-1,0,0,01:00 -933,Europe/Lisbon,1983,W-Eur,0,60,3,-1,0,0,01:00,9,-1,0,0,01:00 -934,Europe/Lisbon,1992,EU,60,60,3,-1,0,0,1:00,9,-1,0,0,1:00 -935,Europe/Lisbon,1996,EU,0,60,3,-1,0,0,1:00,10,-1,0,0,1:00 -936,Atlantic/Azores,1970,Port,-60,60,4,1,0,0,01:00,10,1,0,0,01:00 -937,Atlantic/Azores,1977,Port,-60,60,3,27,-1,0,-1:00,9,25,-1,0,-1:00 -938,Atlantic/Azores,1978,Port,-60,60,4,1,0,0,-1:00,10,1,-1,0,-1:00 -939,Atlantic/Azores,1979,Port,-60,60,4,1,0,0,-1:00,9,-1,0,0,00:00 -940,Atlantic/Azores,1980,Port,-60,60,3,-1,0,0,-1:00,9,-1,0,0,00:00 -941,Atlantic/Azores,1981,Port,-60,60,3,-1,0,0,00:00,9,-1,0,0,00:00 -942,Atlantic/Azores,1983,W-Eur,-60,60,3,-1,0,0,00:00,9,-1,0,0,00:00 -943,Atlantic/Azores,1992,EU,0,60,3,-1,0,0,1:00,9,-1,0,0,1:00 -944,Atlantic/Azores,1993,EU,-60,60,3,-1,0,0,1:00,9,-1,0,0,1:00 -945,Atlantic/Azores,1996,EU,-60,60,3,-1,0,0,1:00,10,-1,0,0,1:00 -946,Atlantic/Madeira,1970,Port,0,60,4,1,0,0,02:00,10,1,0,0,02:00 -947,Atlantic/Madeira,1977,Port,0,60,3,27,-1,0,00:00,9,25,-1,0,00:00 -948,Atlantic/Madeira,1978,Port,0,60,4,1,0,0,00:00,10,1,-1,0,00:00 -949,Atlantic/Madeira,1979,Port,0,60,4,1,0,0,00:00,9,-1,0,0,01:00 -950,Atlantic/Madeira,1980,Port,0,60,3,-1,0,0,00:00,9,-1,0,0,01:00 -951,Atlantic/Madeira,1981,Port,0,60,3,-1,0,0,01:00,9,-1,0,0,01:00 -952,Atlantic/Madeira,1983,EU,0,60,3,-1,0,0,1:00,9,-1,0,0,1:00 -953,Atlantic/Madeira,1996,EU,0,60,3,-1,0,0,1:00,10,-1,0,0,1:00 -954,Europe/Bucharest,1970,Romania,120,60,4,2,0,0,02:00,10,1,0,0,02:00 -955,Europe/Bucharest,1979,Romania,120,60,5,27,-1,0,02:00,9,-1,0,0,01:00 -956,Europe/Bucharest,1980,Romania,120,60,4,5,-1,0,25:00,9,-1,0,0,02:00 -957,Europe/Bucharest,1981,C-Eur,120,60,3,-1,0,0,04:00,9,-1,0,0,04:00 -958,Europe/Bucharest,1991,Romania,120,60,3,-1,0,0,02:00,9,-1,0,0,02:00 -959,Europe/Bucharest,1993,Romania,120,0,3,-1,0,0,02:00,9,-1,0,0,02:00 -960,Europe/Bucharest,1994,E-Eur,120,60,3,-1,0,0,02:00,9,-1,0,0,01:00 -961,Europe/Bucharest,1996,E-Eur,120,60,3,-1,0,0,02:00,10,-1,0,0,01:00 -962,Europe/Bucharest,1997,EU,120,60,3,-1,0,0,1:00,10,-1,0,0,1:00 -963,Europe/Kaliningrad,1970,Russia,180,60,9,1,-1,0,03:00,10,1,-1,0,02:00 -964,Europe/Kaliningrad,1981,Russia,180,60,4,1,-1,0,03:00,10,1,-1,0,02:00 -965,Europe/Kaliningrad,1984,Russia,180,60,4,1,-1,0,03:00,9,-1,0,0,05:00 -966,Europe/Kaliningrad,1985,Russia,180,60,3,-1,0,0,05:00,9,-1,0,0,05:00 -967,Europe/Kaliningrad,1991,Russia,120,60,3,-1,0,0,04:00,9,-1,0,0,04:00 -968,Europe/Kaliningrad,1992,Russia,120,60,3,-1,6,0,25:00,9,-1,6,0,24:00 -969,Europe/Kaliningrad,1993,Russia,120,60,3,-1,0,0,04:00,9,-1,0,0,04:00 -970,Europe/Kaliningrad,1996,Russia,120,60,3,-1,0,0,04:00,10,-1,0,0,04:00 -971,Europe/Moscow,1970,Russia,180,60,9,1,-1,0,03:00,10,1,-1,0,02:00 -972,Europe/Moscow,1981,Russia,180,60,4,1,-1,0,03:00,10,1,-1,0,02:00 -973,Europe/Moscow,1984,Russia,180,60,4,1,-1,0,03:00,9,-1,0,0,05:00 -974,Europe/Moscow,1985,Russia,180,60,3,-1,0,0,05:00,9,-1,0,0,05:00 -975,Europe/Moscow,1991,Russia,120,60,3,-1,0,0,04:00,9,-1,0,0,04:00 -976,Europe/Moscow,1992,Russia,180,60,3,-1,6,0,26:00,9,-1,6,0,25:00 -977,Europe/Moscow,1993,Russia,180,60,3,-1,0,0,05:00,9,-1,0,0,05:00 -978,Europe/Moscow,1996,Russia,180,60,3,-1,0,0,05:00,10,-1,0,0,05:00 -979,Europe/Volgograd,1970,Russia,240,60,9,1,-1,0,04:00,10,1,-1,0,03:00 -980,Europe/Volgograd,1981,Russia,240,60,4,1,-1,0,04:00,10,1,-1,0,03:00 -981,Europe/Volgograd,1984,Russia,240,60,4,1,-1,0,04:00,9,-1,0,0,06:00 -982,Europe/Volgograd,1985,Russia,240,60,3,-1,0,0,06:00,9,-1,0,0,06:00 -983,Europe/Volgograd,1989,Russia,180,60,3,-1,0,0,05:00,9,-1,0,0,05:00 -984,Europe/Volgograd,1991,,240,0,0,0,0,0,,0,0,0,0, -985,Europe/Volgograd,1992,Russia,180,60,3,-1,6,0,26:00,9,-1,6,0,25:00 -986,Europe/Volgograd,1993,Russia,180,60,3,-1,0,0,05:00,9,-1,0,0,05:00 -987,Europe/Volgograd,1996,Russia,180,60,3,-1,0,0,05:00,10,-1,0,0,05:00 -988,Europe/Samara,1970,Russia,240,60,9,1,-1,0,04:00,10,1,-1,0,03:00 -989,Europe/Samara,1981,Russia,240,60,4,1,-1,0,04:00,10,1,-1,0,03:00 -990,Europe/Samara,1984,Russia,240,60,4,1,-1,0,04:00,9,-1,0,0,06:00 -991,Europe/Samara,1985,Russia,240,60,3,-1,0,0,06:00,9,-1,0,0,06:00 -992,Europe/Samara,1989,Russia,180,60,3,-1,0,0,05:00,9,-1,0,0,05:00 -993,Europe/Samara,1991,Russia,240,60,3,-1,0,0,06:00,9,-1,0,0,06:00 -994,Europe/Samara,1992,Russia,240,60,3,-1,6,0,27:00,9,-1,6,0,26:00 -995,Europe/Samara,1993,Russia,240,60,3,-1,0,0,06:00,9,-1,0,0,06:00 -996,Europe/Samara,1996,Russia,240,60,3,-1,0,0,06:00,10,-1,0,0,06:00 -997,Asia/Yekaterinburg,1970,Russia,300,60,9,1,-1,0,05:00,10,1,-1,0,04:00 -998,Asia/Yekaterinburg,1981,Russia,300,60,4,1,-1,0,05:00,10,1,-1,0,04:00 -999,Asia/Yekaterinburg,1984,Russia,300,60,4,1,-1,0,05:00,9,-1,0,0,07:00 -1000,Asia/Yekaterinburg,1985,Russia,300,60,3,-1,0,0,07:00,9,-1,0,0,07:00 -1001,Asia/Yekaterinburg,1991,Russia,240,60,3,-1,0,0,06:00,9,-1,0,0,06:00 -1002,Asia/Yekaterinburg,1992,Russia,300,60,3,-1,6,0,28:00,9,-1,6,0,27:00 -1003,Asia/Yekaterinburg,1993,Russia,300,60,3,-1,0,0,07:00,9,-1,0,0,07:00 -1004,Asia/Yekaterinburg,1996,Russia,300,60,3,-1,0,0,07:00,10,-1,0,0,07:00 -1005,Asia/Omsk,1970,Russia,360,60,9,1,-1,0,06:00,10,1,-1,0,05:00 -1006,Asia/Omsk,1981,Russia,360,60,4,1,-1,0,06:00,10,1,-1,0,05:00 -1007,Asia/Omsk,1984,Russia,360,60,4,1,-1,0,06:00,9,-1,0,0,08:00 -1008,Asia/Omsk,1985,Russia,360,60,3,-1,0,0,08:00,9,-1,0,0,08:00 -1009,Asia/Omsk,1991,Russia,300,60,3,-1,0,0,07:00,9,-1,0,0,07:00 -1010,Asia/Omsk,1992,Russia,360,60,3,-1,6,0,29:00,9,-1,6,0,28:00 -1011,Asia/Omsk,1993,Russia,360,60,3,-1,0,0,08:00,9,-1,0,0,08:00 -1012,Asia/Omsk,1996,Russia,360,60,3,-1,0,0,08:00,10,-1,0,0,08:00 -1013,Asia/Novosibirsk,1970,Russia,420,60,9,1,-1,0,07:00,10,1,-1,0,06:00 -1014,Asia/Novosibirsk,1981,Russia,420,60,4,1,-1,0,07:00,10,1,-1,0,06:00 -1015,Asia/Novosibirsk,1984,Russia,420,60,4,1,-1,0,07:00,9,-1,0,0,09:00 -1016,Asia/Novosibirsk,1985,Russia,420,60,3,-1,0,0,09:00,9,-1,0,0,09:00 -1017,Asia/Novosibirsk,1991,Russia,360,60,3,-1,0,0,08:00,9,-1,0,0,08:00 -1018,Asia/Novosibirsk,1992,Russia,420,60,3,-1,6,0,30:00,9,-1,6,0,29:00 -1019,Asia/Novosibirsk,1993,Russia,360,60,3,-1,0,0,08:00,9,-1,0,0,08:00 -1020,Asia/Novosibirsk,1996,Russia,360,60,3,-1,0,0,08:00,10,-1,0,0,08:00 -1021,Asia/Krasnoyarsk,1970,Russia,420,60,9,1,-1,0,07:00,10,1,-1,0,06:00 -1022,Asia/Krasnoyarsk,1981,Russia,420,60,4,1,-1,0,07:00,10,1,-1,0,06:00 -1023,Asia/Krasnoyarsk,1984,Russia,420,60,4,1,-1,0,07:00,9,-1,0,0,09:00 -1024,Asia/Krasnoyarsk,1985,Russia,420,60,3,-1,0,0,09:00,9,-1,0,0,09:00 -1025,Asia/Krasnoyarsk,1991,Russia,360,60,3,-1,0,0,08:00,9,-1,0,0,08:00 -1026,Asia/Krasnoyarsk,1992,Russia,420,60,3,-1,6,0,30:00,9,-1,6,0,29:00 -1027,Asia/Krasnoyarsk,1993,Russia,420,60,3,-1,0,0,09:00,9,-1,0,0,09:00 -1028,Asia/Krasnoyarsk,1996,Russia,420,60,3,-1,0,0,09:00,10,-1,0,0,09:00 -1029,Asia/Irkutsk,1970,Russia,480,60,9,1,-1,0,08:00,10,1,-1,0,07:00 -1030,Asia/Irkutsk,1981,Russia,480,60,4,1,-1,0,08:00,10,1,-1,0,07:00 -1031,Asia/Irkutsk,1984,Russia,480,60,4,1,-1,0,08:00,9,-1,0,0,10:00 -1032,Asia/Irkutsk,1985,Russia,480,60,3,-1,0,0,10:00,9,-1,0,0,10:00 -1033,Asia/Irkutsk,1991,Russia,420,60,3,-1,0,0,09:00,9,-1,0,0,09:00 -1034,Asia/Irkutsk,1992,Russia,480,60,3,-1,6,0,31:00,9,-1,6,0,30:00 -1035,Asia/Irkutsk,1993,Russia,480,60,3,-1,0,0,10:00,9,-1,0,0,10:00 -1036,Asia/Irkutsk,1996,Russia,480,60,3,-1,0,0,10:00,10,-1,0,0,10:00 -1037,Asia/Yakutsk,1970,Russia,540,60,9,1,-1,0,09:00,10,1,-1,0,08:00 -1038,Asia/Yakutsk,1981,Russia,540,60,4,1,-1,0,09:00,10,1,-1,0,08:00 -1039,Asia/Yakutsk,1984,Russia,540,60,4,1,-1,0,09:00,9,-1,0,0,11:00 -1040,Asia/Yakutsk,1985,Russia,540,60,3,-1,0,0,11:00,9,-1,0,0,11:00 -1041,Asia/Yakutsk,1991,Russia,480,60,3,-1,0,0,10:00,9,-1,0,0,10:00 -1042,Asia/Yakutsk,1992,Russia,540,60,3,-1,6,0,32:00,9,-1,6,0,31:00 -1043,Asia/Yakutsk,1993,Russia,540,60,3,-1,0,0,11:00,9,-1,0,0,11:00 -1044,Asia/Yakutsk,1996,Russia,540,60,3,-1,0,0,11:00,10,-1,0,0,11:00 -1045,Asia/Vladivostok,1970,Russia,600,60,9,1,-1,0,10:00,10,1,-1,0,09:00 -1046,Asia/Vladivostok,1981,Russia,600,60,4,1,-1,0,10:00,10,1,-1,0,09:00 -1047,Asia/Vladivostok,1984,Russia,600,60,4,1,-1,0,10:00,9,-1,0,0,12:00 -1048,Asia/Vladivostok,1985,Russia,600,60,3,-1,0,0,12:00,9,-1,0,0,12:00 -1049,Asia/Vladivostok,1991,Russia,540,60,3,-1,0,0,11:00,9,-1,0,0,11:00 -1050,Asia/Vladivostok,1992,Russia,600,60,3,-1,6,0,33:00,9,-1,6,0,32:00 -1051,Asia/Vladivostok,1993,Russia,600,60,3,-1,0,0,12:00,9,-1,0,0,12:00 -1052,Asia/Vladivostok,1996,Russia,600,60,3,-1,0,0,12:00,10,-1,0,0,12:00 -1053,Asia/Sakhalin,1970,Russia,660,60,9,1,-1,0,11:00,10,1,-1,0,10:00 -1054,Asia/Sakhalin,1981,Russia,660,60,4,1,-1,0,11:00,10,1,-1,0,10:00 -1055,Asia/Sakhalin,1984,Russia,660,60,4,1,-1,0,11:00,9,-1,0,0,13:00 -1056,Asia/Sakhalin,1985,Russia,660,60,3,-1,0,0,13:00,9,-1,0,0,13:00 -1057,Asia/Sakhalin,1991,Russia,600,60,3,-1,0,0,12:00,9,-1,0,0,12:00 -1058,Asia/Sakhalin,1992,Russia,660,60,3,-1,6,0,34:00,9,-1,6,0,33:00 -1059,Asia/Sakhalin,1993,Russia,660,60,3,-1,0,0,13:00,9,-1,0,0,13:00 -1060,Asia/Sakhalin,1996,Russia,660,60,3,-1,0,0,13:00,10,-1,0,0,13:00 -1061,Asia/Sakhalin,1997,Russia,600,60,3,-1,0,0,12:00,10,-1,0,0,12:00 -1062,Asia/Magadan,1970,Russia,660,60,9,1,-1,0,11:00,10,1,-1,0,10:00 -1063,Asia/Magadan,1981,Russia,660,60,4,1,-1,0,11:00,10,1,-1,0,10:00 -1064,Asia/Magadan,1984,Russia,660,60,4,1,-1,0,11:00,9,-1,0,0,13:00 -1065,Asia/Magadan,1985,Russia,660,60,3,-1,0,0,13:00,9,-1,0,0,13:00 -1066,Asia/Magadan,1991,Russia,600,60,3,-1,0,0,12:00,9,-1,0,0,12:00 -1067,Asia/Magadan,1992,Russia,660,60,3,-1,6,0,34:00,9,-1,6,0,33:00 -1068,Asia/Magadan,1993,Russia,660,60,3,-1,0,0,13:00,9,-1,0,0,13:00 -1069,Asia/Magadan,1996,Russia,660,60,3,-1,0,0,13:00,10,-1,0,0,13:00 -1070,Asia/Kamchatka,1970,Russia,720,60,9,1,-1,0,12:00,10,1,-1,0,11:00 -1071,Asia/Kamchatka,1981,Russia,720,60,4,1,-1,0,12:00,10,1,-1,0,11:00 -1072,Asia/Kamchatka,1984,Russia,720,60,4,1,-1,0,12:00,9,-1,0,0,14:00 -1073,Asia/Kamchatka,1985,Russia,720,60,3,-1,0,0,14:00,9,-1,0,0,14:00 -1074,Asia/Kamchatka,1991,Russia,660,60,3,-1,0,0,13:00,9,-1,0,0,13:00 -1075,Asia/Kamchatka,1992,Russia,720,60,3,-1,6,0,35:00,9,-1,6,0,34:00 -1076,Asia/Kamchatka,1993,Russia,720,60,3,-1,0,0,14:00,9,-1,0,0,14:00 -1077,Asia/Kamchatka,1996,Russia,720,60,3,-1,0,0,14:00,10,-1,0,0,14:00 -1078,Asia/Anadyr,1970,Russia,780,60,9,1,-1,0,13:00,10,1,-1,0,12:00 -1079,Asia/Anadyr,1981,Russia,780,60,4,1,-1,0,13:00,10,1,-1,0,12:00 -1080,Asia/Anadyr,1982,Russia,720,60,4,1,-1,0,12:00,10,1,-1,0,11:00 -1081,Asia/Anadyr,1984,Russia,720,60,4,1,-1,0,12:00,9,-1,0,0,14:00 -1082,Asia/Anadyr,1985,Russia,720,60,3,-1,0,0,14:00,9,-1,0,0,14:00 -1083,Asia/Anadyr,1991,Russia,660,60,3,-1,0,0,13:00,9,-1,0,0,13:00 -1084,Asia/Anadyr,1992,Russia,720,60,3,-1,6,0,35:00,9,-1,6,0,34:00 -1085,Asia/Anadyr,1993,Russia,720,60,3,-1,0,0,14:00,9,-1,0,0,14:00 -1086,Asia/Anadyr,1996,Russia,720,60,3,-1,0,0,14:00,10,-1,0,0,14:00 -1087,Europe/Belgrade,1970,,60,0,0,0,0,0,,0,0,0,0, -1088,Europe/Belgrade,1982,EU,60,60,3,-1,0,0,1:00,9,-1,0,0,1:00 -1089,Europe/Belgrade,1996,EU,60,60,3,-1,0,0,1:00,10,-1,0,0,1:00 -1090,Europe/Madrid,1970,Spain,60,60,4,30,-1,0,24:00,9,30,-1,0,01:00 -1091,Europe/Madrid,1974,Spain,60,60,4,13,6,0,24:00,10,1,0,0,01:00 -1092,Europe/Madrid,1976,Spain,60,60,3,27,-1,0,24:00,9,-1,0,0,01:00 -1093,Europe/Madrid,1977,Spain,60,60,4,2,-1,0,24:00,9,-1,0,0,01:00 -1094,Europe/Madrid,1978,Spain,60,60,4,2,-1,0,24:00,10,1,-1,0,01:00 -1095,Europe/Madrid,1979,EU,60,60,4,1,0,0,1:00,9,-1,0,0,1:00 -1096,Europe/Madrid,1981,EU,60,60,3,-1,0,0,1:00,9,-1,0,0,1:00 -1097,Europe/Madrid,1996,EU,60,60,3,-1,0,0,1:00,10,-1,0,0,1:00 -1098,Africa/Ceuta,1970,SpainAfrica,0,60,6,3,-1,0,12:00,10,1,-1,0,-1:00 -1099,Africa/Ceuta,1974,SpainAfrica,0,60,6,24,-1,0,00:00,9,1,-1,0,-1:00 -1100,Africa/Ceuta,1976,SpainAfrica,0,60,5,1,-1,0,00:00,8,1,-1,0,-1:00 -1101,Africa/Ceuta,1977,SpainAfrica,0,60,5,1,-1,0,00:00,9,28,-1,0,-1:00 -1102,Africa/Ceuta,1978,SpainAfrica,0,60,6,1,-1,0,00:00,8,4,-1,0,-1:00 -1103,Africa/Ceuta,1979,SpainAfrica,0,0,6,1,-1,0,00:00,8,4,-1,0,-1:00 -1104,Africa/Ceuta,1984,,60,0,0,0,0,0,,0,0,0,0, -1105,Africa/Ceuta,1986,EU,60,60,3,-1,0,0,1:00,9,-1,0,0,1:00 -1106,Africa/Ceuta,1996,EU,60,60,3,-1,0,0,1:00,10,-1,0,0,1:00 -1107,Atlantic/Canary,1970,,0,0,0,0,0,0,,0,0,0,0, -1108,Atlantic/Canary,1980,EU,0,60,4,1,0,0,1:00,9,-1,0,0,1:00 -1109,Atlantic/Canary,1981,EU,0,60,3,-1,0,0,1:00,9,-1,0,0,1:00 -1110,Atlantic/Canary,1996,EU,0,60,3,-1,0,0,1:00,10,-1,0,0,1:00 -1111,Europe/Stockholm,1970,,60,0,0,0,0,0,,0,0,0,0, -1112,Europe/Stockholm,1980,EU,60,60,4,1,0,0,1:00,9,-1,0,0,1:00 -1113,Europe/Stockholm,1981,EU,60,60,3,-1,0,0,1:00,9,-1,0,0,1:00 -1114,Europe/Stockholm,1996,EU,60,60,3,-1,0,0,1:00,10,-1,0,0,1:00 -1115,Europe/Zurich,1970,Swiss,60,0,5,1,0,0,03:00,10,1,0,0,00:00 -1116,Europe/Zurich,1981,EU,60,60,3,-1,0,0,1:00,9,-1,0,0,1:00 -1117,Europe/Zurich,1996,EU,60,60,3,-1,0,0,1:00,10,-1,0,0,1:00 -1118,Europe/Istanbul,1970,Turkey,120,60,5,2,0,0,02:00,10,2,0,0,01:00 -1119,Europe/Istanbul,1973,Turkey,120,60,6,3,-1,0,03:00,11,4,-1,0,04:00 -1120,Europe/Istanbul,1974,Turkey,120,60,3,31,-1,0,04:00,11,3,-1,0,06:00 -1121,Europe/Istanbul,1975,Turkey,120,60,3,30,-1,0,02:00,10,-1,0,0,01:00 -1122,Europe/Istanbul,1976,Turkey,120,60,6,1,-1,0,02:00,10,-1,0,0,01:00 -1123,Europe/Istanbul,1977,Turkey,120,60,4,1,0,0,02:00,10,16,-1,0,01:00 -1124,Europe/Istanbul,1978,Turkey,180,60,4,1,0,0,03:00,1,1,-1,0,14:00 -1125,Europe/Istanbul,1979,Turkey,180,60,4,1,0,0,06:00,10,11,1,0,02:00 -1126,Europe/Istanbul,1981,Turkey,180,60,3,-1,0,0,06:00,10,11,1,0,02:00 -1127,Europe/Istanbul,1983,Turkey,180,60,7,31,-1,0,03:00,10,2,-1,0,02:00 -1128,Europe/Istanbul,1985,Turkey,120,60,4,20,-1,0,02:00,9,28,-1,0,01:00 -1129,Europe/Istanbul,1986,Turkey,120,60,3,-1,0,0,04:00,9,-1,0,0,04:00 -1130,Europe/Istanbul,1991,Turkey,120,60,3,-1,0,0,03:00,9,-1,0,0,03:00 -1131,Europe/Istanbul,1996,Turkey,120,60,3,-1,0,0,03:00,10,-1,0,0,03:00 -1132,Europe/Kiev,1970,Russia,180,60,9,1,-1,0,03:00,10,1,-1,0,02:00 -1133,Europe/Kiev,1981,Russia,180,60,4,1,-1,0,03:00,10,1,-1,0,02:00 -1134,Europe/Kiev,1984,Russia,180,60,4,1,-1,0,03:00,9,-1,0,0,05:00 -1135,Europe/Kiev,1985,Russia,180,60,3,-1,0,0,05:00,9,-1,0,0,05:00 -1136,Europe/Kiev,1990,,120,0,0,0,0,0,,0,0,0,0, -1137,Europe/Kiev,1992,E-Eur,120,60,3,-1,0,0,02:00,9,-1,0,0,01:00 -1138,Europe/Kiev,1995,EU,120,60,3,-1,0,0,1:00,9,-1,0,0,1:00 -1139,Europe/Kiev,1996,EU,120,60,3,-1,0,0,1:00,10,-1,0,0,1:00 -1140,Europe/Uzhgorod,1970,Russia,180,60,9,1,-1,0,03:00,10,1,-1,0,02:00 -1141,Europe/Uzhgorod,1981,Russia,180,60,4,1,-1,0,03:00,10,1,-1,0,02:00 -1142,Europe/Uzhgorod,1984,Russia,180,60,4,1,-1,0,03:00,9,-1,0,0,05:00 -1143,Europe/Uzhgorod,1985,Russia,180,60,3,-1,0,0,05:00,9,-1,0,0,05:00 -1144,Europe/Uzhgorod,1990,,60,0,0,0,0,0,,0,0,0,0, -1145,Europe/Uzhgorod,1991,,120,0,0,0,0,0,,0,0,0,0, -1146,Europe/Uzhgorod,1992,E-Eur,120,60,3,-1,0,0,02:00,9,-1,0,0,01:00 -1147,Europe/Uzhgorod,1995,EU,120,60,3,-1,0,0,1:00,9,-1,0,0,1:00 -1148,Europe/Uzhgorod,1996,EU,120,60,3,-1,0,0,1:00,10,-1,0,0,1:00 -1149,Europe/Zaporozhye,1970,Russia,180,60,9,1,-1,0,03:00,10,1,-1,0,02:00 -1150,Europe/Zaporozhye,1981,Russia,180,60,4,1,-1,0,03:00,10,1,-1,0,02:00 -1151,Europe/Zaporozhye,1984,Russia,180,60,4,1,-1,0,03:00,9,-1,0,0,05:00 -1152,Europe/Zaporozhye,1985,Russia,180,60,3,-1,0,0,05:00,9,-1,0,0,05:00 -1153,Europe/Zaporozhye,1991,E-Eur,120,60,3,-1,0,0,02:00,9,-1,0,0,01:00 -1154,Europe/Zaporozhye,1995,EU,120,60,3,-1,0,0,1:00,9,-1,0,0,1:00 -1155,Europe/Zaporozhye,1996,EU,120,60,3,-1,0,0,1:00,10,-1,0,0,1:00 -1156,Europe/Simferopol,1970,Russia,180,60,9,1,-1,0,03:00,10,1,-1,0,02:00 -1157,Europe/Simferopol,1981,Russia,180,60,4,1,-1,0,03:00,10,1,-1,0,02:00 -1158,Europe/Simferopol,1984,Russia,180,60,4,1,-1,0,03:00,9,-1,0,0,05:00 -1159,Europe/Simferopol,1985,Russia,180,60,3,-1,0,0,05:00,9,-1,0,0,05:00 -1160,Europe/Simferopol,1990,,120,0,0,0,0,0,,0,0,0,0, -1161,Europe/Simferopol,1992,E-Eur,120,60,3,-1,0,0,02:00,9,-1,0,0,01:00 -1162,Europe/Simferopol,1994,E-Eur,180,60,3,-1,0,0,03:00,9,-1,0,0,02:00 -1163,Europe/Simferopol,1996,Russia,180,60,3,-1,0,0,05:00,10,-1,0,0,05:00 -1164,Europe/Simferopol,1997,EU,120,60,3,-1,0,0,1:00,10,-1,0,0,1:00 -1165,EST,1970,,-300,0,0,0,0,0,,0,0,0,0, -1166,MST,1970,,-420,0,0,0,0,0,,0,0,0,0, -1167,HST,1970,,-600,0,0,0,0,0,,0,0,0,0, -1168,EST5EDT,1970,US,-300,60,4,-1,0,0,-3:00,10,-1,0,0,-4:00 -1169,EST5EDT,1974,US,-300,60,1,6,-1,0,-3:00,10,-1,0,0,-4:00 -1170,EST5EDT,1975,US,-300,60,2,23,-1,0,-3:00,10,-1,0,0,-4:00 -1171,EST5EDT,1976,US,-300,60,4,-1,0,0,-3:00,10,-1,0,0,-4:00 -1172,EST5EDT,1987,US,-300,60,4,1,0,0,-3:00,10,-1,0,0,-4:00 -1173,EST5EDT,2007,US,-300,60,3,8,0,0,-3:00,11,1,0,0,-4:00 -1174,CST6CDT,1970,US,-360,60,4,-1,0,0,-4:00,10,-1,0,0,-5:00 -1175,CST6CDT,1974,US,-360,60,1,6,-1,0,-4:00,10,-1,0,0,-5:00 -1176,CST6CDT,1975,US,-360,60,2,23,-1,0,-4:00,10,-1,0,0,-5:00 -1177,CST6CDT,1976,US,-360,60,4,-1,0,0,-4:00,10,-1,0,0,-5:00 -1178,CST6CDT,1987,US,-360,60,4,1,0,0,-4:00,10,-1,0,0,-5:00 -1179,CST6CDT,2007,US,-360,60,3,8,0,0,-4:00,11,1,0,0,-5:00 -1180,MST7MDT,1970,US,-420,60,4,-1,0,0,-5:00,10,-1,0,0,-6:00 -1181,MST7MDT,1974,US,-420,60,1,6,-1,0,-5:00,10,-1,0,0,-6:00 -1182,MST7MDT,1975,US,-420,60,2,23,-1,0,-5:00,10,-1,0,0,-6:00 -1183,MST7MDT,1976,US,-420,60,4,-1,0,0,-5:00,10,-1,0,0,-6:00 -1184,MST7MDT,1987,US,-420,60,4,1,0,0,-5:00,10,-1,0,0,-6:00 -1185,MST7MDT,2007,US,-420,60,3,8,0,0,-5:00,11,1,0,0,-6:00 -1186,PST8PDT,1970,US,-480,60,4,-1,0,0,-6:00,10,-1,0,0,-7:00 -1187,PST8PDT,1974,US,-480,60,1,6,-1,0,-6:00,10,-1,0,0,-7:00 -1188,PST8PDT,1975,US,-480,60,2,23,-1,0,-6:00,10,-1,0,0,-7:00 -1189,PST8PDT,1976,US,-480,60,4,-1,0,0,-6:00,10,-1,0,0,-7:00 -1190,PST8PDT,1987,US,-480,60,4,1,0,0,-6:00,10,-1,0,0,-7:00 -1191,PST8PDT,2007,US,-480,60,3,8,0,0,-6:00,11,1,0,0,-7:00 -1192,America/New_York,1970,US,-300,60,4,-1,0,0,-3:00,10,-1,0,0,-4:00 -1193,America/New_York,1974,US,-300,60,1,6,-1,0,-3:00,10,-1,0,0,-4:00 -1194,America/New_York,1975,US,-300,60,2,23,-1,0,-3:00,10,-1,0,0,-4:00 -1195,America/New_York,1976,US,-300,60,4,-1,0,0,-3:00,10,-1,0,0,-4:00 -1196,America/New_York,1987,US,-300,60,4,1,0,0,-3:00,10,-1,0,0,-4:00 -1197,America/New_York,2007,US,-300,60,3,8,0,0,-3:00,11,1,0,0,-4:00 -1198,America/Chicago,1970,US,-360,60,4,-1,0,0,-4:00,10,-1,0,0,-5:00 -1199,America/Chicago,1974,US,-360,60,1,6,-1,0,-4:00,10,-1,0,0,-5:00 -1200,America/Chicago,1975,US,-360,60,2,23,-1,0,-4:00,10,-1,0,0,-5:00 -1201,America/Chicago,1976,US,-360,60,4,-1,0,0,-4:00,10,-1,0,0,-5:00 -1202,America/Chicago,1987,US,-360,60,4,1,0,0,-4:00,10,-1,0,0,-5:00 -1203,America/Chicago,2007,US,-360,60,3,8,0,0,-4:00,11,1,0,0,-5:00 -1204,America/North_Dakota/Center,1970,US,-420,60,4,-1,0,0,-5:00,10,-1,0,0,-6:00 -1205,America/North_Dakota/Center,1974,US,-420,60,1,6,-1,0,-5:00,10,-1,0,0,-6:00 -1206,America/North_Dakota/Center,1975,US,-420,60,2,23,-1,0,-5:00,10,-1,0,0,-6:00 -1207,America/North_Dakota/Center,1976,US,-420,60,4,-1,0,0,-5:00,10,-1,0,0,-6:00 -1208,America/North_Dakota/Center,1987,US,-420,60,4,1,0,0,-5:00,10,-1,0,0,-6:00 -1209,America/North_Dakota/Center,1992,US,-360,60,4,1,0,0,-4:00,10,-1,0,0,-5:00 -1210,America/North_Dakota/Center,2007,US,-360,60,3,8,0,0,-4:00,11,1,0,0,-5:00 -1211,America/North_Dakota/New_Salem,1970,US,-420,60,4,-1,0,0,-5:00,10,-1,0,0,-6:00 -1212,America/North_Dakota/New_Salem,1974,US,-420,60,1,6,-1,0,-5:00,10,-1,0,0,-6:00 -1213,America/North_Dakota/New_Salem,1975,US,-420,60,2,23,-1,0,-5:00,10,-1,0,0,-6:00 -1214,America/North_Dakota/New_Salem,1976,US,-420,60,4,-1,0,0,-5:00,10,-1,0,0,-6:00 -1215,America/North_Dakota/New_Salem,1987,US,-420,60,4,1,0,0,-5:00,10,-1,0,0,-6:00 -1216,America/North_Dakota/New_Salem,2003,US,-360,60,4,1,0,0,-4:00,10,-1,0,0,-5:00 -1217,America/North_Dakota/New_Salem,2007,US,-360,60,3,8,0,0,-4:00,11,1,0,0,-5:00 -1218,America/Denver,1970,US,-420,60,4,-1,0,0,-5:00,10,-1,0,0,-6:00 -1219,America/Denver,1974,US,-420,60,1,6,-1,0,-5:00,10,-1,0,0,-6:00 -1220,America/Denver,1975,US,-420,60,2,23,-1,0,-5:00,10,-1,0,0,-6:00 -1221,America/Denver,1976,US,-420,60,4,-1,0,0,-5:00,10,-1,0,0,-6:00 -1222,America/Denver,1987,US,-420,60,4,1,0,0,-5:00,10,-1,0,0,-6:00 -1223,America/Denver,2007,US,-420,60,3,8,0,0,-5:00,11,1,0,0,-6:00 -1224,America/Los_Angeles,1970,US,-480,60,4,-1,0,0,-6:00,10,-1,0,0,-7:00 -1225,America/Los_Angeles,1974,US,-480,60,1,6,-1,0,-6:00,10,-1,0,0,-7:00 -1226,America/Los_Angeles,1975,US,-480,60,2,23,-1,0,-6:00,10,-1,0,0,-7:00 -1227,America/Los_Angeles,1976,US,-480,60,4,-1,0,0,-6:00,10,-1,0,0,-7:00 -1228,America/Los_Angeles,1987,US,-480,60,4,1,0,0,-6:00,10,-1,0,0,-7:00 -1229,America/Los_Angeles,2007,US,-480,60,3,8,0,0,-6:00,11,1,0,0,-7:00 -1230,America/Juneau,1970,US,-480,60,4,-1,0,0,-6:00,10,-1,0,0,-7:00 -1231,America/Juneau,1974,US,-480,60,1,6,-1,0,-6:00,10,-1,0,0,-7:00 -1232,America/Juneau,1975,US,-480,60,2,23,-1,0,-6:00,10,-1,0,0,-7:00 -1233,America/Juneau,1976,US,-480,60,4,-1,0,0,-6:00,10,-1,0,0,-7:00 -1234,America/Juneau,1983,US,-540,60,4,-1,0,0,-7:00,10,-1,0,0,-8:00 -1235,America/Juneau,1987,US,-540,60,4,1,0,0,-7:00,10,-1,0,0,-8:00 -1236,America/Juneau,2007,US,-540,60,3,8,0,0,-7:00,11,1,0,0,-8:00 -1237,America/Yakutat,1970,US,-540,60,4,-1,0,0,-7:00,10,-1,0,0,-8:00 -1238,America/Yakutat,1974,US,-540,60,1,6,-1,0,-7:00,10,-1,0,0,-8:00 -1239,America/Yakutat,1975,US,-540,60,2,23,-1,0,-7:00,10,-1,0,0,-8:00 -1240,America/Yakutat,1976,US,-540,60,4,-1,0,0,-7:00,10,-1,0,0,-8:00 -1241,America/Yakutat,1987,US,-540,60,4,1,0,0,-7:00,10,-1,0,0,-8:00 -1242,America/Yakutat,2007,US,-540,60,3,8,0,0,-7:00,11,1,0,0,-8:00 -1243,America/Anchorage,1970,US,-600,60,4,-1,0,0,-8:00,10,-1,0,0,-9:00 -1244,America/Anchorage,1974,US,-600,60,1,6,-1,0,-8:00,10,-1,0,0,-9:00 -1245,America/Anchorage,1975,US,-600,60,2,23,-1,0,-8:00,10,-1,0,0,-9:00 -1246,America/Anchorage,1976,US,-600,60,4,-1,0,0,-8:00,10,-1,0,0,-9:00 -1247,America/Anchorage,1983,US,-540,60,4,-1,0,0,-7:00,10,-1,0,0,-8:00 -1248,America/Anchorage,1987,US,-540,60,4,1,0,0,-7:00,10,-1,0,0,-8:00 -1249,America/Anchorage,2007,US,-540,60,3,8,0,0,-7:00,11,1,0,0,-8:00 -1250,America/Nome,1970,US,-660,60,4,-1,0,0,-9:00,10,-1,0,0,-10:0 -1251,America/Nome,1974,US,-660,60,1,6,-1,0,-9:00,10,-1,0,0,-10:0 -1252,America/Nome,1975,US,-660,60,2,23,-1,0,-9:00,10,-1,0,0,-10:0 -1253,America/Nome,1976,US,-660,60,4,-1,0,0,-9:00,10,-1,0,0,-10:0 -1254,America/Nome,1983,US,-540,60,4,-1,0,0,-7:00,10,-1,0,0,-8:00 -1255,America/Nome,1987,US,-540,60,4,1,0,0,-7:00,10,-1,0,0,-8:00 -1256,America/Nome,2007,US,-540,60,3,8,0,0,-7:00,11,1,0,0,-8:00 -1257,America/Adak,1970,US,-660,60,4,-1,0,0,-9:00,10,-1,0,0,-10:0 -1258,America/Adak,1974,US,-660,60,1,6,-1,0,-9:00,10,-1,0,0,-10:0 -1259,America/Adak,1975,US,-660,60,2,23,-1,0,-9:00,10,-1,0,0,-10:0 -1260,America/Adak,1976,US,-660,60,4,-1,0,0,-9:00,10,-1,0,0,-10:0 -1261,America/Adak,1983,US,-600,60,4,-1,0,0,-8:00,10,-1,0,0,-9:00 -1262,America/Adak,1987,US,-600,60,4,1,0,0,-8:00,10,-1,0,0,-9:00 -1263,America/Adak,2007,US,-600,60,3,8,0,0,-8:00,11,1,0,0,-9:00 -1264,Pacific/Honolulu,1970,,-600,0,0,0,0,0,,0,0,0,0, -1265,America/Phoenix,1970,,-420,0,0,0,0,0,,0,0,0,0, -1266,America/Boise,1970,US,-420,60,4,-1,0,0,-5:00,10,-1,0,0,-6:00 -1267,America/Boise,1974,US,-420,60,1,6,-1,0,-5:00,10,-1,0,0,-6:00 -1268,America/Boise,1975,US,-420,60,2,23,-1,0,-5:00,10,-1,0,0,-6:00 -1269,America/Boise,1976,US,-420,60,4,-1,0,0,-5:00,10,-1,0,0,-6:00 -1270,America/Boise,1987,US,-420,60,4,1,0,0,-5:00,10,-1,0,0,-6:00 -1271,America/Boise,2007,US,-420,60,3,8,0,0,-5:00,11,1,0,0,-6:00 -1272,America/Indiana/Indianapolis,1970,US,-300,60,4,-1,0,0,-3:00,10,-1,0,0,-4:00 -1273,America/Indiana/Indianapolis,1971,,-300,0,0,0,0,0,,0,0,0,0, -1274,America/Indiana/Indianapolis,2006,US,-300,60,4,1,0,0,-3:00,10,-1,0,0,-4:00 -1275,America/Indiana/Indianapolis,2007,US,-300,60,3,8,0,0,-3:00,11,1,0,0,-4:00 -1276,America/Indiana/Marengo,1970,US,-300,60,4,-1,0,0,-3:00,10,-1,0,0,-4:00 -1277,America/Indiana/Marengo,1974,US,-300,60,1,6,-1,0,-3:00,10,-1,0,0,-4:00 -1278,America/Indiana/Marengo,1975,US,-300,60,2,23,-1,0,-3:00,10,-1,0,0,-4:00 -1279,America/Indiana/Marengo,1976,,-300,0,0,0,0,0,,0,0,0,0, -1280,America/Indiana/Marengo,2006,US,-300,60,4,1,0,0,-3:00,10,-1,0,0,-4:00 -1281,America/Indiana/Marengo,2007,US,-300,60,3,8,0,0,-3:00,11,1,0,0,-4:00 -1282,America/Indiana/Vincennes,1970,US,-300,60,4,-1,0,0,-3:00,10,-1,0,0,-4:00 -1283,America/Indiana/Vincennes,1971,,-300,0,0,0,0,0,,0,0,0,0, -1284,America/Indiana/Vincennes,2006,US,-360,60,4,1,0,0,-4:00,10,-1,0,0,-5:00 -1285,America/Indiana/Vincennes,2007,US,-360,60,3,8,0,0,-4:00,11,1,0,0,-5:00 -1286,America/Indiana/Petersburg,1970,US,-360,60,4,-1,0,0,-4:00,10,-1,0,0,-5:00 -1287,America/Indiana/Petersburg,1974,US,-360,60,1,6,-1,0,-4:00,10,-1,0,0,-5:00 -1288,America/Indiana/Petersburg,1975,US,-360,60,2,23,-1,0,-4:00,10,-1,0,0,-5:00 -1289,America/Indiana/Petersburg,1976,US,-360,60,4,-1,0,0,-4:00,10,-1,0,0,-5:00 -1290,America/Indiana/Petersburg,1977,,-300,0,0,0,0,0,,0,0,0,0, -1291,America/Indiana/Petersburg,2006,US,-360,60,4,1,0,0,-4:00,10,-1,0,0,-5:00 -1292,America/Indiana/Petersburg,2007,US,-360,60,3,8,0,0,-4:00,11,1,0,0,-5:00 -1293,America/Indiana/Knox,1970,US,-360,60,4,-1,0,0,-4:00,10,-1,0,0,-5:00 -1294,America/Indiana/Knox,1974,US,-360,60,1,6,-1,0,-4:00,10,-1,0,0,-5:00 -1295,America/Indiana/Knox,1975,US,-360,60,2,23,-1,0,-4:00,10,-1,0,0,-5:00 -1296,America/Indiana/Knox,1976,US,-360,60,4,-1,0,0,-4:00,10,-1,0,0,-5:00 -1297,America/Indiana/Knox,1987,US,-360,60,4,1,0,0,-4:00,10,-1,0,0,-5:00 -1298,America/Indiana/Knox,1991,,-300,0,0,0,0,0,,0,0,0,0, -1299,America/Indiana/Knox,2006,US,-360,60,4,1,0,0,-4:00,10,-1,0,0,-5:00 -1300,America/Indiana/Knox,2007,US,-360,60,3,8,0,0,-4:00,11,1,0,0,-5:00 -1301,America/Indiana/Winamac,1970,US,-300,60,4,-1,0,0,-3:00,10,-1,0,0,-4:00 -1302,America/Indiana/Winamac,1971,,-300,0,0,0,0,0,,0,0,0,0, -1303,America/Indiana/Winamac,2006,US,-360,60,4,1,0,0,-4:00,10,-1,0,0,-5:00 -1304,America/Indiana/Winamac,2007,US,-300,60,3,8,0,0,-3:00,11,1,0,0,-4:00 -1305,America/Indiana/Vevay,1970,US,-300,60,4,-1,0,0,-3:00,10,-1,0,0,-4:00 -1306,America/Indiana/Vevay,1973,,-300,0,0,0,0,0,,0,0,0,0, -1307,America/Indiana/Vevay,2006,US,-300,60,4,1,0,0,-3:00,10,-1,0,0,-4:00 -1308,America/Indiana/Vevay,2007,US,-300,60,3,8,0,0,-3:00,11,1,0,0,-4:00 -1309,America/Kentucky/Louisville,1970,US,-300,60,4,-1,0,0,-3:00,10,-1,0,0,-4:00 -1310,America/Kentucky/Louisville,1974,US,-300,60,1,6,-1,0,-3:00,10,-1,0,0,-4:00 -1311,America/Kentucky/Louisville,1975,US,-300,60,2,23,-1,0,-3:00,10,-1,0,0,-4:00 -1312,America/Kentucky/Louisville,1976,US,-300,60,4,-1,0,0,-3:00,10,-1,0,0,-4:00 -1313,America/Kentucky/Louisville,1987,US,-300,60,4,1,0,0,-3:00,10,-1,0,0,-4:00 -1314,America/Kentucky/Louisville,2007,US,-300,60,3,8,0,0,-3:00,11,1,0,0,-4:00 -1315,America/Kentucky/Monticello,1970,US,-360,60,4,-1,0,0,-4:00,10,-1,0,0,-5:00 -1316,America/Kentucky/Monticello,1974,US,-360,60,1,6,-1,0,-4:00,10,-1,0,0,-5:00 -1317,America/Kentucky/Monticello,1975,US,-360,60,2,23,-1,0,-4:00,10,-1,0,0,-5:00 -1318,America/Kentucky/Monticello,1976,US,-360,60,4,-1,0,0,-4:00,10,-1,0,0,-5:00 -1319,America/Kentucky/Monticello,1987,US,-360,60,4,1,0,0,-4:00,10,-1,0,0,-5:00 -1320,America/Kentucky/Monticello,2000,US,-300,60,4,1,0,0,-3:00,10,-1,0,0,-4:00 -1321,America/Kentucky/Monticello,2007,US,-300,60,3,8,0,0,-3:00,11,1,0,0,-4:00 -1322,America/Detroit,1970,Detroit,-300,0,6,14,-1,0,-3:00,10,-1,0,0,-4:00 -1323,America/Detroit,1973,US,-300,60,4,-1,0,0,-3:00,10,-1,0,0,-4:00 -1324,America/Detroit,1974,US,-300,60,1,6,-1,0,-3:00,10,-1,0,0,-4:00 -1325,America/Detroit,1975,US,-300,60,2,23,-1,0,-3:00,10,-1,0,0,-4:00 -1326,America/Detroit,1976,US,-300,60,4,-1,0,0,-3:00,10,-1,0,0,-4:00 -1327,America/Detroit,1987,US,-300,60,4,1,0,0,-3:00,10,-1,0,0,-4:00 -1328,America/Detroit,2007,US,-300,60,3,8,0,0,-3:00,11,1,0,0,-4:00 -1329,America/Menominee,1970,,-300,0,0,0,0,0,,0,0,0,0, -1330,America/Menominee,1973,US,-360,60,4,-1,0,0,-4:00,10,-1,0,0,-5:00 -1331,America/Menominee,1974,US,-360,60,1,6,-1,0,-4:00,10,-1,0,0,-5:00 -1332,America/Menominee,1975,US,-360,60,2,23,-1,0,-4:00,10,-1,0,0,-5:00 -1333,America/Menominee,1976,US,-360,60,4,-1,0,0,-4:00,10,-1,0,0,-5:00 -1334,America/Menominee,1987,US,-360,60,4,1,0,0,-4:00,10,-1,0,0,-5:00 -1335,America/Menominee,2007,US,-360,60,3,8,0,0,-4:00,11,1,0,0,-5:00 -1336,America/St_Johns,1970,StJohns,-210,60,4,-1,0,0,-1:30,10,-1,0,0,-2:30 -1337,America/St_Johns,1987,StJohns,-210,60,4,1,0,0,-3:29,10,-1,0,0,-4:29 -1338,America/St_Johns,1988,StJohns,-210,120,4,1,0,0,-3:29,10,-1,0,0,-4:29 -1339,America/St_Johns,1989,StJohns,-210,60,4,1,0,0,-3:29,10,-1,0,0,-4:29 -1340,America/St_Johns,2007,StJohns,-210,60,3,8,0,0,-3:29,11,1,0,0,-4:29 -1341,America/Goose_Bay,1970,StJohns,-240,60,4,-1,0,0,-2:00,10,-1,0,0,-3:00 -1342,America/Goose_Bay,1987,StJohns,-240,60,4,1,0,0,-3:59,10,-1,0,0,-4:59 -1343,America/Goose_Bay,1988,StJohns,-240,120,4,1,0,0,-3:59,10,-1,0,0,-4:59 -1344,America/Goose_Bay,1989,StJohns,-240,60,4,1,0,0,-3:59,10,-1,0,0,-4:59 -1345,America/Goose_Bay,2007,StJohns,-240,60,3,8,0,0,-3:59,11,1,0,0,-4:59 -1346,America/Halifax,1970,Halifax,-240,60,4,-1,0,0,-2:00,10,-1,0,0,-3:00 -1347,America/Halifax,1973,Halifax,-240,0,4,-1,0,0,-2:00,10,-1,0,0,-3:00 -1348,America/Halifax,1974,Canada,-240,60,4,-1,0,0,-2:00,10,-1,0,0,-3:00 -1349,America/Halifax,1987,Canada,-240,60,4,1,0,0,-2:00,10,-1,0,0,-3:00 -1350,America/Halifax,2007,Canada,-240,60,3,8,0,0,-2:00,11,1,0,0,-3:00 -1351,America/Glace_Bay,1970,,-240,0,0,0,0,0,,0,0,0,0, -1352,America/Glace_Bay,1972,Halifax,-240,60,4,-1,0,0,-2:00,10,-1,0,0,-3:00 -1353,America/Glace_Bay,1973,Halifax,-240,0,4,-1,0,0,-2:00,10,-1,0,0,-3:00 -1354,America/Glace_Bay,1974,Canada,-240,60,4,-1,0,0,-2:00,10,-1,0,0,-3:00 -1355,America/Glace_Bay,1987,Canada,-240,60,4,1,0,0,-2:00,10,-1,0,0,-3:00 -1356,America/Glace_Bay,2007,Canada,-240,60,3,8,0,0,-2:00,11,1,0,0,-3:00 -1357,America/Moncton,1970,Moncton,-240,60,4,-1,0,0,-2:00,10,-1,0,0,-3:00 -1358,America/Moncton,1973,Canada,-240,60,4,-1,0,0,-2:00,10,-1,0,0,-3:00 -1359,America/Moncton,1987,Canada,-240,60,4,1,0,0,-2:00,10,-1,0,0,-3:00 -1360,America/Moncton,1993,Moncton,-240,60,4,1,0,0,-3:59,10,-1,0,0,-4:59 -1361,America/Moncton,2006,Moncton,-240,0,4,1,0,0,-3:59,10,-1,0,0,-4:59 -1362,America/Moncton,2007,Canada,-240,60,3,8,0,0,-2:00,11,1,0,0,-3:00 -1363,America/Blanc-Sablon,1970,,-240,0,0,0,0,0,,0,0,0,0, -1364,America/Montreal,1970,Mont,-300,60,4,-1,0,0,-3:00,10,-1,0,0,-4:00 -1365,America/Montreal,1974,Canada,-300,60,4,-1,0,0,-3:00,10,-1,0,0,-4:00 -1366,America/Montreal,1987,Canada,-300,60,4,1,0,0,-3:00,10,-1,0,0,-4:00 -1367,America/Montreal,2007,Canada,-300,60,3,8,0,0,-3:00,11,1,0,0,-4:00 -1368,America/Toronto,1970,Toronto,-300,60,4,-1,0,0,-3:00,10,-1,0,0,-4:00 -1369,America/Toronto,1973,Toronto,-300,0,4,-1,0,0,-3:00,10,-1,0,0,-4:00 -1370,America/Toronto,1974,Canada,-300,60,4,-1,0,0,-3:00,10,-1,0,0,-4:00 -1371,America/Toronto,1987,Canada,-300,60,4,1,0,0,-3:00,10,-1,0,0,-4:00 -1372,America/Toronto,2007,Canada,-300,60,3,8,0,0,-3:00,11,1,0,0,-4:00 -1373,America/Thunder_Bay,1970,Mont,-300,60,4,-1,0,0,-3:00,10,-1,0,0,-4:00 -1374,America/Thunder_Bay,1973,,-300,0,0,0,0,0,,0,0,0,0, -1375,America/Thunder_Bay,1974,Canada,-300,60,4,-1,0,0,-3:00,10,-1,0,0,-4:00 -1376,America/Thunder_Bay,1987,Canada,-300,60,4,1,0,0,-3:00,10,-1,0,0,-4:00 -1377,America/Thunder_Bay,2007,Canada,-300,60,3,8,0,0,-3:00,11,1,0,0,-4:00 -1378,America/Nipigon,1970,Canada,-300,60,8,14,-1,0,23:00,9,30,-1,0,-4:00 -1379,America/Nipigon,1974,Canada,-300,60,4,-1,0,0,-3:00,10,-1,0,0,-4:00 -1380,America/Nipigon,1987,Canada,-300,60,4,1,0,0,-3:00,10,-1,0,0,-4:00 -1381,America/Nipigon,2007,Canada,-300,60,3,8,0,0,-3:00,11,1,0,0,-4:00 -1382,America/Rainy_River,1970,Canada,-360,60,8,14,-1,0,23:00,9,30,-1,0,-5:00 -1383,America/Rainy_River,1974,Canada,-360,60,4,-1,0,0,-4:00,10,-1,0,0,-5:00 -1384,America/Rainy_River,1987,Canada,-360,60,4,1,0,0,-4:00,10,-1,0,0,-5:00 -1385,America/Rainy_River,2007,Canada,-360,60,3,8,0,0,-4:00,11,1,0,0,-5:00 -1386,America/Atikokan,1970,,-300,0,0,0,0,0,,0,0,0,0, -1387,America/Winnipeg,1970,Winn,-360,60,4,-1,0,0,-4:00,10,-1,0,0,-4:00 -1388,America/Winnipeg,1987,Winn,-360,60,4,1,0,0,-4:00,10,-1,0,0,-4:00 -1389,America/Winnipeg,2005,Winn,-360,0,4,1,0,0,-4:00,10,-1,0,0,-4:00 -1390,America/Winnipeg,2006,Canada,-360,60,4,1,0,0,-4:00,10,-1,0,0,-5:00 -1391,America/Winnipeg,2007,Canada,-360,60,3,8,0,0,-4:00,11,1,0,0,-5:00 -1392,America/Regina,1970,,-360,0,0,0,0,0,,0,0,0,0, -1393,America/Swift_Current,1970,Swift,-420,0,4,-1,0,0,-5:00,9,-1,0,0,-6:00 -1394,America/Swift_Current,1972,,-360,0,0,0,0,0,,0,0,0,0, -1395,America/Edmonton,1970,Edm,-420,60,4,-1,0,0,-5:00,10,-1,0,0,-6:00 -1396,America/Edmonton,1987,Canada,-420,60,4,1,0,0,-5:00,10,-1,0,0,-6:00 -1397,America/Edmonton,2007,Canada,-420,60,3,8,0,0,-5:00,11,1,0,0,-6:00 -1398,America/Vancouver,1970,Vanc,-480,60,4,-1,0,0,-6:00,10,-1,0,0,-7:00 -1399,America/Vancouver,1987,Canada,-480,60,4,1,0,0,-6:00,10,-1,0,0,-7:00 -1400,America/Vancouver,2007,Canada,-480,60,3,8,0,0,-6:00,11,1,0,0,-7:00 -1401,America/Dawson_Creek,1970,Vanc,-480,60,4,-1,0,0,-6:00,10,-1,0,0,-7:00 -1402,America/Dawson_Creek,1972,,-420,0,0,0,0,0,,0,0,0,0, -1403,America/Pangnirtung,1970,NT_YK,-240,120,4,-1,0,0,-4:00,10,-1,0,0,-3:00 -1404,America/Pangnirtung,1980,NT_YK,-240,60,4,-1,0,0,-2:00,10,-1,0,0,-3:00 -1405,America/Pangnirtung,1987,NT_YK,-240,60,4,1,0,0,-2:00,10,-1,0,0,-3:00 -1406,America/Pangnirtung,1995,Canada,-300,60,4,1,0,0,-3:00,10,-1,0,0,-4:00 -1407,America/Pangnirtung,1999,Canada,-360,60,4,1,0,0,-4:00,10,-1,0,0,-5:00 -1408,America/Pangnirtung,2000,Canada,-300,60,4,1,0,0,-3:00,10,-1,0,0,-4:00 -1409,America/Pangnirtung,2007,Canada,-300,60,3,8,0,0,-3:00,11,1,0,0,-4:00 -1410,America/Iqaluit,1970,NT_YK,-300,120,4,-1,0,0,-5:00,10,-1,0,0,-4:00 -1411,America/Iqaluit,1980,NT_YK,-300,60,4,-1,0,0,-3:00,10,-1,0,0,-4:00 -1412,America/Iqaluit,1987,NT_YK,-300,60,4,1,0,0,-3:00,10,-1,0,0,-4:00 -1413,America/Iqaluit,1999,Canada,-360,60,4,1,0,0,-4:00,10,-1,0,0,-5:00 -1414,America/Iqaluit,2000,Canada,-300,60,4,1,0,0,-3:00,10,-1,0,0,-4:00 -1415,America/Iqaluit,2007,Canada,-300,60,3,8,0,0,-3:00,11,1,0,0,-4:00 -1416,America/Rankin_Inlet,1970,NT_YK,-360,120,4,-1,0,0,-6:00,10,-1,0,0,-5:00 -1417,America/Rankin_Inlet,1980,NT_YK,-360,60,4,-1,0,0,-4:00,10,-1,0,0,-5:00 -1418,America/Rankin_Inlet,1987,NT_YK,-360,60,4,1,0,0,-4:00,10,-1,0,0,-5:00 -1419,America/Rankin_Inlet,2000,,-300,0,0,0,0,0,,0,0,0,0, -1420,America/Rankin_Inlet,2001,Canada,-360,60,4,1,0,0,-4:00,10,-1,0,0,-5:00 -1421,America/Rankin_Inlet,2007,Canada,-360,60,3,8,0,0,-4:00,11,1,0,0,-5:00 -1422,America/Cambridge_Bay,1970,NT_YK,-420,120,4,-1,0,0,-7:00,10,-1,0,0,-6:00 -1423,America/Cambridge_Bay,1980,NT_YK,-420,60,4,-1,0,0,-5:00,10,-1,0,0,-6:00 -1424,America/Cambridge_Bay,1987,NT_YK,-420,60,4,1,0,0,-5:00,10,-1,0,0,-6:00 -1425,America/Cambridge_Bay,1999,Canada,-360,60,4,1,0,0,-4:00,10,-1,0,0,-5:00 -1426,America/Cambridge_Bay,2000,,-360,0,0,0,0,0,,0,0,0,0, -1427,America/Cambridge_Bay,2001,Canada,-420,60,4,1,0,0,-5:00,10,-1,0,0,-6:00 -1428,America/Cambridge_Bay,2007,Canada,-420,60,3,8,0,0,-5:00,11,1,0,0,-6:00 -1429,America/Yellowknife,1970,NT_YK,-420,120,4,-1,0,0,-7:00,10,-1,0,0,-6:00 -1430,America/Yellowknife,1980,Canada,-420,60,4,-1,0,0,-5:00,10,-1,0,0,-6:00 -1431,America/Yellowknife,1987,Canada,-420,60,4,1,0,0,-5:00,10,-1,0,0,-6:00 -1432,America/Yellowknife,2007,Canada,-420,60,3,8,0,0,-5:00,11,1,0,0,-6:00 -1433,America/Inuvik,1970,NT_YK,-480,120,4,-1,0,0,-8:00,10,-1,0,0,-7:00 -1434,America/Inuvik,1979,NT_YK,-420,120,4,-1,0,0,-7:00,10,-1,0,0,-6:00 -1435,America/Inuvik,1980,Canada,-420,60,4,-1,0,0,-5:00,10,-1,0,0,-6:00 -1436,America/Inuvik,1987,Canada,-420,60,4,1,0,0,-5:00,10,-1,0,0,-6:00 -1437,America/Inuvik,2007,Canada,-420,60,3,8,0,0,-5:00,11,1,0,0,-6:00 -1438,America/Whitehorse,1970,NT_YK,-480,120,4,-1,0,0,-8:00,10,-1,0,0,-7:00 -1439,America/Whitehorse,1980,Canada,-480,60,4,-1,0,0,-6:00,10,-1,0,0,-7:00 -1440,America/Whitehorse,1987,Canada,-480,60,4,1,0,0,-6:00,10,-1,0,0,-7:00 -1441,America/Whitehorse,2007,Canada,-480,60,3,8,0,0,-6:00,11,1,0,0,-7:00 -1442,America/Dawson,1970,NT_YK,-540,120,4,-1,0,0,-9:00,10,-1,0,0,-8:00 -1443,America/Dawson,1973,NT_YK,-480,120,4,-1,0,0,-8:00,10,-1,0,0,-7:00 -1444,America/Dawson,1980,Canada,-480,60,4,-1,0,0,-6:00,10,-1,0,0,-7:00 -1445,America/Dawson,1987,Canada,-480,60,4,1,0,0,-6:00,10,-1,0,0,-7:00 -1446,America/Dawson,2007,Canada,-480,60,3,8,0,0,-6:00,11,1,0,0,-7:00 -1447,America/Cancun,1970,,-360,0,0,0,0,0,,0,0,0,0, -1448,America/Cancun,1981,Mexico,-300,0,0,0,0,0,,0,0,0,0, -1449,America/Cancun,1996,Mexico,-300,60,4,1,0,0,-3:00,10,-1,0,0,-4:00 -1450,America/Cancun,1998,Mexico,-360,60,4,1,0,0,-4:00,10,-1,0,0,-5:00 -1451,America/Cancun,2001,Mexico,-360,60,5,1,0,0,-4:00,9,-1,0,0,-5:00 -1452,America/Cancun,2002,Mexico,-360,60,4,1,0,0,-4:00,10,-1,0,0,-5:00 -1453,America/Merida,1970,,-360,0,0,0,0,0,,0,0,0,0, -1454,America/Merida,1981,,-300,0,0,0,0,0,,0,0,0,0, -1455,America/Merida,1982,Mexico,-360,0,0,0,0,0,,0,0,0,0, -1456,America/Merida,1996,Mexico,-360,60,4,1,0,0,-4:00,10,-1,0,0,-5:00 -1457,America/Merida,2001,Mexico,-360,60,5,1,0,0,-4:00,9,-1,0,0,-5:00 -1458,America/Merida,2002,Mexico,-360,60,4,1,0,0,-4:00,10,-1,0,0,-5:00 -1459,America/Monterrey,1970,,-360,0,0,0,0,0,,0,0,0,0, -1460,America/Monterrey,1988,US,-360,60,4,1,0,0,-4:00,10,-1,0,0,-5:00 -1461,America/Monterrey,1989,Mexico,-360,60,4,1,0,0,-4:00,10,-1,0,0,-5:00 -1462,America/Monterrey,2001,Mexico,-360,60,5,1,0,0,-4:00,9,-1,0,0,-5:00 -1463,America/Monterrey,2002,Mexico,-360,60,4,1,0,0,-4:00,10,-1,0,0,-5:00 -1464,America/Mexico_City,1970,Mexico,-360,60,2,12,-1,0,-6:00,7,30,-1,0,-7:00 -1465,America/Mexico_City,1996,Mexico,-360,60,4,1,0,0,-4:00,10,-1,0,0,-5:00 -1466,America/Mexico_City,2001,,-360,0,0,0,0,0,,0,0,0,0, -1467,America/Mexico_City,2002,Mexico,-360,60,4,1,0,0,-4:00,10,-1,0,0,-5:00 -1468,America/Chihuahua,1970,,-360,0,0,0,0,0,,0,0,0,0, -1469,America/Chihuahua,1996,Mexico,-360,60,4,1,0,0,-4:00,10,-1,0,0,-5:00 -1470,America/Chihuahua,1998,Mexico,-420,60,4,1,0,0,-5:00,10,-1,0,0,-6:00 -1471,America/Chihuahua,2001,Mexico,-420,60,5,1,0,0,-5:00,9,-1,0,0,-6:00 -1472,America/Chihuahua,2002,Mexico,-420,60,4,1,0,0,-5:00,10,-1,0,0,-6:00 -1473,America/Hermosillo,1970,Mexico,-420,60,2,12,-1,0,-7:00,7,30,-1,0,-8:00 -1474,America/Hermosillo,1996,Mexico,-420,60,4,1,0,0,-5:00,10,-1,0,0,-6:00 -1475,America/Hermosillo,1999,,-420,0,0,0,0,0,,0,0,0,0, -1476,America/Mazatlan,1970,Mexico,-420,60,2,12,-1,0,-7:00,7,30,-1,0,-8:00 -1477,America/Mazatlan,1996,Mexico,-420,60,4,1,0,0,-5:00,10,-1,0,0,-6:00 -1478,America/Mazatlan,2001,Mexico,-420,60,5,1,0,0,-5:00,9,-1,0,0,-6:00 -1479,America/Mazatlan,2002,Mexico,-420,60,4,1,0,0,-5:00,10,-1,0,0,-6:00 -1480,America/Tijuana,1970,,-480,0,0,0,0,0,,0,0,0,0, -1481,America/Tijuana,1976,US,-480,60,4,-1,0,0,-6:00,10,-1,0,0,-7:00 -1482,America/Tijuana,1987,US,-480,60,4,1,0,0,-6:00,10,-1,0,0,-7:00 -1483,America/Tijuana,1996,Mexico,-480,60,4,1,0,0,-6:00,10,-1,0,0,-7:00 -1484,America/Tijuana,2001,US,-480,60,4,1,0,0,-6:00,10,-1,0,0,-7:00 -1485,America/Tijuana,2002,Mexico,-480,60,4,1,0,0,-6:00,10,-1,0,0,-7:00 -1486,America/Anguilla,1970,,-240,0,0,0,0,0,,0,0,0,0, -1487,America/Antigua,1970,,-240,0,0,0,0,0,,0,0,0,0, -1488,America/Nassau,1970,Bahamas,-300,60,4,-1,0,0,-3:00,10,-1,0,0,-4:00 -1489,America/Nassau,1976,US,-300,60,4,-1,0,0,-3:00,10,-1,0,0,-4:00 -1490,America/Nassau,1987,US,-300,60,4,1,0,0,-3:00,10,-1,0,0,-4:00 -1491,America/Nassau,2007,US,-300,60,3,8,0,0,-3:00,11,1,0,0,-4:00 -1492,America/Barbados,1970,Barb,-240,0,0,0,0,0,,0,0,0,0, -1493,America/Barbados,1977,Barb,-240,60,6,12,-1,0,-2:00,10,1,0,0,-3:00 -1494,America/Barbados,1978,Barb,-240,60,4,15,0,0,-2:00,10,1,0,0,-3:00 -1495,America/Barbados,1979,Barb,-240,60,4,15,0,0,-2:00,9,30,-1,0,-3:00 -1496,America/Barbados,1980,Barb,-240,60,4,15,0,0,-2:00,9,25,-1,0,-3:00 -1497,America/Barbados,1981,Barb,-240,0,4,15,0,0,-2:00,9,25,-1,0,-3:00 -1498,America/Belize,1970,Belize,-360,0,12,31,-1,0,06:00,2,9,0,0,-7:00 -1499,America/Belize,1973,Belize,-360,60,12,5,-1,0,-6:00,1,1,-1,0,05:00 -1500,America/Belize,1974,Belize,-360,0,12,31,-1,0,06:00,2,9,-1,0,-7:00 -1501,America/Belize,1982,Belize,-360,60,12,18,-1,0,-6:00,1,1,-1,0,05:00 -1502,America/Belize,1983,Belize,-360,0,12,31,-1,0,06:00,2,12,-1,0,-7:00 -1503,Atlantic/Bermuda,1970,,-240,0,0,0,0,0,,0,0,0,0, -1504,Atlantic/Bermuda,1974,Bahamas,-240,60,4,-1,0,0,-2:00,10,-1,0,0,-3:00 -1505,Atlantic/Bermuda,1976,US,-240,60,4,-1,0,0,-2:00,10,-1,0,0,-3:00 -1506,Atlantic/Bermuda,1987,US,-240,60,4,1,0,0,-2:00,10,-1,0,0,-3:00 -1507,Atlantic/Bermuda,2007,US,-240,60,3,8,0,0,-2:00,11,1,0,0,-3:00 -1508,America/Cayman,1970,,-300,0,0,0,0,0,,0,0,0,0, -1509,America/Costa_Rica,1970,CR,-360,0,0,0,0,0,,0,0,0,0, -1510,America/Costa_Rica,1979,CR,-360,60,2,-1,0,0,-6:00,6,1,0,0,-7:00 -1511,America/Costa_Rica,1991,CR,-360,60,1,15,6,0,-6:00,7,1,-1,0,-7:00 -1512,America/Costa_Rica,1992,CR,-360,60,1,15,6,0,-6:00,3,15,-1,0,-7:00 -1513,America/Costa_Rica,1993,CR,-360,0,1,15,6,0,-6:00,3,15,-1,0,-7:00 -1514,America/Havana,1970,Cuba,-300,60,4,-1,0,0,-5:00,10,-1,0,0,-6:00 -1515,America/Havana,1972,Cuba,-300,60,4,-1,0,0,-5:00,10,8,-1,0,-6:00 -1516,America/Havana,1975,Cuba,-300,60,4,-1,0,0,-5:00,10,-1,0,0,-6:00 -1517,America/Havana,1978,Cuba,-300,60,5,7,-1,0,-5:00,10,8,0,0,-6:00 -1518,America/Havana,1979,Cuba,-300,60,3,15,0,0,-5:00,10,8,0,0,-6:00 -1519,America/Havana,1981,Cuba,-300,60,5,5,0,0,-5:00,10,8,0,0,-6:00 -1520,America/Havana,1986,Cuba,-300,60,3,14,0,0,-5:00,10,8,0,0,-6:00 -1521,America/Havana,1990,Cuba,-300,60,4,1,0,0,-5:00,10,8,0,0,-6:00 -1522,America/Havana,1991,Cuba,-300,60,4,1,0,0,-5:00,10,8,0,0,-5:00 -1523,America/Havana,1996,Cuba,-300,60,4,1,0,0,-5:00,10,6,-1,0,-5:00 -1524,America/Havana,1997,Cuba,-300,60,4,1,0,0,-5:00,10,12,-1,0,-5:00 -1525,America/Havana,1998,Cuba,-300,60,3,-1,0,0,-5:00,10,-1,0,0,-5:00 -1526,America/Havana,2000,Cuba,-300,60,4,1,0,0,-5:00,10,-1,0,0,-5:00 -1527,America/Havana,2004,Cuba,-300,60,4,1,0,0,-5:00,1,1,-1,0,06:00 -1528,America/Havana,2006,Cuba,-300,60,4,1,0,0,-5:00,10,-1,0,0,-5:00 -1529,America/Dominica,1970,,-240,0,0,0,0,0,,0,0,0,0, -1530,America/Santo_Domingo,1970,DR,-300,30,10,-1,0,0,-5:00,2,21,-1,0,-6:00 -1531,America/Santo_Domingo,1971,DR,-300,30,10,-1,0,0,-5:00,1,20,-1,0,-6:00 -1532,America/Santo_Domingo,1972,DR,-300,30,10,-1,0,0,-5:00,1,21,-1,0,-6:00 -1533,America/Santo_Domingo,1974,,-240,0,0,0,0,0,,0,0,0,0, -1534,America/El_Salvador,1970,Salv,-360,0,0,0,0,0,,0,0,0,0, -1535,America/El_Salvador,1987,Salv,-360,60,5,1,0,0,-6:00,9,-1,0,0,-7:00 -1536,America/El_Salvador,1988,Salv,-360,0,5,1,0,0,-6:00,9,-1,0,0,-7:00 -1537,America/Grenada,1970,,-240,0,0,0,0,0,,0,0,0,0, -1538,America/Guadeloupe,1970,,-240,0,0,0,0,0,,0,0,0,0, -1539,America/Guatemala,1970,Guat,-360,0,0,0,0,0,,0,0,0,0, -1540,America/Guatemala,1973,Guat,-360,60,11,25,-1,0,-6:00,1,1,-1,0,05:00 -1541,America/Guatemala,1974,Guat,-360,0,12,31,-1,0,06:00,2,24,-1,0,-7:00 -1542,America/Guatemala,1983,Guat,-360,60,5,21,-1,0,-6:00,9,22,-1,0,-7:00 -1543,America/Guatemala,1991,Guat,-360,60,3,23,-1,0,-6:00,9,7,-1,0,-7:00 -1544,America/Guatemala,2006,Guat,-360,60,4,30,-1,0,-6:00,10,1,-1,0,-7:00 -1545,America/Guatemala,2007,Guat,-360,0,4,30,-1,0,-6:00,10,1,-1,0,-7:00 -1546,America/Port-au-Prince,1970,Haiti,-300,0,0,0,0,0,,0,0,0,0, -1547,America/Port-au-Prince,1983,Haiti,-300,60,5,8,-1,0,-5:00,10,-1,0,0,-6:00 -1548,America/Port-au-Prince,1984,Haiti,-300,60,4,-1,0,0,-5:00,10,-1,0,0,-6:00 -1549,America/Port-au-Prince,1988,Haiti,-300,60,4,1,0,0,-4:00,10,-1,0,0,-4:00 -1550,America/Port-au-Prince,2005,Haiti,-300,60,4,1,0,0,-5:00,10,-1,0,0,-6:00 -1551,America/Tegucigalpa,1970,Hond,-360,0,0,0,0,0,,0,0,0,0, -1552,America/Tegucigalpa,1987,Hond,-360,60,5,1,0,0,-6:00,9,-1,0,0,-7:00 -1553,America/Tegucigalpa,2006,Hond,-360,60,5,1,0,0,-6:00,8,1,1,0,-7:00 -1554,America/Tegucigalpa,2009,Hond,-360,0,5,1,0,0,-6:00,8,1,1,0,-7:00 -1555,America/Jamaica,1970,,-300,0,0,0,0,0,,0,0,0,0, -1556,America/Jamaica,1974,US,-300,60,1,6,-1,0,-3:00,10,-1,0,0,-4:00 -1557,America/Jamaica,1975,US,-300,60,2,23,-1,0,-3:00,10,-1,0,0,-4:00 -1558,America/Jamaica,1976,US,-300,60,4,-1,0,0,-3:00,10,-1,0,0,-4:00 -1559,America/Jamaica,1984,,-300,0,0,0,0,0,,0,0,0,0, -1560,America/Martinique,1970,,-240,0,0,0,0,0,,0,0,0,0, -1561,America/Martinique,1980,,-240,0,0,0,0,0,,0,0,0,0, -1562,America/Montserrat,1970,,-240,0,0,0,0,0,,0,0,0,0, -1563,America/Managua,1970,,-360,0,0,0,0,0,,0,0,0,0, -1564,America/Managua,1973,,-300,0,0,0,0,0,,0,0,0,0, -1565,America/Managua,1975,Nic,-360,0,0,0,0,0,,0,0,0,0, -1566,America/Managua,1979,Nic,-360,60,3,16,0,0,-6:00,6,23,1,0,-7:00 -1567,America/Managua,1992,,-360,0,0,0,0,0,,0,0,0,0, -1568,America/Managua,1993,,-300,0,0,0,0,0,,0,0,0,0, -1569,America/Managua,1997,Nic,-360,0,0,0,0,0,,0,0,0,0, -1570,America/Managua,2005,Nic,-360,60,4,10,-1,0,-6:00,10,1,0,0,-7:00 -1571,America/Managua,2006,Nic,-360,60,4,30,-1,0,-4:00,10,1,0,0,-6:00 -1572,America/Managua,2007,Nic,-360,0,4,30,-1,0,-4:00,10,1,0,0,-6:00 -1573,America/Panama,1970,,-300,0,0,0,0,0,,0,0,0,0, -1574,America/Puerto_Rico,1970,,-240,0,0,0,0,0,,0,0,0,0, -1575,America/St_Kitts,1970,,-240,0,0,0,0,0,,0,0,0,0, -1576,America/St_Lucia,1970,,-240,0,0,0,0,0,,0,0,0,0, -1577,America/Miquelon,1970,,-240,0,0,0,0,0,,0,0,0,0, -1578,America/Miquelon,1980,,-180,0,0,0,0,0,,0,0,0,0, -1579,America/Miquelon,1987,Canada,-180,60,4,1,0,0,-1:00,10,-1,0,0,-2:00 -1580,America/Miquelon,2007,Canada,-180,60,3,8,0,0,-1:00,11,1,0,0,-2:00 -1581,America/St_Vincent,1970,,-240,0,0,0,0,0,,0,0,0,0, -1582,America/Grand_Turk,1970,TC,-300,0,0,0,0,0,,0,0,0,0, -1583,America/Grand_Turk,1979,TC,-300,60,4,-1,0,0,-5:00,10,-1,0,0,-6:00 -1584,America/Grand_Turk,1987,TC,-300,60,4,1,0,0,-5:00,10,-1,0,0,-6:00 -1585,America/Tortola,1970,,-240,0,0,0,0,0,,0,0,0,0, -1586,America/St_Thomas,1970,,-240,0,0,0,0,0,,0,0,0,0, -1587,America/Argentina/Buenos_Aires,1970,Arg,-180,0,12,31,-1,0,09:00,4,1,0,0,-4:00 -1588,America/Argentina/Buenos_Aires,1974,Arg,-180,60,1,23,-1,0,-3:00,5,1,-1,0,-4:00 -1589,America/Argentina/Buenos_Aires,1988,Arg,-180,60,12,1,-1,0,-3:00,1,1,-1,0,08:00 -1590,America/Argentina/Buenos_Aires,1989,Arg,-180,60,10,15,0,0,-3:00,3,1,0,0,-4:00 -1591,America/Argentina/Buenos_Aires,1993,Arg,-180,0,12,31,-1,0,09:00,3,1,0,0,-4:00 -1592,America/Argentina/Buenos_Aires,1999,Arg,-240,60,10,1,0,0,-4:00,1,1,-1,0,07:00 -1593,America/Argentina/Buenos_Aires,2000,,-180,0,0,0,0,0,,0,0,0,0, -1594,America/Argentina/Cordoba,1970,Arg,-180,0,12,31,-1,0,09:00,4,1,0,0,-4:00 -1595,America/Argentina/Cordoba,1974,Arg,-180,60,1,23,-1,0,-3:00,5,1,-1,0,-4:00 -1596,America/Argentina/Cordoba,1988,Arg,-180,60,12,1,-1,0,-3:00,1,1,-1,0,08:00 -1597,America/Argentina/Cordoba,1989,Arg,-180,60,10,15,0,0,-3:00,3,1,0,0,-4:00 -1598,America/Argentina/Cordoba,1993,Arg,-180,0,12,31,-1,0,09:00,3,1,0,0,-4:00 -1599,America/Argentina/Cordoba,1999,Arg,-240,60,10,1,0,0,-4:00,1,1,-1,0,07:00 -1600,America/Argentina/Cordoba,2000,,-180,0,0,0,0,0,,0,0,0,0, -1601,America/Argentina/Tucuman,1970,Arg,-180,0,12,31,-1,0,09:00,4,1,0,0,-4:00 -1602,America/Argentina/Tucuman,1974,Arg,-180,60,1,23,-1,0,-3:00,5,1,-1,0,-4:00 -1603,America/Argentina/Tucuman,1988,Arg,-180,60,12,1,-1,0,-3:00,1,1,-1,0,08:00 -1604,America/Argentina/Tucuman,1989,Arg,-180,60,10,15,0,0,-3:00,3,1,0,0,-4:00 -1605,America/Argentina/Tucuman,1993,Arg,-180,0,12,31,-1,0,09:00,3,1,0,0,-4:00 -1606,America/Argentina/Tucuman,1999,Arg,-240,60,10,1,0,0,-4:00,1,1,-1,0,07:00 -1607,America/Argentina/Tucuman,2000,,-180,0,0,0,0,0,,0,0,0,0, -1608,America/Argentina/La_Rioja,1970,Arg,-180,0,12,31,-1,0,09:00,4,1,0,0,-4:00 -1609,America/Argentina/La_Rioja,1974,Arg,-180,60,1,23,-1,0,-3:00,5,1,-1,0,-4:00 -1610,America/Argentina/La_Rioja,1988,Arg,-180,60,12,1,-1,0,-3:00,1,1,-1,0,08:00 -1611,America/Argentina/La_Rioja,1989,Arg,-180,60,10,15,0,0,-3:00,3,1,0,0,-4:00 -1612,America/Argentina/La_Rioja,1993,Arg,-180,0,12,31,-1,0,09:00,3,1,0,0,-4:00 -1613,America/Argentina/La_Rioja,1999,Arg,-240,60,10,1,0,0,-4:00,1,1,-1,0,07:00 -1614,America/Argentina/La_Rioja,2000,,-180,0,0,0,0,0,,0,0,0,0, -1615,America/Argentina/San_Juan,1970,Arg,-180,0,12,31,-1,0,09:00,4,1,0,0,-4:00 -1616,America/Argentina/San_Juan,1974,Arg,-180,60,1,23,-1,0,-3:00,5,1,-1,0,-4:00 -1617,America/Argentina/San_Juan,1988,Arg,-180,60,12,1,-1,0,-3:00,1,1,-1,0,08:00 -1618,America/Argentina/San_Juan,1989,Arg,-180,60,10,15,0,0,-3:00,3,1,0,0,-4:00 -1619,America/Argentina/San_Juan,1993,Arg,-180,0,12,31,-1,0,09:00,3,1,0,0,-4:00 -1620,America/Argentina/San_Juan,1999,Arg,-240,60,10,1,0,0,-4:00,1,1,-1,0,07:00 -1621,America/Argentina/San_Juan,2000,,-180,0,0,0,0,0,,0,0,0,0, -1622,America/Argentina/Jujuy,1970,Arg,-180,0,12,31,-1,0,09:00,4,1,0,0,-4:00 -1623,America/Argentina/Jujuy,1974,Arg,-180,60,1,23,-1,0,-3:00,5,1,-1,0,-4:00 -1624,America/Argentina/Jujuy,1988,Arg,-180,60,12,1,-1,0,-3:00,1,1,-1,0,08:00 -1625,America/Argentina/Jujuy,1989,Arg,-180,60,10,15,0,0,-3:00,3,1,0,0,-4:00 -1626,America/Argentina/Jujuy,1990,,-240,0,0,0,0,0,,0,0,0,0, -1627,America/Argentina/Jujuy,1991,,-180,0,0,0,0,0,,0,0,0,0, -1628,America/Argentina/Jujuy,1992,Arg,-180,60,10,15,0,0,-3:00,3,1,0,0,-4:00 -1629,America/Argentina/Jujuy,1993,Arg,-180,0,12,31,-1,0,09:00,3,1,0,0,-4:00 -1630,America/Argentina/Jujuy,1999,Arg,-240,60,10,1,0,0,-4:00,1,1,-1,0,07:00 -1631,America/Argentina/Jujuy,2000,,-180,0,0,0,0,0,,0,0,0,0, -1632,America/Argentina/Catamarca,1970,Arg,-180,0,12,31,-1,0,09:00,4,1,0,0,-4:00 -1633,America/Argentina/Catamarca,1974,Arg,-180,60,1,23,-1,0,-3:00,5,1,-1,0,-4:00 -1634,America/Argentina/Catamarca,1988,Arg,-180,60,12,1,-1,0,-3:00,1,1,-1,0,08:00 -1635,America/Argentina/Catamarca,1989,Arg,-180,60,10,15,0,0,-3:00,3,1,0,0,-4:00 -1636,America/Argentina/Catamarca,1993,Arg,-180,0,12,31,-1,0,09:00,3,1,0,0,-4:00 -1637,America/Argentina/Catamarca,1999,Arg,-240,60,10,1,0,0,-4:00,1,1,-1,0,07:00 -1638,America/Argentina/Catamarca,2000,,-180,0,0,0,0,0,,0,0,0,0, -1639,America/Argentina/Mendoza,1970,Arg,-180,0,12,31,-1,0,09:00,4,1,0,0,-4:00 -1640,America/Argentina/Mendoza,1974,Arg,-180,60,1,23,-1,0,-3:00,5,1,-1,0,-4:00 -1641,America/Argentina/Mendoza,1988,Arg,-180,60,12,1,-1,0,-3:00,1,1,-1,0,08:00 -1642,America/Argentina/Mendoza,1989,Arg,-180,60,10,15,0,0,-3:00,3,1,0,0,-4:00 -1643,America/Argentina/Mendoza,1990,,-240,0,0,0,0,0,,0,0,0,0, -1644,America/Argentina/Mendoza,1992,Arg,-180,60,10,15,0,0,-3:00,3,1,0,0,-4:00 -1645,America/Argentina/Mendoza,1993,Arg,-180,0,12,31,-1,0,09:00,3,1,0,0,-4:00 -1646,America/Argentina/Mendoza,1999,Arg,-240,60,10,1,0,0,-4:00,1,1,-1,0,07:00 -1647,America/Argentina/Mendoza,2000,,-180,0,0,0,0,0,,0,0,0,0, -1648,America/Argentina/Rio_Gallegos,1970,Arg,-180,0,12,31,-1,0,09:00,4,1,0,0,-4:00 -1649,America/Argentina/Rio_Gallegos,1974,Arg,-180,60,1,23,-1,0,-3:00,5,1,-1,0,-4:00 -1650,America/Argentina/Rio_Gallegos,1988,Arg,-180,60,12,1,-1,0,-3:00,1,1,-1,0,08:00 -1651,America/Argentina/Rio_Gallegos,1989,Arg,-180,60,10,15,0,0,-3:00,3,1,0,0,-4:00 -1652,America/Argentina/Rio_Gallegos,1993,Arg,-180,0,12,31,-1,0,09:00,3,1,0,0,-4:00 -1653,America/Argentina/Rio_Gallegos,1999,Arg,-240,60,10,1,0,0,-4:00,1,1,-1,0,07:00 -1654,America/Argentina/Rio_Gallegos,2000,,-180,0,0,0,0,0,,0,0,0,0, -1655,America/Argentina/Ushuaia,1970,Arg,-180,0,12,31,-1,0,09:00,4,1,0,0,-4:00 -1656,America/Argentina/Ushuaia,1974,Arg,-180,60,1,23,-1,0,-3:00,5,1,-1,0,-4:00 -1657,America/Argentina/Ushuaia,1988,Arg,-180,60,12,1,-1,0,-3:00,1,1,-1,0,08:00 -1658,America/Argentina/Ushuaia,1989,Arg,-180,60,10,15,0,0,-3:00,3,1,0,0,-4:00 -1659,America/Argentina/Ushuaia,1993,Arg,-180,0,12,31,-1,0,09:00,3,1,0,0,-4:00 -1660,America/Argentina/Ushuaia,1999,Arg,-240,60,10,1,0,0,-4:00,1,1,-1,0,07:00 -1661,America/Argentina/Ushuaia,2000,,-180,0,0,0,0,0,,0,0,0,0, -1662,America/Aruba,1970,,-240,0,0,0,0,0,,0,0,0,0, -1663,America/La_Paz,1970,,-240,0,0,0,0,0,,0,0,0,0, -1664,America/Noronha,1970,Brazil,-120,0,12,31,-1,0,10:00,3,1,-1,0,-3:00 -1665,America/Noronha,1985,Brazil,-120,60,11,2,-1,0,-2:00,1,1,-1,0,09:00 -1666,America/Noronha,1986,Brazil,-120,60,10,25,-1,0,-2:00,3,15,-1,0,-3:00 -1667,America/Noronha,1987,Brazil,-120,60,10,25,-1,0,-2:00,2,14,-1,0,-3:00 -1668,America/Noronha,1988,Brazil,-120,60,10,16,-1,0,-2:00,2,7,-1,0,-3:00 -1669,America/Noronha,1989,Brazil,-120,60,10,15,-1,0,-2:00,1,29,-1,0,-3:00 -1670,America/Noronha,1990,,-120,0,0,0,0,0,,0,0,0,0, -1671,America/Noronha,1999,Brazil,-120,60,10,3,-1,0,-2:00,2,21,-1,0,-3:00 -1672,America/Noronha,2000,,-120,0,0,0,0,0,,0,0,0,0, -1673,America/Noronha,2001,Brazil,-120,60,10,8,0,0,-2:00,2,15,0,0,-3:00 -1674,America/Noronha,2002,,-120,0,0,0,0,0,,0,0,0,0, -1675,America/Belem,1970,Brazil,-180,0,12,31,-1,0,09:00,3,1,-1,0,-4:00 -1676,America/Belem,1985,Brazil,-180,60,11,2,-1,0,-3:00,1,1,-1,0,08:00 -1677,America/Belem,1986,Brazil,-180,60,10,25,-1,0,-3:00,3,15,-1,0,-4:00 -1678,America/Belem,1987,Brazil,-180,60,10,25,-1,0,-3:00,2,14,-1,0,-4:00 -1679,America/Belem,1988,,-180,0,0,0,0,0,,0,0,0,0, -1680,America/Fortaleza,1970,Brazil,-180,0,12,31,-1,0,09:00,3,1,-1,0,-4:00 -1681,America/Fortaleza,1985,Brazil,-180,60,11,2,-1,0,-3:00,1,1,-1,0,08:00 -1682,America/Fortaleza,1986,Brazil,-180,60,10,25,-1,0,-3:00,3,15,-1,0,-4:00 -1683,America/Fortaleza,1987,Brazil,-180,60,10,25,-1,0,-3:00,2,14,-1,0,-4:00 -1684,America/Fortaleza,1988,Brazil,-180,60,10,16,-1,0,-3:00,2,7,-1,0,-4:00 -1685,America/Fortaleza,1989,Brazil,-180,60,10,15,-1,0,-3:00,1,29,-1,0,-4:00 -1686,America/Fortaleza,1990,,-180,0,0,0,0,0,,0,0,0,0, -1687,America/Fortaleza,1999,Brazil,-180,60,10,3,-1,0,-3:00,2,21,-1,0,-4:00 -1688,America/Fortaleza,2000,,-180,0,0,0,0,0,,0,0,0,0, -1689,America/Fortaleza,2001,Brazil,-180,60,10,8,0,0,-3:00,2,15,0,0,-4:00 -1690,America/Fortaleza,2002,,-180,0,0,0,0,0,,0,0,0,0, -1691,America/Recife,1970,Brazil,-180,0,12,31,-1,0,09:00,3,1,-1,0,-4:00 -1692,America/Recife,1985,Brazil,-180,60,11,2,-1,0,-3:00,1,1,-1,0,08:00 -1693,America/Recife,1986,Brazil,-180,60,10,25,-1,0,-3:00,3,15,-1,0,-4:00 -1694,America/Recife,1987,Brazil,-180,60,10,25,-1,0,-3:00,2,14,-1,0,-4:00 -1695,America/Recife,1988,Brazil,-180,60,10,16,-1,0,-3:00,2,7,-1,0,-4:00 -1696,America/Recife,1989,Brazil,-180,60,10,15,-1,0,-3:00,1,29,-1,0,-4:00 -1697,America/Recife,1990,,-180,0,0,0,0,0,,0,0,0,0, -1698,America/Recife,1999,Brazil,-180,60,10,3,-1,0,-3:00,2,21,-1,0,-4:00 -1699,America/Recife,2000,,-180,0,0,0,0,0,,0,0,0,0, -1700,America/Recife,2001,Brazil,-180,60,10,8,0,0,-3:00,2,15,0,0,-4:00 -1701,America/Recife,2002,,-180,0,0,0,0,0,,0,0,0,0, -1702,America/Araguaina,1970,Brazil,-180,0,12,31,-1,0,09:00,3,1,-1,0,-4:00 -1703,America/Araguaina,1985,Brazil,-180,60,11,2,-1,0,-3:00,1,1,-1,0,08:00 -1704,America/Araguaina,1986,Brazil,-180,60,10,25,-1,0,-3:00,3,15,-1,0,-4:00 -1705,America/Araguaina,1987,Brazil,-180,60,10,25,-1,0,-3:00,2,14,-1,0,-4:00 -1706,America/Araguaina,1988,Brazil,-180,60,10,16,-1,0,-3:00,2,7,-1,0,-4:00 -1707,America/Araguaina,1989,Brazil,-180,60,10,15,-1,0,-3:00,1,29,-1,0,-4:00 -1708,America/Araguaina,1990,,-180,0,0,0,0,0,,0,0,0,0, -1709,America/Araguaina,1995,Brazil,-180,60,10,11,0,0,-3:00,2,15,0,0,-4:00 -1710,America/Araguaina,1996,Brazil,-180,60,10,6,-1,0,-3:00,2,11,-1,0,-4:00 -1711,America/Araguaina,1997,Brazil,-180,60,10,6,-1,0,-3:00,2,16,-1,0,-4:00 -1712,America/Araguaina,1998,Brazil,-180,60,10,11,-1,0,-3:00,3,1,-1,0,-4:00 -1713,America/Araguaina,1999,Brazil,-180,60,10,3,-1,0,-3:00,2,21,-1,0,-4:00 -1714,America/Araguaina,2000,Brazil,-180,60,10,8,0,0,-3:00,2,27,-1,0,-4:00 -1715,America/Araguaina,2001,Brazil,-180,60,10,8,0,0,-3:00,2,15,0,0,-4:00 -1716,America/Araguaina,2002,Brazil,-180,60,11,3,-1,0,-3:00,2,15,0,0,-4:00 -1717,America/Araguaina,2003,,-180,0,0,0,0,0,,0,0,0,0, -1718,America/Maceio,1970,Brazil,-180,0,12,31,-1,0,09:00,3,1,-1,0,-4:00 -1719,America/Maceio,1985,Brazil,-180,60,11,2,-1,0,-3:00,1,1,-1,0,08:00 -1720,America/Maceio,1986,Brazil,-180,60,10,25,-1,0,-3:00,3,15,-1,0,-4:00 -1721,America/Maceio,1987,Brazil,-180,60,10,25,-1,0,-3:00,2,14,-1,0,-4:00 -1722,America/Maceio,1988,Brazil,-180,60,10,16,-1,0,-3:00,2,7,-1,0,-4:00 -1723,America/Maceio,1989,Brazil,-180,60,10,15,-1,0,-3:00,1,29,-1,0,-4:00 -1724,America/Maceio,1990,,-180,0,0,0,0,0,,0,0,0,0, -1725,America/Maceio,1995,Brazil,-180,60,10,11,0,0,-3:00,2,15,0,0,-4:00 -1726,America/Maceio,1996,,-180,0,0,0,0,0,,0,0,0,0, -1727,America/Maceio,1999,Brazil,-180,60,10,3,-1,0,-3:00,2,21,-1,0,-4:00 -1728,America/Maceio,2000,,-180,0,0,0,0,0,,0,0,0,0, -1729,America/Maceio,2001,Brazil,-180,60,10,8,0,0,-3:00,2,15,0,0,-4:00 -1730,America/Maceio,2002,,-180,0,0,0,0,0,,0,0,0,0, -1731,America/Bahia,1970,Brazil,-180,0,12,31,-1,0,09:00,3,1,-1,0,-4:00 -1732,America/Bahia,1985,Brazil,-180,60,11,2,-1,0,-3:00,1,1,-1,0,08:00 -1733,America/Bahia,1986,Brazil,-180,60,10,25,-1,0,-3:00,3,15,-1,0,-4:00 -1734,America/Bahia,1987,Brazil,-180,60,10,25,-1,0,-3:00,2,14,-1,0,-4:00 -1735,America/Bahia,1988,Brazil,-180,60,10,16,-1,0,-3:00,2,7,-1,0,-4:00 -1736,America/Bahia,1989,Brazil,-180,60,10,15,-1,0,-3:00,1,29,-1,0,-4:00 -1737,America/Bahia,1990,Brazil,-180,60,10,21,-1,0,-3:00,2,11,-1,0,-4:00 -1738,America/Bahia,1991,Brazil,-180,60,10,20,-1,0,-3:00,2,17,-1,0,-4:00 -1739,America/Bahia,1992,Brazil,-180,60,10,25,-1,0,-3:00,2,9,-1,0,-4:00 -1740,America/Bahia,1993,Brazil,-180,60,10,11,0,0,-3:00,1,31,-1,0,-4:00 -1741,America/Bahia,1994,Brazil,-180,60,10,11,0,0,-3:00,2,15,0,0,-4:00 -1742,America/Bahia,1996,Brazil,-180,60,10,6,-1,0,-3:00,2,11,-1,0,-4:00 -1743,America/Bahia,1997,Brazil,-180,60,10,6,-1,0,-3:00,2,16,-1,0,-4:00 -1744,America/Bahia,1998,Brazil,-180,60,10,11,-1,0,-3:00,3,1,-1,0,-4:00 -1745,America/Bahia,1999,Brazil,-180,60,10,3,-1,0,-3:00,2,21,-1,0,-4:00 -1746,America/Bahia,2000,Brazil,-180,60,10,8,0,0,-3:00,2,27,-1,0,-4:00 -1747,America/Bahia,2001,Brazil,-180,60,10,8,0,0,-3:00,2,15,0,0,-4:00 -1748,America/Bahia,2002,Brazil,-180,60,11,3,-1,0,-3:00,2,15,0,0,-4:00 -1749,America/Bahia,2003,,-180,0,0,0,0,0,,0,0,0,0, -1750,America/Sao_Paulo,1970,Brazil,-180,0,12,31,-1,0,09:00,3,1,-1,0,-4:00 -1751,America/Sao_Paulo,1985,Brazil,-180,60,11,2,-1,0,-3:00,1,1,-1,0,08:00 -1752,America/Sao_Paulo,1986,Brazil,-180,60,10,25,-1,0,-3:00,3,15,-1,0,-4:00 -1753,America/Sao_Paulo,1987,Brazil,-180,60,10,25,-1,0,-3:00,2,14,-1,0,-4:00 -1754,America/Sao_Paulo,1988,Brazil,-180,60,10,16,-1,0,-3:00,2,7,-1,0,-4:00 -1755,America/Sao_Paulo,1989,Brazil,-180,60,10,15,-1,0,-3:00,1,29,-1,0,-4:00 -1756,America/Sao_Paulo,1990,Brazil,-180,60,10,21,-1,0,-3:00,2,11,-1,0,-4:00 -1757,America/Sao_Paulo,1991,Brazil,-180,60,10,20,-1,0,-3:00,2,17,-1,0,-4:00 -1758,America/Sao_Paulo,1992,Brazil,-180,60,10,25,-1,0,-3:00,2,9,-1,0,-4:00 -1759,America/Sao_Paulo,1993,Brazil,-180,60,10,11,0,0,-3:00,1,31,-1,0,-4:00 -1760,America/Sao_Paulo,1994,Brazil,-180,60,10,11,0,0,-3:00,2,15,0,0,-4:00 -1761,America/Sao_Paulo,1996,Brazil,-180,60,10,6,-1,0,-3:00,2,11,-1,0,-4:00 -1762,America/Sao_Paulo,1997,Brazil,-180,60,10,6,-1,0,-3:00,2,16,-1,0,-4:00 -1763,America/Sao_Paulo,1998,Brazil,-180,60,10,11,-1,0,-3:00,3,1,-1,0,-4:00 -1764,America/Sao_Paulo,1999,Brazil,-180,60,10,3,-1,0,-3:00,2,21,-1,0,-4:00 -1765,America/Sao_Paulo,2000,Brazil,-180,60,10,8,0,0,-3:00,2,27,-1,0,-4:00 -1766,America/Sao_Paulo,2001,Brazil,-180,60,10,8,0,0,-3:00,2,15,0,0,-4:00 -1767,America/Sao_Paulo,2002,Brazil,-180,60,11,3,-1,0,-3:00,2,15,0,0,-4:00 -1768,America/Sao_Paulo,2003,Brazil,-180,60,10,19,-1,0,-3:00,2,15,0,0,-4:00 -1769,America/Sao_Paulo,2004,Brazil,-180,60,11,2,-1,0,-3:00,2,15,0,0,-4:00 -1770,America/Sao_Paulo,2005,Brazil,-180,60,10,16,-1,0,-3:00,2,15,0,0,-4:00 -1771,America/Sao_Paulo,2006,Brazil,-180,60,11,1,0,0,-3:00,2,15,0,0,-4:00 -1772,America/Sao_Paulo,2007,Brazil,-180,60,11,1,0,0,-3:00,2,-1,0,0,-4:00 -1773,America/Campo_Grande,1970,Brazil,-240,0,12,31,-1,0,08:00,3,1,-1,0,-5:00 -1774,America/Campo_Grande,1985,Brazil,-240,60,11,2,-1,0,-4:00,1,1,-1,0,07:00 -1775,America/Campo_Grande,1986,Brazil,-240,60,10,25,-1,0,-4:00,3,15,-1,0,-5:00 -1776,America/Campo_Grande,1987,Brazil,-240,60,10,25,-1,0,-4:00,2,14,-1,0,-5:00 -1777,America/Campo_Grande,1988,Brazil,-240,60,10,16,-1,0,-4:00,2,7,-1,0,-5:00 -1778,America/Campo_Grande,1989,Brazil,-240,60,10,15,-1,0,-4:00,1,29,-1,0,-5:00 -1779,America/Campo_Grande,1990,Brazil,-240,60,10,21,-1,0,-4:00,2,11,-1,0,-5:00 -1780,America/Campo_Grande,1991,Brazil,-240,60,10,20,-1,0,-4:00,2,17,-1,0,-5:00 -1781,America/Campo_Grande,1992,Brazil,-240,60,10,25,-1,0,-4:00,2,9,-1,0,-5:00 -1782,America/Campo_Grande,1993,Brazil,-240,60,10,11,0,0,-4:00,1,31,-1,0,-5:00 -1783,America/Campo_Grande,1994,Brazil,-240,60,10,11,0,0,-4:00,2,15,0,0,-5:00 -1784,America/Campo_Grande,1996,Brazil,-240,60,10,6,-1,0,-4:00,2,11,-1,0,-5:00 -1785,America/Campo_Grande,1997,Brazil,-240,60,10,6,-1,0,-4:00,2,16,-1,0,-5:00 -1786,America/Campo_Grande,1998,Brazil,-240,60,10,11,-1,0,-4:00,3,1,-1,0,-5:00 -1787,America/Campo_Grande,1999,Brazil,-240,60,10,3,-1,0,-4:00,2,21,-1,0,-5:00 -1788,America/Campo_Grande,2000,Brazil,-240,60,10,8,0,0,-4:00,2,27,-1,0,-5:00 -1789,America/Campo_Grande,2001,Brazil,-240,60,10,8,0,0,-4:00,2,15,0,0,-5:00 -1790,America/Campo_Grande,2002,Brazil,-240,60,11,3,-1,0,-4:00,2,15,0,0,-5:00 -1791,America/Campo_Grande,2003,Brazil,-240,60,10,19,-1,0,-4:00,2,15,0,0,-5:00 -1792,America/Campo_Grande,2004,Brazil,-240,60,11,2,-1,0,-4:00,2,15,0,0,-5:00 -1793,America/Campo_Grande,2005,Brazil,-240,60,10,16,-1,0,-4:00,2,15,0,0,-5:00 -1794,America/Campo_Grande,2006,Brazil,-240,60,11,1,0,0,-4:00,2,15,0,0,-5:00 -1795,America/Campo_Grande,2007,Brazil,-240,60,11,1,0,0,-4:00,2,-1,0,0,-5:00 -1796,America/Cuiaba,1970,Brazil,-240,0,12,31,-1,0,08:00,3,1,-1,0,-5:00 -1797,America/Cuiaba,1985,Brazil,-240,60,11,2,-1,0,-4:00,1,1,-1,0,07:00 -1798,America/Cuiaba,1986,Brazil,-240,60,10,25,-1,0,-4:00,3,15,-1,0,-5:00 -1799,America/Cuiaba,1987,Brazil,-240,60,10,25,-1,0,-4:00,2,14,-1,0,-5:00 -1800,America/Cuiaba,1988,Brazil,-240,60,10,16,-1,0,-4:00,2,7,-1,0,-5:00 -1801,America/Cuiaba,1989,Brazil,-240,60,10,15,-1,0,-4:00,1,29,-1,0,-5:00 -1802,America/Cuiaba,1990,Brazil,-240,60,10,21,-1,0,-4:00,2,11,-1,0,-5:00 -1803,America/Cuiaba,1991,Brazil,-240,60,10,20,-1,0,-4:00,2,17,-1,0,-5:00 -1804,America/Cuiaba,1992,Brazil,-240,60,10,25,-1,0,-4:00,2,9,-1,0,-5:00 -1805,America/Cuiaba,1993,Brazil,-240,60,10,11,0,0,-4:00,1,31,-1,0,-5:00 -1806,America/Cuiaba,1994,Brazil,-240,60,10,11,0,0,-4:00,2,15,0,0,-5:00 -1807,America/Cuiaba,1996,Brazil,-240,60,10,6,-1,0,-4:00,2,11,-1,0,-5:00 -1808,America/Cuiaba,1997,Brazil,-240,60,10,6,-1,0,-4:00,2,16,-1,0,-5:00 -1809,America/Cuiaba,1998,Brazil,-240,60,10,11,-1,0,-4:00,3,1,-1,0,-5:00 -1810,America/Cuiaba,1999,Brazil,-240,60,10,3,-1,0,-4:00,2,21,-1,0,-5:00 -1811,America/Cuiaba,2000,Brazil,-240,60,10,8,0,0,-4:00,2,27,-1,0,-5:00 -1812,America/Cuiaba,2001,Brazil,-240,60,10,8,0,0,-4:00,2,15,0,0,-5:00 -1813,America/Cuiaba,2002,Brazil,-240,60,11,3,-1,0,-4:00,2,15,0,0,-5:00 -1814,America/Cuiaba,2003,,-240,0,0,0,0,0,,0,0,0,0, -1815,America/Cuiaba,2004,Brazil,-240,60,11,2,-1,0,-4:00,2,15,0,0,-5:00 -1816,America/Cuiaba,2005,Brazil,-240,60,10,16,-1,0,-4:00,2,15,0,0,-5:00 -1817,America/Cuiaba,2006,Brazil,-240,60,11,1,0,0,-4:00,2,15,0,0,-5:00 -1818,America/Cuiaba,2007,Brazil,-240,60,11,1,0,0,-4:00,2,-1,0,0,-5:00 -1819,America/Porto_Velho,1970,Brazil,-240,0,12,31,-1,0,08:00,3,1,-1,0,-5:00 -1820,America/Porto_Velho,1985,Brazil,-240,60,11,2,-1,0,-4:00,1,1,-1,0,07:00 -1821,America/Porto_Velho,1986,Brazil,-240,60,10,25,-1,0,-4:00,3,15,-1,0,-5:00 -1822,America/Porto_Velho,1987,Brazil,-240,60,10,25,-1,0,-4:00,2,14,-1,0,-5:00 -1823,America/Porto_Velho,1988,,-240,0,0,0,0,0,,0,0,0,0, -1824,America/Boa_Vista,1970,Brazil,-240,0,12,31,-1,0,08:00,3,1,-1,0,-5:00 -1825,America/Boa_Vista,1985,Brazil,-240,60,11,2,-1,0,-4:00,1,1,-1,0,07:00 -1826,America/Boa_Vista,1986,Brazil,-240,60,10,25,-1,0,-4:00,3,15,-1,0,-5:00 -1827,America/Boa_Vista,1987,Brazil,-240,60,10,25,-1,0,-4:00,2,14,-1,0,-5:00 -1828,America/Boa_Vista,1988,,-240,0,0,0,0,0,,0,0,0,0, -1829,America/Boa_Vista,1999,Brazil,-240,60,10,3,-1,0,-4:00,2,21,-1,0,-5:00 -1830,America/Boa_Vista,2000,,-240,0,0,0,0,0,,0,0,0,0, -1831,America/Manaus,1970,Brazil,-240,0,12,31,-1,0,08:00,3,1,-1,0,-5:00 -1832,America/Manaus,1985,Brazil,-240,60,11,2,-1,0,-4:00,1,1,-1,0,07:00 -1833,America/Manaus,1986,Brazil,-240,60,10,25,-1,0,-4:00,3,15,-1,0,-5:00 -1834,America/Manaus,1987,Brazil,-240,60,10,25,-1,0,-4:00,2,14,-1,0,-5:00 -1835,America/Manaus,1988,,-240,0,0,0,0,0,,0,0,0,0, -1836,America/Manaus,1993,Brazil,-240,60,10,11,0,0,-4:00,1,31,-1,0,-5:00 -1837,America/Manaus,1994,,-240,0,0,0,0,0,,0,0,0,0, -1838,America/Eirunepe,1970,Brazil,-300,0,12,31,-1,0,07:00,3,1,-1,0,-6:00 -1839,America/Eirunepe,1985,Brazil,-300,60,11,2,-1,0,-5:00,1,1,-1,0,06:00 -1840,America/Eirunepe,1986,Brazil,-300,60,10,25,-1,0,-5:00,3,15,-1,0,-6:00 -1841,America/Eirunepe,1987,Brazil,-300,60,10,25,-1,0,-5:00,2,14,-1,0,-6:00 -1842,America/Eirunepe,1988,,-300,0,0,0,0,0,,0,0,0,0, -1843,America/Eirunepe,1993,Brazil,-300,60,10,11,0,0,-5:00,1,31,-1,0,-6:00 -1844,America/Eirunepe,1994,,-300,0,0,0,0,0,,0,0,0,0, -1845,America/Rio_Branco,1970,Brazil,-300,0,12,31,-1,0,07:00,3,1,-1,0,-6:00 -1846,America/Rio_Branco,1985,Brazil,-300,60,11,2,-1,0,-5:00,1,1,-1,0,06:00 -1847,America/Rio_Branco,1986,Brazil,-300,60,10,25,-1,0,-5:00,3,15,-1,0,-6:00 -1848,America/Rio_Branco,1987,Brazil,-300,60,10,25,-1,0,-5:00,2,14,-1,0,-6:00 -1849,America/Rio_Branco,1988,,-300,0,0,0,0,0,,0,0,0,0, -1850,America/Santiago,1970,Chile,-240,60,10,9,0,0,4:00,3,29,-1,0,3:00 -1851,America/Santiago,1971,Chile,-240,60,10,9,0,0,4:00,3,14,-1,0,3:00 -1852,America/Santiago,1972,Chile,-240,60,10,9,0,0,4:00,3,9,0,0,3:00 -1853,America/Santiago,1973,Chile,-240,60,9,30,-1,0,4:00,3,9,0,0,3:00 -1854,America/Santiago,1974,Chile,-240,60,10,9,0,0,4:00,3,9,0,0,3:00 -1855,America/Santiago,1987,Chile,-240,60,10,9,0,0,4:00,4,12,-1,0,3:00 -1856,America/Santiago,1988,Chile,-240,60,10,1,0,0,4:00,3,9,0,0,3:00 -1857,America/Santiago,1989,Chile,-240,60,10,9,0,0,4:00,3,9,0,0,3:00 -1858,America/Santiago,1990,Chile,-240,60,9,16,-1,0,4:00,3,18,-1,0,3:00 -1859,America/Santiago,1991,Chile,-240,60,10,9,0,0,4:00,3,9,0,0,3:00 -1860,America/Santiago,1997,Chile,-240,60,10,9,0,0,4:00,3,30,-1,0,3:00 -1861,America/Santiago,1998,Chile,-240,60,9,27,-1,0,4:00,3,9,0,0,3:00 -1862,America/Santiago,1999,Chile,-240,60,10,9,0,0,4:00,4,4,-1,0,3:00 -1863,America/Santiago,2000,Chile,-240,60,10,9,0,0,4:00,3,9,0,0,3:00 -1864,Pacific/Easter,1970,Chile,-420,60,10,9,0,0,4:00,3,29,-1,0,3:00 -1865,Pacific/Easter,1971,Chile,-420,60,10,9,0,0,4:00,3,14,-1,0,3:00 -1866,Pacific/Easter,1972,Chile,-420,60,10,9,0,0,4:00,3,9,0,0,3:00 -1867,Pacific/Easter,1973,Chile,-420,60,9,30,-1,0,4:00,3,9,0,0,3:00 -1868,Pacific/Easter,1974,Chile,-420,60,10,9,0,0,4:00,3,9,0,0,3:00 -1869,Pacific/Easter,1982,Chile,-360,60,10,9,0,0,4:00,3,9,0,0,3:00 -1870,Pacific/Easter,1987,Chile,-360,60,10,9,0,0,4:00,4,12,-1,0,3:00 -1871,Pacific/Easter,1988,Chile,-360,60,10,1,0,0,4:00,3,9,0,0,3:00 -1872,Pacific/Easter,1989,Chile,-360,60,10,9,0,0,4:00,3,9,0,0,3:00 -1873,Pacific/Easter,1990,Chile,-360,60,9,16,-1,0,4:00,3,18,-1,0,3:00 -1874,Pacific/Easter,1991,Chile,-360,60,10,9,0,0,4:00,3,9,0,0,3:00 -1875,Pacific/Easter,1997,Chile,-360,60,10,9,0,0,4:00,3,30,-1,0,3:00 -1876,Pacific/Easter,1998,Chile,-360,60,9,27,-1,0,4:00,3,9,0,0,3:00 -1877,Pacific/Easter,1999,Chile,-360,60,10,9,0,0,4:00,4,4,-1,0,3:00 -1878,Pacific/Easter,2000,Chile,-360,60,10,9,0,0,4:00,3,9,0,0,3:00 -1879,America/Bogota,1970,CO,-300,0,0,0,0,0,,0,0,0,0, -1880,America/Bogota,1992,CO,-300,60,5,3,-1,0,-5:00,1,1,-1,0,06:00 -1881,America/Bogota,1993,CO,-300,0,12,31,-1,0,07:00,4,4,-1,0,-6:00 -1882,America/Curacao,1970,,-240,0,0,0,0,0,,0,0,0,0, -1883,America/Guayaquil,1970,,-300,0,0,0,0,0,,0,0,0,0, -1884,Pacific/Galapagos,1970,,-300,0,0,0,0,0,,0,0,0,0, -1885,Pacific/Galapagos,1986,,-360,0,0,0,0,0,,0,0,0,0, -1886,Atlantic/Stanley,1970,Falk,-240,0,12,31,-1,0,08:00,1,1,-1,0,-5:00 -1887,Atlantic/Stanley,1983,Falk,-180,60,9,-1,0,0,-3:00,1,1,-1,0,08:00 -1888,Atlantic/Stanley,1984,Falk,-180,60,9,16,-1,0,-3:00,4,-1,0,0,-4:00 -1889,Atlantic/Stanley,1985,Falk,-240,60,9,9,0,0,-4:00,4,-1,0,0,-5:00 -1890,Atlantic/Stanley,1986,Falk,-240,60,9,9,0,0,-4:00,4,16,0,0,-5:00 -1891,Atlantic/Stanley,2001,Falk,-240,60,9,1,0,0,-2:00,4,15,0,0,-3:00 -1892,America/Cayenne,1970,,-180,0,0,0,0,0,,0,0,0,0, -1893,America/Guyana,1970,,-225,0,0,0,0,0,,0,0,0,0, -1894,America/Guyana,1975,,-180,0,0,0,0,0,,0,0,0,0, -1895,America/Guyana,1991,,-240,0,0,0,0,0,,0,0,0,0, -1896,America/Asuncion,1970,,-240,0,0,0,0,0,,0,0,0,0, -1897,America/Asuncion,1972,,-180,0,0,0,0,0,,0,0,0,0, -1898,America/Asuncion,1974,Para,-240,0,0,0,0,0,,0,0,0,0, -1899,America/Asuncion,1975,Para,-240,60,10,1,-1,0,-4:00,3,1,-1,0,-5:00 -1900,America/Asuncion,1979,Para,-240,60,10,1,-1,0,-4:00,4,1,-1,0,-5:00 -1901,America/Asuncion,1989,Para,-240,60,10,22,-1,0,-4:00,4,1,-1,0,-5:00 -1902,America/Asuncion,1990,Para,-240,60,10,1,-1,0,-4:00,4,1,-1,0,-5:00 -1903,America/Asuncion,1991,Para,-240,60,10,6,-1,0,-4:00,4,1,-1,0,-5:00 -1904,America/Asuncion,1992,Para,-240,60,10,5,-1,0,-4:00,3,1,-1,0,-5:00 -1905,America/Asuncion,1993,Para,-240,60,10,1,-1,0,-4:00,3,31,-1,0,-5:00 -1906,America/Asuncion,1994,Para,-240,60,10,1,-1,0,-4:00,2,-1,0,0,-5:00 -1907,America/Asuncion,1996,Para,-240,60,10,1,0,0,-4:00,3,1,-1,0,-5:00 -1908,America/Asuncion,1997,Para,-240,60,10,1,0,0,-4:00,2,-1,0,0,-5:00 -1909,America/Asuncion,1998,Para,-240,60,10,1,0,0,-4:00,3,1,0,0,-5:00 -1910,America/Asuncion,2002,Para,-240,60,9,1,0,0,-4:00,4,1,0,0,-5:00 -1911,America/Asuncion,2004,Para,-240,60,10,15,0,0,-4:00,4,1,0,0,-5:00 -1912,America/Asuncion,2005,Para,-240,60,10,15,0,0,-4:00,3,8,0,0,-5:00 -1913,America/Lima,1970,Peru,-300,0,12,31,-1,0,07:00,3,24,0,0,-6:00 -1914,America/Lima,1986,Peru,-300,60,1,1,-1,0,-5:00,4,1,-1,0,-6:00 -1915,America/Lima,1995,Peru,-300,0,1,1,-1,0,-5:00,4,1,-1,0,-6:00 -1916,Atlantic/South_Georgia,1970,,-120,0,0,0,0,0,,0,0,0,0, -1917,America/Paramaribo,1970,,-210,0,0,0,0,0,,0,0,0,0, -1918,America/Paramaribo,1975,,-210,0,0,0,0,0,,0,0,0,0, -1919,America/Paramaribo,1984,,-180,0,0,0,0,0,,0,0,0,0, -1920,America/Port_of_Spain,1970,,-240,0,0,0,0,0,,0,0,0,0, -1921,America/Montevideo,1970,Uruguay,-180,30,5,27,-1,0,-3:00,12,2,-1,0,-4:00 -1922,America/Montevideo,1972,Uruguay,-180,60,4,24,-1,0,-3:00,8,15,-1,0,-4:00 -1923,America/Montevideo,1974,Uruguay,-180,60,12,22,-1,0,-3:00,1,1,-1,0,08:00 -1924,America/Montevideo,1976,Uruguay,-180,0,12,31,-1,0,09:00,10,1,-1,0,-4:00 -1925,America/Montevideo,1977,Uruguay,-180,60,12,4,-1,0,-3:00,1,1,-1,0,08:00 -1926,America/Montevideo,1978,Uruguay,-180,0,12,31,-1,0,09:00,4,1,-1,0,-4:00 -1927,America/Montevideo,1979,Uruguay,-180,60,10,1,-1,0,-3:00,1,1,-1,0,08:00 -1928,America/Montevideo,1980,Uruguay,-180,0,12,31,-1,0,09:00,5,1,-1,0,-4:00 -1929,America/Montevideo,1987,Uruguay,-180,60,12,14,-1,0,-3:00,1,1,-1,0,08:00 -1930,America/Montevideo,1988,Uruguay,-180,60,12,11,-1,0,-3:00,3,14,-1,0,-4:00 -1931,America/Montevideo,1989,Uruguay,-180,60,10,29,-1,0,-3:00,3,12,-1,0,-4:00 -1932,America/Montevideo,1990,Uruguay,-180,60,10,21,0,0,-3:00,3,1,0,0,-4:00 -1933,America/Montevideo,1992,Uruguay,-180,60,10,18,-1,0,-3:00,3,1,0,0,-4:00 -1934,America/Montevideo,1993,Uruguay,-180,0,12,31,-1,0,09:00,2,28,-1,0,-4:00 -1935,America/Montevideo,2004,Uruguay,-180,60,9,19,-1,0,-3:00,1,1,-1,0,08:00 -1936,America/Montevideo,2005,Uruguay,-180,60,10,9,-1,0,-1:00,3,27,-1,0,-2:00 -1937,America/Montevideo,2006,Uruguay,-180,60,10,1,0,0,-1:00,3,12,-1,0,-2:00 -1938,America/Montevideo,2007,Uruguay,-180,60,10,1,0,0,-1:00,3,8,0,0,-2:00 -1939,America/Caracas,1970,,-240,0,0,0,0,0,,0,0,0,0, diff --git a/lib/yui/button/assets/background.png b/lib/yui/button/assets/background.png deleted file mode 100755 index 32a72e491aade..0000000000000 Binary files a/lib/yui/button/assets/background.png and /dev/null differ diff --git a/lib/yui/button/assets/button.css b/lib/yui/button/assets/button.css deleted file mode 100755 index fcdcfa24edfad..0000000000000 --- a/lib/yui/button/assets/button.css +++ /dev/null @@ -1,215 +0,0 @@ -/* -Copyright (c) 2007, Yahoo! Inc. All rights reserved. -Code licensed under the BSD License: -http://developer.yahoo.net/yui/license.txt -version: 2.3.0 -*/ -.yui-button { - - display:-moz-inline-box; /* Gecko */ - display:inline-block; /* IE, Opera and Safari */ - border-width:1px 0; - border-style:solid; - border-color:#999; - background:#ecece3 url(background.png) left center; - margin:auto .25em; - -} - -.yui-button.ie6 { - - /* Give the transparent background image to IE 6 */ - background-image:none; - filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../../build/button/assets/background.png', sizingMethod = 'scale'); - -} - -.yui-button .first-child { - - display:block; - *display:inline-block; /* IE */ - border-width:0 1px; - border-style:solid; - border-color:#999; - margin:0 -1px; - *position:relative; - *left:-1px; - -} - -.yui-button button, -.yui-button a { - - display:block; - *display:inline-block; /* IE */ - padding:.25em .5em; - border:1px solid #ccc; - -} - -.yui-button button { - - *overflow:visible; /* Remove superfluous padding for IE */ - font-size:100%; /* Makes form controls resizable in IE */ - background-color:transparent; - cursor:pointer; - cursor:hand; - -} - -.yui-button a { - - text-decoration:none; - color:#000; - -} - -.yui-split-button button, -.yui-menu-button button { - - padding-right:20px; - background-position:right center; - background-repeat:no-repeat; - -} - -.yui-menu-button button { - - background-image:url(menuarrow.gif); - -} - -.yui-split-button button { - - background-image:url(splitarrow.gif); - -} - - -/* Focus state */ - -.yui-button-focus { - - border-color:#5e5c95; - -} - -.yui-button-focus .first-child { - - border-color:#5e5c95; - -} - -.yui-button-focus button, -.yui-button-focus a { - - border-color:#cec1fc; - -} - - -/* Hover state */ - -.yui-button-hover { - - border-color:#406fac; - background-color:#98d5fc; - -} - -.yui-button-hover .first-child { - - border-color:#406fac; - -} - -.yui-button-hover button, -.yui-button-hover a { - - border-color:#7099ce; - -} - - -/* Active state */ - -.yui-button-active { - - border-color:#7a8180; - background-color:#333; - -} - -.yui-button-active .first-child { - - border-color:#7a8180; - -} - -.yui-button-active button, -.yui-button-active a { - - border-color:#98a09f; - -} - -.yui-split-button-activeoption button { - - background-color:transparent; - background-image:url(splitarrow_active.gif); - -} - - - -/* Checked state */ - -.yui-radio-button-checked, -.yui-checkbox-button-checked { - - border-color:#7a8180; - background-color:#333; - -} - -.yui-radio-button-checked .first-child, -.yui-checkbox-button-checked .first-child { - - border-color:#7a8180; - -} - -.yui-radio-button-checked button, -.yui-checkbox-button-checked button { - - border-color:#98a09f; - -} - - - -/* Disabled state */ - -.yui-button-disabled { - - border-color:#cbcdc5; - background:#ecece3; - - filter:none; - -} - -.yui-button-disabled .first-child { - - border-color:#cbcdc5; - -} - -.yui-button-disabled button, -.yui-button-disabled a { - - border-color:transparent; - color:#b9b9b9; - cursor:default; - -} \ No newline at end of file diff --git a/lib/yui/button/assets/menuarrow.gif b/lib/yui/button/assets/menuarrow.gif deleted file mode 100755 index ffa2ba9d25d7e..0000000000000 Binary files a/lib/yui/button/assets/menuarrow.gif and /dev/null differ diff --git a/lib/yui/button/assets/splitarrow.gif b/lib/yui/button/assets/splitarrow.gif deleted file mode 100755 index 6d1ce65940cde..0000000000000 Binary files a/lib/yui/button/assets/splitarrow.gif and /dev/null differ diff --git a/lib/yui/button/assets/splitarrow_active.gif b/lib/yui/button/assets/splitarrow_active.gif deleted file mode 100755 index 25c0884e06acf..0000000000000 Binary files a/lib/yui/button/assets/splitarrow_active.gif and /dev/null differ diff --git a/lib/yui/button/button-beta-debug.js b/lib/yui/button/button-beta-debug.js deleted file mode 100755 index c9dfa28cb72c7..0000000000000 --- a/lib/yui/button/button-beta-debug.js +++ /dev/null @@ -1,4554 +0,0 @@ -/* -Copyright (c) 2007, Yahoo! Inc. All rights reserved. -Code licensed under the BSD License: -http://developer.yahoo.net/yui/license.txt -version: 2.3.0 -*/ -/** -* @module button -* @description

The Button Control enables the creation of rich, graphical -* buttons that function like traditional HTML form buttons. Unlike -* tradition HTML form buttons, buttons created with the Button Control can have -* a label that is different from its value. With the inclusion of the optional -* Menu Control, the Button Control can also be -* used to create menu buttons and split buttons, controls that are not -* available natively in HTML. The Button Control can also be thought of as a -* way to create more visually engaging implementations of the browser's -* default radio-button and check-box controls.

-*

The Button Control supports the following types:

-*
-*
push
-*
Basic push button that can execute a user-specified command when -* pressed.
-*
link
-*
Navigates to a specified url when pressed.
-*
submit
-*
Submits the parent form when pressed.
-*
reset
-*
Resets the parent form when pressed.
-*
checkbox
-*
Maintains a "checked" state that can be toggled on and off.
-*
radio
-*
Maintains a "checked" state that can be toggled on and off. Use with -* the ButtonGroup class to create a set of controls that are mutually -* exclusive; checking one button in the set will uncheck all others in -* the group.
-*
menu
-*
When pressed will show/hide a menu.
-*
split
-*
Can execute a user-specified command or display a menu when pressed.
-*
-* @title Button -* @namespace YAHOO.widget -* @requires yahoo, dom, element, event -* @optional container, menu -* @beta -*/ - - -(function () { - - - /** - * The Button class creates a rich, graphical button. - * @param {String} p_oElement String specifying the id attribute of the - * <input>, <button>, - * <a>, or <span> element to - * be used to create the button. - * @param {HTMLInputElement| - * HTMLButtonElement|HTMLElement} p_oElement Object reference for the - * <input>, <button>, - * <a>, or <span> element to be - * used to create the button. - * @param {Object} p_oElement Object literal specifying a set of - * configuration attributes used to create the button. - * @param {Object} p_oAttributes Optional. Object literal specifying a set - * of configuration attributes used to create the button. - * @namespace YAHOO.widget - * @class Button - * @constructor - * @extends YAHOO.util.Element - */ - - - - // Shorthard for utilities - - var Dom = YAHOO.util.Dom, - Event = YAHOO.util.Event, - Lang = YAHOO.lang, - Overlay = YAHOO.widget.Overlay, - Menu = YAHOO.widget.Menu, - - - // Private member variables - - m_oButtons = {}, // Collection of all Button instances - m_oOverlayManager = null, // YAHOO.widget.OverlayManager instance - m_oSubmitTrigger = null, // The button that submitted the form - m_oFocusedButton = null; // The button that has focus - - - - // Private methods - - - - /** - * @method createInputElement - * @description Creates an <input> element of the - * specified type. - * @private - * @param {String} p_sType String specifying the type of - * <input> element to create. - * @param {String} p_sName String specifying the name of - * <input> element to create. - * @param {String} p_sValue String specifying the value of - * <input> element to create. - * @param {String} p_bChecked Boolean specifying if the - * <input> element is to be checked. - * @return {HTMLInputElement} - */ - function createInputElement(p_sType, p_sName, p_sValue, p_bChecked) { - - var oInput, - sInput; - - if (Lang.isString(p_sType) && Lang.isString(p_sName)) { - - if (YAHOO.env.ua.ie) { - - /* - For IE it is necessary to create the element with the - "type," "name," "value," and "checked" properties set all - at once. - */ - - sInput = "<input> or <a>) that - * map to Button configuration attributes and sets them into a collection - * that is passed to the Button constructor. - * @private - * @param {HTMLInputElement|HTMLAnchorElement} p_oElement Object reference to the HTML - * element (either <input> or <span> - * ) used to create the button. - * @param {Object} p_oAttributes Object reference for the collection of - * configuration attributes used to create the button. - */ - function setAttributesFromSrcElement(p_oElement, p_oAttributes) { - - var sSrcElementNodeName = p_oElement.nodeName.toUpperCase(), - me = this, - oAttribute, - oRootNode, - sText; - - - /** - * @method setAttributeFromDOMAttribute - * @description Gets the value of the specified DOM attribute and sets it - * into the collection of configuration attributes used to configure - * the button. - * @private - * @param {String} p_sAttribute String representing the name of the - * attribute to retrieve from the DOM element. - */ - function setAttributeFromDOMAttribute(p_sAttribute) { - - if ( !(p_sAttribute in p_oAttributes) ) { - - /* - Need to use "getAttributeNode" instead of "getAttribute" - because using "getAttribute," IE will return the innerText - of a <button> for the value attribute - rather than the value of the "value" attribute. - */ - - oAttribute = p_oElement.getAttributeNode(p_sAttribute); - - - if (oAttribute && ("value" in oAttribute)) { - - me.logger.log("Setting attribute \"" + p_sAttribute + - "\" using source element's attribute value of \"" + - oAttribute.value + "\""); - - p_oAttributes[p_sAttribute] = oAttribute.value; - - } - - } - - } - - - /** - * @method setFormElementProperties - * @description Gets the value of the attributes from the form element - * and sets them into the collection of configuration attributes used to - * configure the button. - * @private - */ - function setFormElementProperties() { - - setAttributeFromDOMAttribute("type"); - - if (p_oAttributes.type == "button") { - - p_oAttributes.type = "push"; - - } - - if ( !("disabled" in p_oAttributes) ) { - - p_oAttributes.disabled = p_oElement.disabled; - - } - - setAttributeFromDOMAttribute("name"); - setAttributeFromDOMAttribute("value"); - setAttributeFromDOMAttribute("title"); - - } - - - switch (sSrcElementNodeName) { - - case "A": - - p_oAttributes.type = "link"; - - setAttributeFromDOMAttribute("href"); - setAttributeFromDOMAttribute("target"); - - break; - - case "INPUT": - - setFormElementProperties(); - - if ( !("checked" in p_oAttributes) ) { - - p_oAttributes.checked = p_oElement.checked; - - } - - break; - - case "BUTTON": - - setFormElementProperties(); - - oRootNode = p_oElement.parentNode.parentNode; - - if (Dom.hasClass(oRootNode, this.CSS_CLASS_NAME + "-checked")) { - - p_oAttributes.checked = true; - - } - - if (Dom.hasClass(oRootNode, this.CSS_CLASS_NAME + "-disabled")) { - - p_oAttributes.disabled = true; - - } - - p_oElement.removeAttribute("value"); - - p_oElement.setAttribute("type", "button"); - - break; - - } - - p_oElement.removeAttribute("id"); - p_oElement.removeAttribute("name"); - - if ( !("tabindex" in p_oAttributes) ) { - - p_oAttributes.tabindex = p_oElement.tabIndex; - - } - - if ( !("label" in p_oAttributes) ) { - - // Set the "label" property - - sText = sSrcElementNodeName == "INPUT" ? - p_oElement.value : p_oElement.innerHTML; - - - if (sText && sText.length > 0) { - - p_oAttributes.label = sText; - - } - - } - - } - - - /** - * @method initConfig - * @description Initializes the set of configuration attributes that are - * used to instantiate the button. - * @private - * @param {Object} Object representing the button's set of - * configuration attributes. - */ - function initConfig(p_oConfig) { - - var oAttributes = p_oConfig.attributes, - oSrcElement = oAttributes.srcelement, - sSrcElementNodeName = oSrcElement.nodeName.toUpperCase(), - me = this; - - - if (sSrcElementNodeName == this.NODE_NAME) { - - p_oConfig.element = oSrcElement; - p_oConfig.id = oSrcElement.id; - - Dom.getElementsBy(function (p_oElement) { - - switch (p_oElement.nodeName.toUpperCase()) { - - case "BUTTON": - case "A": - case "INPUT": - - setAttributesFromSrcElement.call(me, p_oElement, - oAttributes); - - break; - - } - - }, "*", oSrcElement); - - } - else { - - switch (sSrcElementNodeName) { - - case "BUTTON": - case "A": - case "INPUT": - - setAttributesFromSrcElement.call(this, oSrcElement, - oAttributes); - - break; - - } - - } - - } - - - - // Constructor - - YAHOO.widget.Button = function (p_oElement, p_oAttributes) { - - var fnSuperClass = YAHOO.widget.Button.superclass.constructor, - oConfig, - oElement; - - if (arguments.length == 1 && !Lang.isString(p_oElement) && - !p_oElement.nodeName) { - - if (!p_oElement.id) { - - p_oElement.id = Dom.generateId(); - - YAHOO.log("No value specified for the button's \"id\" " + - "attribute. Setting button id to \"" + p_oElement.id + - "\".", "warn"); - - } - - this.logger = new YAHOO.widget.LogWriter("Button " + p_oElement.id); - - this.logger.log("No source HTML element. Building the button " + - "using the set of configuration attributes."); - - fnSuperClass.call(this, - (this.createButtonElement(p_oElement.type)), - p_oElement); - - } - else { - - oConfig = { element: null, attributes: (p_oAttributes || {}) }; - - - if (Lang.isString(p_oElement)) { - - oElement = Dom.get(p_oElement); - - if (oElement) { - - if (!oConfig.attributes.id) { - - oConfig.attributes.id = p_oElement; - - } - - this.logger = new YAHOO.widget.LogWriter( - "Button " + oConfig.attributes.id); - - this.logger.log("Building the button using an existing " + - "HTML element as a source element."); - - - oConfig.attributes.srcelement = oElement; - - initConfig.call(this, oConfig); - - - if (!oConfig.element) { - - this.logger.log("Source element could not be used " + - "as is. Creating a new HTML element for " + - "the button."); - - oConfig.element = - this.createButtonElement(oConfig.attributes.type); - - } - - fnSuperClass.call(this, oConfig.element, - oConfig.attributes); - - } - - } - else if (p_oElement.nodeName) { - - if (!oConfig.attributes.id) { - - if (p_oElement.id) { - - oConfig.attributes.id = p_oElement.id; - - } - else { - - oConfig.attributes.id = Dom.generateId(); - - YAHOO.log("No value specified for the button's " + - "\"id\" attribute. Setting button id to \"" + - oConfig.attributes.id + "\".", "warn"); - - } - - } - - - this.logger = new YAHOO.widget.LogWriter( - "Button " + oConfig.attributes.id); - - this.logger.log("Building the button using an existing HTML " + - "element as a source element."); - - - oConfig.attributes.srcelement = p_oElement; - - initConfig.call(this, oConfig); - - - if (!oConfig.element) { - - this.logger.log("Source element could not be used as is." + - " Creating a new HTML element for the button."); - - oConfig.element = - this.createButtonElement(oConfig.attributes.type); - - } - - fnSuperClass.call(this, oConfig.element, oConfig.attributes); - - } - - } - - }; - - - - YAHOO.extend(YAHOO.widget.Button, YAHOO.util.Element, { - - - // Protected properties - - - /** - * @property _button - * @description Object reference to the button's internal - * <a> or <button> element. - * @default null - * @protected - * @type HTMLAnchorElement|HTMLButtonElement - */ - _button: null, - - - /** - * @property _menu - * @description Object reference to the button's menu. - * @default null - * @protected - * @type {YAHOO.widget.Overlay| - * YAHOO.widget.Menu} - */ - _menu: null, - - - /** - * @property _hiddenFields - * @description Object reference to the <input> - * element, or array of HTML form elements used to represent the button - * when its parent form is submitted. - * @default null - * @protected - * @type HTMLInputElement|Array - */ - _hiddenFields: null, - - - /** - * @property _onclickAttributeValue - * @description Object reference to the button's current value for the - * "onclick" configuration attribute. - * @default null - * @protected - * @type Object - */ - _onclickAttributeValue: null, - - - /** - * @property _activationKeyPressed - * @description Boolean indicating if the key(s) that toggle the button's - * "active" state have been pressed. - * @default false - * @protected - * @type Boolean - */ - _activationKeyPressed: false, - - - /** - * @property _activationButtonPressed - * @description Boolean indicating if the mouse button that toggles - * the button's "active" state has been pressed. - * @default false - * @protected - * @type Boolean - */ - _activationButtonPressed: false, - - - /** - * @property _hasKeyEventHandlers - * @description Boolean indicating if the button's "blur", "keydown" and - * "keyup" event handlers are assigned - * @default false - * @protected - * @type Boolean - */ - _hasKeyEventHandlers: false, - - - /** - * @property _hasMouseEventHandlers - * @description Boolean indicating if the button's "mouseout," - * "mousedown," and "mouseup" event handlers are assigned - * @default false - * @protected - * @type Boolean - */ - _hasMouseEventHandlers: false, - - - - // Constants - - - /** - * @property NODE_NAME - * @description The name of the node to be used for the button's - * root element. - * @default "SPAN" - * @final - * @type String - */ - NODE_NAME: "SPAN", - - - /** - * @property CHECK_ACTIVATION_KEYS - * @description Array of numbers representing keys that (when pressed) - * toggle the button's "checked" attribute. - * @default [32] - * @final - * @type Array - */ - CHECK_ACTIVATION_KEYS: [32], - - - /** - * @property ACTIVATION_KEYS - * @description Array of numbers representing keys that (when presed) - * toggle the button's "active" state. - * @default [13, 32] - * @final - * @type Array - */ - ACTIVATION_KEYS: [13, 32], - - - /** - * @property OPTION_AREA_WIDTH - * @description Width (in pixels) of the area of a split button that - * when pressed will display a menu. - * @default 20 - * @final - * @type Number - */ - OPTION_AREA_WIDTH: 20, - - - /** - * @property CSS_CLASS_NAME - * @description String representing the CSS class(es) to be applied to - * the button's root element. - * @default "yui-button" - * @final - * @type String - */ - CSS_CLASS_NAME: "yui-button", - - - /** - * @property RADIO_DEFAULT_TITLE - * @description String representing the default title applied to buttons - * of type "radio." - * @default "Unchecked. Click to check." - * @final - * @type String - */ - RADIO_DEFAULT_TITLE: "Unchecked. Click to check.", - - - /** - * @property RADIO_CHECKED_TITLE - * @description String representing the title applied to buttons of - * type "radio" when checked. - * @default "Checked. Click to uncheck." - * @final - * @type String - */ - RADIO_CHECKED_TITLE: "Checked. Click to uncheck.", - - - /** - * @property CHECKBOX_DEFAULT_TITLE - * @description String representing the default title applied to - * buttons of type "checkbox." - * @default "Unchecked. Click to check." - * @final - * @type String - */ - CHECKBOX_DEFAULT_TITLE: "Unchecked. Click to check.", - - - /** - * @property CHECKBOX_CHECKED_TITLE - * @description String representing the title applied to buttons of type - * "checkbox" when checked. - * @default "Checked. Click to uncheck." - * @final - * @type String - */ - CHECKBOX_CHECKED_TITLE: "Checked. Click to uncheck.", - - - /** - * @property MENUBUTTON_DEFAULT_TITLE - * @description String representing the default title applied to - * buttons of type "menu." - * @default "Menu collapsed. Click to expand." - * @final - * @type String - */ - MENUBUTTON_DEFAULT_TITLE: "Menu collapsed. Click to expand.", - - - /** - * @property MENUBUTTON_MENU_VISIBLE_TITLE - * @description String representing the title applied to buttons of type - * "menu" when the button's menu is visible. - * @default "Menu expanded. Click or press Esc to collapse." - * @final - * @type String - */ - MENUBUTTON_MENU_VISIBLE_TITLE: - "Menu expanded. Click or press Esc to collapse.", - - - /** - * @property SPLITBUTTON_DEFAULT_TITLE - * @description String representing the default title applied to - * buttons of type "split." - * @default "Menu collapsed. Click inside option region or press - * Ctrl + Shift + M to show the menu." - * @final - * @type String - */ - SPLITBUTTON_DEFAULT_TITLE: ("Menu collapsed. Click inside option " + - "region or press Ctrl + Shift + M to show the menu."), - - - /** - * @property SPLITBUTTON_OPTION_VISIBLE_TITLE - * @description String representing the title applied to buttons of type - * "split" when the button's menu is visible. - * @default "Menu expanded. Press Esc or Ctrl + Shift + M to hide - * the menu." - * @final - * @type String - */ - SPLITBUTTON_OPTION_VISIBLE_TITLE: - "Menu expanded. Press Esc or Ctrl + Shift + M to hide the menu.", - - - /** - * @property SUBMIT_TITLE - * @description String representing the title applied to buttons of - * type "submit." - * @default "Click to submit form." - * @final - * @type String - */ - SUBMIT_TITLE: "Click to submit form.", - - - - // Protected attribute setter methods - - - /** - * @method _setType - * @description Sets the value of the button's "type" attribute. - * @protected - * @param {String} p_sType String indicating the value for the button's - * "type" attribute. - */ - _setType: function (p_sType) { - - if (p_sType == "split") { - - this.on("option", this._onOption); - - } - - }, - - - /** - * @method _setLabel - * @description Sets the value of the button's "label" attribute. - * @protected - * @param {String} p_sLabel String indicating the value for the button's - * "label" attribute. - */ - _setLabel: function (p_sLabel) { - - this._button.innerHTML = p_sLabel; - - }, - - - /** - * @method _setTabIndex - * @description Sets the value of the button's "tabindex" attribute. - * @protected - * @param {Number} p_nTabIndex Number indicating the value for the - * button's "tabindex" attribute. - */ - _setTabIndex: function (p_nTabIndex) { - - this._button.tabIndex = p_nTabIndex; - - }, - - - /** - * @method _setTitle - * @description Sets the value of the button's "title" attribute. - * @protected - * @param {String} p_nTabIndex Number indicating the value for - * the button's "title" attribute. - */ - _setTitle: function (p_sTitle) { - - var sTitle = p_sTitle; - - if (this.get("type") != "link") { - - if (!sTitle) { - - switch (this.get("type")) { - - case "radio": - - sTitle = this.RADIO_DEFAULT_TITLE; - - break; - - case "checkbox": - - sTitle = this.CHECKBOX_DEFAULT_TITLE; - - break; - - case "menu": - - sTitle = this.MENUBUTTON_DEFAULT_TITLE; - - break; - - case "split": - - sTitle = this.SPLITBUTTON_DEFAULT_TITLE; - - break; - - case "submit": - - sTitle = this.SUBMIT_TITLE; - - break; - - } - - } - - this._button.title = sTitle; - - } - - }, - - - /** - * @method _setDisabled - * @description Sets the value of the button's "disabled" attribute. - * @protected - * @param {Boolean} p_bDisabled Boolean indicating the value for - * the button's "disabled" attribute. - */ - _setDisabled: function (p_bDisabled) { - - if (this.get("type") != "link") { - - if (p_bDisabled) { - - if (this._menu) { - - this._menu.hide(); - - } - - if (this.hasFocus()) { - - this.blur(); - - } - - this._button.setAttribute("disabled", "disabled"); - - this.addStateCSSClasses("disabled"); - - } - else { - - this._button.removeAttribute("disabled"); - - this.removeStateCSSClasses("disabled"); - - } - - } - - }, - - - /** - * @method _setHref - * @description Sets the value of the button's "href" attribute. - * @protected - * @param {String} p_sHref String indicating the value for the button's - * "href" attribute. - */ - _setHref: function (p_sHref) { - - if (this.get("type") == "link") { - - this._button.href = p_sHref; - - } - - }, - - - /** - * @method _setTarget - * @description Sets the value of the button's "target" attribute. - * @protected - * @param {String} p_sTarget String indicating the value for the button's - * "target" attribute. - */ - _setTarget: function (p_sTarget) { - - if (this.get("type") == "link") { - - this._button.setAttribute("target", p_sTarget); - - } - - }, - - - /** - * @method _setChecked - * @description Sets the value of the button's "target" attribute. - * @protected - * @param {Boolean} p_bChecked Boolean indicating the value for - * the button's "checked" attribute. - */ - _setChecked: function (p_bChecked) { - - var sType = this.get("type"), - sTitle; - - if (sType == "checkbox" || sType == "radio") { - - if (p_bChecked) { - - this.addStateCSSClasses("checked"); - - sTitle = (sType == "radio") ? - this.RADIO_CHECKED_TITLE : - this.CHECKBOX_CHECKED_TITLE; - - } - else { - - this.removeStateCSSClasses("checked"); - - sTitle = (sType == "radio") ? - this.RADIO_DEFAULT_TITLE : - this.CHECKBOX_DEFAULT_TITLE; - - } - - this.set("title", sTitle); - - } - - }, - - - /** - * @method _setMenu - * @description Sets the value of the button's "menu" attribute. - * @protected - * @param {Object} p_oMenu Object indicating the value for the button's - * "menu" attribute. - */ - _setMenu: function (p_oMenu) { - - var bLazyLoad = this.get("lazyloadmenu"), - oButtonElement = this.get("element"), - - /* - Boolean indicating if the value of p_oMenu is an instance - of YAHOO.widget.Menu or YAHOO.widget.Overlay. - */ - - bInstance = false, - - - oMenu, - oMenuElement, - oSrcElement, - aItems, - nItems, - oItem, - i; - - - if (!Overlay) { - - this.logger.log("YAHOO.widget.Overlay dependency not met.", - "error"); - - return false; - - } - - - if (!Menu) { - - this.logger.log("YAHOO.widget.Menu dependency not met.", - "error"); - - return false; - - } - - - function onAppendTo() { - - oMenu.render(oButtonElement.parentNode); - - this.removeListener("appendTo", onAppendTo); - - } - - - function initMenu() { - - if (oMenu) { - - Dom.addClass(oMenu.element, this.get("menuclassname")); - Dom.addClass(oMenu.element, - "yui-" + this.get("type") + "-button-menu"); - - oMenu.showEvent.subscribe(this._onMenuShow, null, this); - oMenu.hideEvent.subscribe(this._onMenuHide, null, this); - oMenu.renderEvent.subscribe(this._onMenuRender, null, this); - - - if (oMenu instanceof Menu) { - - oMenu.keyDownEvent.subscribe(this._onMenuKeyDown, - this, true); - - oMenu.clickEvent.subscribe(this._onMenuClick, - this, true); - - oMenu.itemAddedEvent.subscribe(this._onMenuItemAdded, - this, true); - - oSrcElement = oMenu.srcElement; - - if (oSrcElement && - oSrcElement.nodeName.toUpperCase() == "SELECT") { - - oSrcElement.style.display = "none"; - oSrcElement.parentNode.removeChild(oSrcElement); - - } - - } - else if (oMenu instanceof Overlay) { - - if (!m_oOverlayManager) { - - m_oOverlayManager = - new YAHOO.widget.OverlayManager(); - - } - - m_oOverlayManager.register(oMenu); - - } - - - this._menu = oMenu; - - - if (!bInstance) { - - if (bLazyLoad && !(oMenu instanceof Menu)) { - - /* - Mimic Menu's "lazyload" functionality by adding - a "beforeshow" event listener that renders the - Overlay instance before it is made visible by - the button. - */ - - oMenu.beforeShowEvent.subscribe( - this._onOverlayBeforeShow, null, this); - - } - else if (!bLazyLoad) { - - if (Dom.inDocument(oButtonElement)) { - - oMenu.render(oButtonElement.parentNode); - - } - else { - - this.on("appendTo", onAppendTo); - - } - - } - - } - - } - - } - - - if (p_oMenu && (p_oMenu instanceof Menu)) { - - oMenu = p_oMenu; - aItems = oMenu.getItems(); - nItems = aItems.length; - bInstance = true; - - - if (nItems > 0) { - - i = nItems - 1; - - do { - - oItem = aItems[i]; - - if (oItem) { - - oItem.cfg.subscribeToConfigEvent("selected", - this._onMenuItemSelected, - oItem, - this); - - } - - } - while (i--); - - } - - initMenu.call(this); - - } - else if (p_oMenu && (p_oMenu instanceof Overlay)) { - - oMenu = p_oMenu; - bInstance = true; - - oMenu.cfg.setProperty("visible", false); - oMenu.cfg.setProperty("context", [oButtonElement, "tl", "bl"]); - - initMenu.call(this); - - } - else if (Lang.isArray(p_oMenu)) { - - this.on("appendTo", function () { - - oMenu = new Menu(Dom.generateId(), { lazyload: bLazyLoad, - itemdata: p_oMenu }); - - initMenu.call(this); - - }); - - } - else if (Lang.isString(p_oMenu)) { - - oMenuElement = Dom.get(p_oMenu); - - if (oMenuElement) { - - if (Dom.hasClass(oMenuElement, - Menu.prototype.CSS_CLASS_NAME) || - oMenuElement.nodeName == "SELECT") { - - oMenu = new Menu(p_oMenu, { lazyload: bLazyLoad }); - - initMenu.call(this); - - } - else { - - oMenu = new Overlay(p_oMenu, { visible: false, - context: [oButtonElement, "tl", "bl"] }); - - initMenu.call(this); - - } - - } - - } - else if (p_oMenu && p_oMenu.nodeName) { - - if (Dom.hasClass(p_oMenu, Menu.prototype.CSS_CLASS_NAME) || - p_oMenu.nodeName == "SELECT") { - - oMenu = new Menu(p_oMenu, { lazyload: bLazyLoad }); - - initMenu.call(this); - - } - else { - - if (!p_oMenu.id) { - - Dom.generateId(p_oMenu); - - } - - oMenu = new Overlay(p_oMenu, { visible: false, - context: [oButtonElement, "tl", "bl"] }); - - initMenu.call(this); - - } - - } - - }, - - - /** - * @method _setOnClick - * @description Sets the value of the button's "onclick" attribute. - * @protected - * @param {Object} p_oObject Object indicating the value for the button's - * "onclick" attribute. - */ - _setOnClick: function (p_oObject) { - - /* - Remove any existing listeners if a "click" event handler - has already been specified. - */ - - if (this._onclickAttributeValue && - (this._onclickAttributeValue != p_oObject)) { - - this.removeListener("click", this._onclickAttributeValue.fn); - - this._onclickAttributeValue = null; - - } - - - if (!this._onclickAttributeValue && - Lang.isObject(p_oObject) && - Lang.isFunction(p_oObject.fn)) { - - this.on("click", p_oObject.fn, p_oObject.obj, p_oObject.scope); - - this._onclickAttributeValue = p_oObject; - - } - - }, - - - /** - * @method _setSelectedMenuItem - * @description Sets the value of the button's - * "selectedMenuItem" attribute. - * @protected - * @param {Number} p_nIndex Number representing the index of the item - * in the button's menu that is currently selected. - */ - _setSelectedMenuItem: function (p_nIndex) { - - var oMenu = this._menu, - oMenuItem; - - - if (oMenu && oMenu instanceof Menu) { - - oMenuItem = oMenu.getItem(p_nIndex); - - - if (oMenuItem && !oMenuItem.cfg.getProperty("selected")) { - - oMenuItem.cfg.setProperty("selected", true); - - } - - } - - }, - - - // Protected methods - - - - /** - * @method _isActivationKey - * @description Determines if the specified keycode is one that toggles - * the button's "active" state. - * @protected - * @param {Number} p_nKeyCode Number representing the keycode to - * be evaluated. - * @return {Boolean} - */ - _isActivationKey: function (p_nKeyCode) { - - var sType = this.get("type"), - aKeyCodes = (sType == "checkbox" || sType == "radio") ? - this.CHECK_ACTIVATION_KEYS : this.ACTIVATION_KEYS, - - nKeyCodes = aKeyCodes.length, - i; - - if (nKeyCodes > 0) { - - i = nKeyCodes - 1; - - do { - - if (p_nKeyCode == aKeyCodes[i]) { - - return true; - - } - - } - while (i--); - - } - - }, - - - /** - * @method _isSplitButtonOptionKey - * @description Determines if the specified keycode is one that toggles - * the display of the split button's menu. - * @protected - * @param {Event} p_oEvent Object representing the DOM event object - * passed back by the event utility (YAHOO.util.Event). - * @return {Boolean} - */ - _isSplitButtonOptionKey: function (p_oEvent) { - - return (p_oEvent.ctrlKey && p_oEvent.shiftKey && - Event.getCharCode(p_oEvent) == 77); - - }, - - - /** - * @method _addListenersToForm - * @description Adds event handlers to the button's form. - * @protected - */ - _addListenersToForm: function () { - - var oForm = this.getForm(), - oSrcElement, - aListeners, - nListeners, - i, - bHasKeyPressListener; - - - if (oForm) { - - Event.on(oForm, "reset", this._onFormReset, null, this); - Event.on(oForm, "submit", this.createHiddenFields, null, this); - - oSrcElement = this.get("srcelement"); - - - if (this.get("type") == "submit" || - (oSrcElement && oSrcElement.type == "submit")) - { - - aListeners = Event.getListeners(oForm, "keypress"); - bHasKeyPressListener = false; - - if (aListeners) { - - nListeners = aListeners.length; - - if (nListeners > 0) { - - i = nListeners - 1; - - do { - - if (aListeners[i].fn == - YAHOO.widget.Button.onFormKeyPress) - { - - bHasKeyPressListener = true; - break; - - } - - } - while (i--); - - } - - } - - - if (!bHasKeyPressListener) { - - Event.on(oForm, "keypress", - YAHOO.widget.Button.onFormKeyPress); - - } - - } - - } - - }, - - - _originalMaxHeight: -1, - - - /** - * @method _showMenu - * @description Shows the button's menu. - * @protected - * @param {Event} p_oEvent Object representing the DOM event object - * passed back by the event utility (YAHOO.util.Event) that triggered - * the display of the menu. - */ - _showMenu: function (p_oEvent) { - - YAHOO.widget.MenuManager.hideVisible(); - - if (m_oOverlayManager) { - - m_oOverlayManager.hideAll(); - - } - - - var oMenu = this._menu, - nViewportHeight = Dom.getViewportHeight(), - nMenuHeight, - nScrollTop, - nY; - - - if (oMenu && (oMenu instanceof Menu)) { - - oMenu.cfg.applyConfig({ context: [this.get("id"), "tl", "bl"], - constraintoviewport: false, - clicktohide: false, - visible: true }); - - oMenu.cfg.fireQueue(); - - oMenu.align("tl", "bl"); - - /* - Stop the propagation of the event so that the MenuManager - doesn't blur the menu after it gets focus. - */ - - if (p_oEvent.type == "mousedown") { - - Event.stopPropagation(p_oEvent); - - } - - - if (this.get("focusmenu")) { - - this._menu.focus(); - - } - - nMenuHeight = oMenu.element.offsetHeight; - - - if ((oMenu.cfg.getProperty("y") + nMenuHeight) > - nViewportHeight) { - - this.logger.log("Current menu position will place a " + - "portion, or the entire menu outside the boundary of " + - "the viewport. Repositioning the menu to stay " + - "inside the viewport."); - - oMenu.align("bl", "tl"); - - nY = oMenu.cfg.getProperty("y"); - - nScrollTop = Dom.getDocumentScrollTop(); - - - if (nScrollTop >= nY) { - - if (this._originalMaxHeight == -1) { - - this._originalMaxHeight = - oMenu.cfg.getProperty("maxheight"); - - } - - oMenu.cfg.setProperty("maxheight", - (nMenuHeight - ((nScrollTop - nY) + 20))); - - oMenu.align("bl", "tl"); - - } - - } - - } - else if (oMenu && (oMenu instanceof Overlay)) { - - oMenu.show(); - oMenu.align("tl", "bl"); - - nMenuHeight = oMenu.element.offsetHeight; - - - if ((oMenu.cfg.getProperty("y") + nMenuHeight) > - nViewportHeight) { - - this.logger.log("Current menu position will place a " + - "portion, or the entire menu outside the boundary of " + - "the viewport. Repositioning the menu to stay inside" + - " the viewport."); - - oMenu.align("bl", "tl"); - - } - - } - - }, - - - /** - * @method _hideMenu - * @description Hides the button's menu. - * @protected - */ - _hideMenu: function () { - - var oMenu = this._menu; - - if (oMenu) { - - oMenu.hide(); - - } - - }, - - - - - // Protected event handlers - - - /** - * @method _onMouseOver - * @description "mouseover" event handler for the button. - * @protected - * @param {Event} p_oEvent Object representing the DOM event object - * passed back by the event utility (YAHOO.util.Event). - */ - _onMouseOver: function (p_oEvent) { - - if (!this._hasMouseEventHandlers) { - - this.on("mouseout", this._onMouseOut); - this.on("mousedown", this._onMouseDown); - this.on("mouseup", this._onMouseUp); - - this._hasMouseEventHandlers = true; - - } - - this.addStateCSSClasses("hover"); - - if (this._activationButtonPressed) { - - this.addStateCSSClasses("active"); - - } - - - if (this._bOptionPressed) { - - this.addStateCSSClasses("activeoption"); - - } - - }, - - - /** - * @method _onMouseOut - * @description "mouseout" event handler for the button. - * @protected - * @param {Event} p_oEvent Object representing the DOM event object - * passed back by the event utility (YAHOO.util.Event). - */ - _onMouseOut: function (p_oEvent) { - - this.removeStateCSSClasses("hover"); - - if (this.get("type") != "menu") { - - this.removeStateCSSClasses("active"); - - } - - if (this._activationButtonPressed || this._bOptionPressed) { - - Event.on(document, "mouseup", this._onDocumentMouseUp, - null, this); - - } - - }, - - - /** - * @method _onDocumentMouseUp - * @description "mouseup" event handler for the button. - * @protected - * @param {Event} p_oEvent Object representing the DOM event object - * passed back by the event utility (YAHOO.util.Event). - */ - _onDocumentMouseUp: function (p_oEvent) { - - this._activationButtonPressed = false; - this._bOptionPressed = false; - - var sType = this.get("type"); - - if (sType == "menu" || sType == "split") { - - this.removeStateCSSClasses( - (sType == "menu" ? "active" : "activeoption")); - - this._hideMenu(); - - } - - Event.removeListener(document, "mouseup", this._onDocumentMouseUp); - - }, - - - /** - * @method _onMouseDown - * @description "mousedown" event handler for the button. - * @protected - * @param {Event} p_oEvent Object representing the DOM event object - * passed back by the event utility (YAHOO.util.Event). - */ - _onMouseDown: function (p_oEvent) { - - var sType, - oElement, - nX, - me; - - - function onMouseUp() { - - this._hideMenu(); - this.removeListener("mouseup", onMouseUp); - - } - - - if ((p_oEvent.which || p_oEvent.button) == 1) { - - - if (!this.hasFocus()) { - - this.focus(); - - } - - - sType = this.get("type"); - - - if (sType == "split") { - - oElement = this.get("element"); - nX = Event.getPageX(p_oEvent) - Dom.getX(oElement); - - if ((oElement.offsetWidth - this.OPTION_AREA_WIDTH) < nX) { - - this.fireEvent("option", p_oEvent); - - } - else { - - this.addStateCSSClasses("active"); - - this._activationButtonPressed = true; - - } - - } - else if (sType == "menu") { - - if (this.isActive()) { - - this._hideMenu(); - - this._activationButtonPressed = false; - - } - else { - - this._showMenu(p_oEvent); - - this._activationButtonPressed = true; - - } - - } - else { - - this.addStateCSSClasses("active"); - - this._activationButtonPressed = true; - - } - - - - if (sType == "split" || sType == "menu") { - - me = this; - - this._hideMenuTimerId = window.setTimeout(function () { - - me.on("mouseup", onMouseUp); - - }, 250); - - } - - } - - }, - - - /** - * @method _onMouseUp - * @description "mouseup" event handler for the button. - * @protected - * @param {Event} p_oEvent Object representing the DOM event object - * passed back by the event utility (YAHOO.util.Event). - */ - _onMouseUp: function (p_oEvent) { - - var sType = this.get("type"); - - - if (this._hideMenuTimerId) { - - window.clearTimeout(this._hideMenuTimerId); - - } - - - if (sType == "checkbox" || sType == "radio") { - - this.set("checked", !(this.get("checked"))); - - } - - - this._activationButtonPressed = false; - - - if (this.get("type") != "menu") { - - this.removeStateCSSClasses("active"); - - } - - }, - - - /** - * @method _onFocus - * @description "focus" event handler for the button. - * @protected - * @param {Event} p_oEvent Object representing the DOM event object - * passed back by the event utility (YAHOO.util.Event). - */ - _onFocus: function (p_oEvent) { - - var oElement; - - this.addStateCSSClasses("focus"); - - if (this._activationKeyPressed) { - - this.addStateCSSClasses("active"); - - } - - m_oFocusedButton = this; - - - if (!this._hasKeyEventHandlers) { - - oElement = this._button; - - Event.on(oElement, "blur", this._onBlur, null, this); - Event.on(oElement, "keydown", this._onKeyDown, null, this); - Event.on(oElement, "keyup", this._onKeyUp, null, this); - - this._hasKeyEventHandlers = true; - - } - - - this.fireEvent("focus", p_oEvent); - - }, - - - /** - * @method _onBlur - * @description "blur" event handler for the button. - * @protected - * @param {Event} p_oEvent Object representing the DOM event object - * passed back by the event utility (YAHOO.util.Event). - */ - _onBlur: function (p_oEvent) { - - this.removeStateCSSClasses("focus"); - - if (this.get("type") != "menu") { - - this.removeStateCSSClasses("active"); - - } - - if (this._activationKeyPressed) { - - Event.on(document, "keyup", this._onDocumentKeyUp, null, this); - - } - - - m_oFocusedButton = null; - - this.fireEvent("blur", p_oEvent); - - }, - - - /** - * @method _onDocumentKeyUp - * @description "keyup" event handler for the document. - * @protected - * @param {Event} p_oEvent Object representing the DOM event object - * passed back by the event utility (YAHOO.util.Event). - */ - _onDocumentKeyUp: function (p_oEvent) { - - if (this._isActivationKey(Event.getCharCode(p_oEvent))) { - - this._activationKeyPressed = false; - - Event.removeListener(document, "keyup", this._onDocumentKeyUp); - - } - - }, - - - /** - * @method _onKeyDown - * @description "keydown" event handler for the button. - * @protected - * @param {Event} p_oEvent Object representing the DOM event object - * passed back by the event utility (YAHOO.util.Event). - */ - _onKeyDown: function (p_oEvent) { - - var oMenu = this._menu; - - - if (this.get("type") == "split" && - this._isSplitButtonOptionKey(p_oEvent)) { - - this.fireEvent("option", p_oEvent); - - } - else if (this._isActivationKey(Event.getCharCode(p_oEvent))) { - - if (this.get("type") == "menu") { - - this._showMenu(p_oEvent); - - } - else { - - this._activationKeyPressed = true; - - this.addStateCSSClasses("active"); - - } - - } - - - if (oMenu && oMenu.cfg.getProperty("visible") && - Event.getCharCode(p_oEvent) == 27) { - - oMenu.hide(); - this.focus(); - - } - - }, - - - /** - * @method _onKeyUp - * @description "keyup" event handler for the button. - * @protected - * @param {Event} p_oEvent Object representing the DOM event object - * passed back by the event utility (YAHOO.util.Event). - */ - _onKeyUp: function (p_oEvent) { - - var sType; - - if (this._isActivationKey(Event.getCharCode(p_oEvent))) { - - sType = this.get("type"); - - if (sType == "checkbox" || sType == "radio") { - - this.set("checked", !(this.get("checked"))); - - } - - this._activationKeyPressed = false; - - if (this.get("type") != "menu") { - - this.removeStateCSSClasses("active"); - - } - - } - - }, - - - /** - * @method _onClick - * @description "click" event handler for the button. - * @protected - * @param {Event} p_oEvent Object representing the DOM event object - * passed back by the event utility (YAHOO.util.Event). - */ - _onClick: function (p_oEvent) { - - var sType = this.get("type"), - sTitle, - oForm, - oSrcElement, - oElement, - nX; - - - switch (sType) { - - case "radio": - case "checkbox": - - if (this.get("checked")) { - - sTitle = (sType == "radio") ? - this.RADIO_CHECKED_TITLE : - this.CHECKBOX_CHECKED_TITLE; - - } - else { - - sTitle = (sType == "radio") ? - this.RADIO_DEFAULT_TITLE : - this.CHECKBOX_DEFAULT_TITLE; - - } - - this.set("title", sTitle); - - break; - - case "submit": - - this.submitForm(); - - break; - - case "reset": - - oForm = this.getForm(); - - if (oForm) { - - oForm.reset(); - - } - - break; - - case "menu": - - sTitle = this._menu.cfg.getProperty("visible") ? - this.MENUBUTTON_MENU_VISIBLE_TITLE : - this.MENUBUTTON_DEFAULT_TITLE; - - this.set("title", sTitle); - - break; - - case "split": - - oElement = this.get("element"); - nX = Event.getPageX(p_oEvent) - Dom.getX(oElement); - - if ((oElement.offsetWidth - this.OPTION_AREA_WIDTH) < nX) { - - return false; - - } - else { - - this._hideMenu(); - - oSrcElement = this.get("srcelement"); - - if (oSrcElement && oSrcElement.type == "submit") { - - this.submitForm(); - - } - - } - - sTitle = this._menu.cfg.getProperty("visible") ? - this.SPLITBUTTON_OPTION_VISIBLE_TITLE : - this.SPLITBUTTON_DEFAULT_TITLE; - - this.set("title", sTitle); - - break; - - } - - }, - - - /** - * @method _onAppendTo - * @description "appendTo" event handler for the button. - * @protected - * @param {Event} p_oEvent Object representing the DOM event object - * passed back by the event utility (YAHOO.util.Event). - */ - _onAppendTo: function (p_oEvent) { - - /* - It is necessary to call "getForm" using "setTimeout" to make - sure that the button's "form" property returns a node - reference. Sometimes, if you try to get the reference - immediately after appending the field, it is null. - */ - - var me = this; - - window.setTimeout(function () { - - me._addListenersToForm(); - - }, 0); - - }, - - - /** - * @method _onFormReset - * @description "reset" event handler for the button's form. - * @protected - * @param {Event} p_oEvent Object representing the DOM event - * object passed back by the event utility (YAHOO.util.Event). - */ - _onFormReset: function (p_oEvent) { - - var sType = this.get("type"), - oMenu = this._menu; - - if (sType == "checkbox" || sType == "radio") { - - this.resetValue("checked"); - - } - - - if (oMenu && (oMenu instanceof Menu)) { - - this.resetValue("selectedMenuItem"); - - } - - }, - - - /** - * @method _onDocumentMouseDown - * @description "mousedown" event handler for the document. - * @protected - * @param {Event} p_oEvent Object representing the DOM event object - * passed back by the event utility (YAHOO.util.Event). - */ - _onDocumentMouseDown: function (p_oEvent) { - - var oTarget = Event.getTarget(p_oEvent), - oButtonElement = this.get("element"), - oMenuElement = this._menu.element; - - if (oTarget != oButtonElement && - !Dom.isAncestor(oButtonElement, oTarget) && - oTarget != oMenuElement && - !Dom.isAncestor(oMenuElement, oTarget)) { - - this._hideMenu(); - - Event.removeListener(document, "mousedown", - this._onDocumentMouseDown); - - } - - }, - - - /** - * @method _onOption - * @description "option" event handler for the button. - * @protected - * @param {Event} p_oEvent Object representing the DOM event object - * passed back by the event utility (YAHOO.util.Event). - */ - _onOption: function (p_oEvent) { - - if (this.hasClass("yui-split-button-activeoption")) { - - this._hideMenu(); - - this._bOptionPressed = false; - - } - else { - - this._showMenu(p_oEvent); - - this._bOptionPressed = true; - - } - - }, - - - /** - * @method _onOverlayBeforeShow - * @description "beforeshow" event handler for the - * YAHOO.widget.Overlay instance - * serving as the button's menu. - * @private - * @param {String} p_sType String representing the name of the event - * that was fired. - */ - _onOverlayBeforeShow: function (p_sType) { - - var oMenu = this._menu; - - oMenu.render(this.get("element").parentNode); - - oMenu.beforeShowEvent.unsubscribe(this._onOverlayBeforeShow); - - }, - - - /** - * @method _onMenuShow - * @description "show" event handler for the button's menu. - * @private - * @param {String} p_sType String representing the name of the event - * that was fired. - */ - _onMenuShow: function (p_sType) { - - Event.on(document, "mousedown", this._onDocumentMouseDown, - null, this); - - var sTitle, - sState; - - if (this.get("type") == "split") { - - sTitle = this.SPLITBUTTON_OPTION_VISIBLE_TITLE; - sState = "activeoption"; - - } - else { - - sTitle = this.MENUBUTTON_MENU_VISIBLE_TITLE; - sState = "active"; - - } - - this.addStateCSSClasses(sState); - this.set("title", sTitle); - - }, - - - /** - * @method _onMenuHide - * @description "hide" event handler for the button's menu. - * @private - * @param {String} p_sType String representing the name of the event - * that was fired. - */ - _onMenuHide: function (p_sType) { - - var oMenu = this._menu, - sTitle, - sState; - - if (oMenu && (oMenu instanceof Menu) && - this._originalMaxHeight != -1) { - - this._menu.cfg.setProperty("maxheight", - this._originalMaxHeight); - - } - - - if (this.get("type") == "split") { - - sTitle = this.SPLITBUTTON_DEFAULT_TITLE; - sState = "activeoption"; - - } - else { - - sTitle = this.MENUBUTTON_DEFAULT_TITLE; - sState = "active"; - } - - - this.removeStateCSSClasses(sState); - this.set("title", sTitle); - - - if (this.get("type") == "split") { - - this._bOptionPressed = false; - - } - - }, - - - /** - * @method _onMenuKeyDown - * @description "keydown" event handler for the button's menu. - * @private - * @param {String} p_sType String representing the name of the event - * that was fired. - * @param {Array} p_aArgs Array of arguments sent when the event - * was fired. - */ - _onMenuKeyDown: function (p_sType, p_aArgs) { - - var oEvent = p_aArgs[0]; - - if (Event.getCharCode(oEvent) == 27) { - - this.focus(); - - if (this.get("type") == "split") { - - this._bOptionPressed = false; - - } - - } - - }, - - - /** - * @method _onMenuRender - * @description "render" event handler for the button's menu. - * @private - * @param {String} p_sType String representing the name of the - * event thatwas fired. - */ - _onMenuRender: function (p_sType) { - - var oButtonElement = this.get("element"), - oButtonParent = oButtonElement.parentNode, - oMenuElement = this._menu.element; - - - if (oButtonParent != oMenuElement.parentNode) { - - oButtonParent.appendChild(oMenuElement); - - } - - this.set("selectedMenuItem", this.get("selectedMenuItem")); - - }, - - - /** - * @method _onMenuItemSelected - * @description "selectedchange" event handler for each item in the - * button's menu. - * @private - * @param {String} p_sType String representing the name of the event - * that was fired. - * @param {Array} p_aArgs Array of arguments sent when the event - * was fired. - * @param {Number} p_nItem Number representing the index of the menu - * item that subscribed to the event. - */ - _onMenuItemSelected: function (p_sType, p_aArgs, p_nItem) { - - var bSelected = p_aArgs[0]; - - if (bSelected) { - - this.set("selectedMenuItem", p_nItem); - - } - - }, - - - /** - * @method _onMenuItemAdded - * @description "itemadded" event handler for the button's menu. - * @private - * @param {String} p_sType String representing the name of the event - * that was fired. - * @param {Array} p_aArgs Array of arguments sent when the event - * was fired. - * @param { - * YAHOO.widget.MenuItem} p_oItem Object representing the menu - * item that subscribed to the event. - */ - _onMenuItemAdded: function (p_sType, p_aArgs, p_oItem) { - - var oItem = p_aArgs[0]; - - oItem.cfg.subscribeToConfigEvent("selected", - this._onMenuItemSelected, - oItem.index, - this); - - }, - - - /** - * @method _onMenuClick - * @description "click" event handler for the button's menu. - * @private - * @param {String} p_sType String representing the name of the event - * that was fired. - * @param {Array} p_aArgs Array of arguments sent when the event - * was fired. - */ - _onMenuClick: function (p_sType, p_aArgs) { - - var oItem = p_aArgs[1], - oSrcElement; - - if (oItem) { - - oSrcElement = this.get("srcelement"); - - if (oSrcElement && oSrcElement.type == "submit") { - - this.submitForm(); - - } - - this._hideMenu(); - - } - - }, - - - - // Public methods - - - /** - * @method createButtonElement - * @description Creates the button's HTML elements. - * @param {String} p_sType String indicating the type of element - * to create. - * @return {HTMLElement} - */ - createButtonElement: function (p_sType) { - - var sNodeName = this.NODE_NAME, - oElement = document.createElement(sNodeName); - - oElement.innerHTML = "<" + sNodeName + " class=\"first-child\">" + - (p_sType == "link" ? "" : - "") + ""; - - return oElement; - - }, - - - /** - * @method addStateCSSClasses - * @description Appends state-specific CSS classes to the button's root - * DOM element. - */ - addStateCSSClasses: function (p_sState) { - - var sType = this.get("type"); - - if (Lang.isString(p_sState)) { - - if (p_sState != "activeoption") { - - this.addClass(this.CSS_CLASS_NAME + ("-" + p_sState)); - - } - - this.addClass("yui-" + sType + ("-button-" + p_sState)); - - } - - }, - - - /** - * @method removeStateCSSClasses - * @description Removes state-specific CSS classes to the button's root - * DOM element. - */ - removeStateCSSClasses: function (p_sState) { - - var sType = this.get("type"); - - if (Lang.isString(p_sState)) { - - this.removeClass(this.CSS_CLASS_NAME + ("-" + p_sState)); - this.removeClass("yui-" + sType + ("-button-" + p_sState)); - - } - - }, - - - /** - * @method createHiddenFields - * @description Creates the button's hidden form field and appends it - * to its parent form. - * @return {HTMLInputElement|Array} - */ - createHiddenFields: function () { - - this.removeHiddenFields(); - - var oForm = this.getForm(), - oButtonField, - sType, - bCheckable, - oMenu, - oMenuItem, - sName, - oValue, - oMenuField; - - - if (oForm && !this.get("disabled")) { - - sType = this.get("type"); - bCheckable = (sType == "checkbox" || sType == "radio"); - - - if (bCheckable || (m_oSubmitTrigger == this)) { - - this.logger.log("Creating hidden field."); - - oButtonField = createInputElement( - (bCheckable ? sType : "hidden"), - this.get("name"), - this.get("value"), - this.get("checked")); - - - if (oButtonField) { - - if (bCheckable) { - - oButtonField.style.display = "none"; - - } - - oForm.appendChild(oButtonField); - - } - - } - - - oMenu = this._menu; - - - if (oMenu && (oMenu instanceof Menu)) { - - this.logger.log("Creating hidden field for menu."); - - oMenuField = oMenu.srcElement; - oMenuItem = oMenu.getItem(this.get("selectedMenuItem")); - - if (oMenuField && - oMenuField.nodeName.toUpperCase() == "SELECT") { - - oForm.appendChild(oMenuField); - oMenuField.selectedIndex = oMenuItem.index; - - } - else { - - oValue = (oMenuItem.value === null || - oMenuItem.value === "") ? - oMenuItem.cfg.getProperty("text") : - oMenuItem.value; - - sName = this.get("name"); - - if (oValue && sName) { - - oMenuField = createInputElement("hidden", - (sName + "_options"), - oValue); - - oForm.appendChild(oMenuField); - - } - - } - - } - - - if (oButtonField && oMenuField) { - - this._hiddenFields = [oButtonField, oMenuField]; - - } - else if (!oButtonField && oMenuField) { - - this._hiddenFields = oMenuField; - - } - else if (oButtonField && !oMenuField) { - - this._hiddenFields = oButtonField; - - } - - - return this._hiddenFields; - - } - - }, - - - /** - * @method removeHiddenFields - * @description Removes the button's hidden form field(s) from its - * parent form. - */ - removeHiddenFields: function () { - - var oField = this._hiddenFields, - nFields, - i; - - function removeChild(p_oElement) { - - if (Dom.inDocument(p_oElement)) { - - p_oElement.parentNode.removeChild(p_oElement); - - } - - } - - - if (oField) { - - if (Lang.isArray(oField)) { - - nFields = oField.length; - - if (nFields > 0) { - - i = nFields - 1; - - do { - - removeChild(oField[i]); - - } - while (i--); - - } - - } - else { - - removeChild(oField); - - } - - this._hiddenFields = null; - - } - - }, - - - /** - * @method submitForm - * @description Submits the form to which the button belongs. Returns - * true if the form was submitted successfully, false if the submission - * was cancelled. - * @protected - * @return {Boolean} - */ - submitForm: function () { - - var oForm = this.getForm(), - - oSrcElement = this.get("srcelement"), - - /* - Boolean indicating if the event fired successfully - (was not cancelled by any handlers) - */ - - bSubmitForm = false, - - oEvent; - - - if (oForm) { - - if (this.get("type") == "submit" || - (oSrcElement && oSrcElement.type == "submit")) - { - - m_oSubmitTrigger = this; - - } - - - if (YAHOO.env.ua.ie) { - - bSubmitForm = oForm.fireEvent("onsubmit"); - - } - else { // Gecko, Opera, and Safari - - oEvent = document.createEvent("HTMLEvents"); - oEvent.initEvent("submit", true, true); - - bSubmitForm = oForm.dispatchEvent(oEvent); - - } - - - /* - In IE and Safari, dispatching a "submit" event to a form - WILL cause the form's "submit" event to fire, but WILL NOT - submit the form. Therefore, we need to call the "submit" - method as well. - */ - - if ((YAHOO.env.ua.ie || YAHOO.env.ua.webkit) && bSubmitForm) { - - oForm.submit(); - - } - - } - - return bSubmitForm; - - }, - - - /** - * @method init - * @description The Button class's initialization method. - * @param {String} p_oElement String specifying the id attribute of the - * <input>, <button>, - * <a>, or <span> element to - * be used to create the button. - * @param {HTMLInputElement|HTMLButtonElement| - * HTMLElement} p_oElement Object reference for the - * <input>, <button>, - * <a>, or <span> element to be - * used to create the button. - * @param {Object} p_oElement Object literal specifying a set of - * configuration attributes used to create the button. - * @param {Object} p_oAttributes Optional. Object literal specifying a - * set of configuration attributes used to create the button. - */ - init: function (p_oElement, p_oAttributes) { - - var sNodeName = p_oAttributes.type == "link" ? "A" : "BUTTON", - oSrcElement = p_oAttributes.srcelement, - oButton = p_oElement.getElementsByTagName(sNodeName)[0], - oInput; - - - if (!oButton) { - - oInput = p_oElement.getElementsByTagName("INPUT")[0]; - - - if (oInput) { - - oButton = document.createElement("BUTTON"); - oButton.setAttribute("type", "button"); - - oInput.parentNode.replaceChild(oButton, oInput); - - } - - } - - this._button = oButton; - - - YAHOO.widget.Button.superclass.init.call(this, p_oElement, - p_oAttributes); - - - m_oButtons[this.get("id")] = this; - - - this.addClass(this.CSS_CLASS_NAME); - - this.addClass("yui-" + this.get("type") + "-button"); - - Event.on(this._button, "focus", this._onFocus, null, this); - this.on("mouseover", this._onMouseOver); - this.on("click", this._onClick); - this.on("appendTo", this._onAppendTo); - - - var oContainer = this.get("container"), - oElement = this.get("element"), - bElInDoc = Dom.inDocument(oElement), - oParentNode; - - - if (oContainer) { - - if (oSrcElement && oSrcElement != oElement) { - - oParentNode = oSrcElement.parentNode; - - if (oParentNode) { - - oParentNode.removeChild(oSrcElement); - - } - - } - - if (Lang.isString(oContainer)) { - - Event.onContentReady(oContainer, function () { - - this.appendTo(oContainer); - - }, null, this); - - } - else { - - this.appendTo(oContainer); - - } - - } - else if (!bElInDoc && oSrcElement && oSrcElement != oElement) { - - oParentNode = oSrcElement.parentNode; - - if (oParentNode) { - - this.fireEvent("beforeAppendTo", { - type: "beforeAppendTo", - target: oParentNode - }); - - oParentNode.replaceChild(oElement, oSrcElement); - - this.fireEvent("appendTo", { - type: "appendTo", - target: oParentNode - }); - - } - - } - else if (this.get("type") != "link" && bElInDoc && oSrcElement && - oSrcElement == oElement) { - - this._addListenersToForm(); - - } - - this.logger.log("Initialization completed."); - - }, - - - /** - * @method initAttributes - * @description Initializes all of the configuration attributes used to - * create the button. - * @param {Object} p_oAttributes Object literal specifying a set of - * configuration attributes used to create the button. - */ - initAttributes: function (p_oAttributes) { - - var oAttributes = p_oAttributes || {}; - - YAHOO.widget.Button.superclass.initAttributes.call(this, - oAttributes); - - - /** - * @config type - * @description String specifying the button's type. Possible - * values are: "push," "link," "submit," "reset," "checkbox," - * "radio," "menu," and "split." - * @default "push" - * @type String - */ - this.setAttributeConfig("type", { - - value: (oAttributes.type || "push"), - validator: Lang.isString, - writeOnce: true, - method: this._setType - - }); - - - /** - * @config label - * @description String specifying the button's text label - * or innerHTML. - * @default null - * @type String - */ - this.setAttributeConfig("label", { - - value: oAttributes.label, - validator: Lang.isString, - method: this._setLabel - - }); - - - /** - * @config value - * @description Object specifying the value for the button. - * @default null - * @type Object - */ - this.setAttributeConfig("value", { - - value: oAttributes.value - - }); - - - /** - * @config name - * @description String specifying the name for the button. - * @default null - * @type String - */ - this.setAttributeConfig("name", { - - value: oAttributes.name, - validator: Lang.isString - - }); - - - /** - * @config tabindex - * @description Number specifying the tabindex for the button. - * @default null - * @type Number - */ - this.setAttributeConfig("tabindex", { - - value: oAttributes.tabindex, - validator: Lang.isNumber, - method: this._setTabIndex - - }); - - - /** - * @config title - * @description String specifying the title for the button. - * @default null - * @type String - */ - this.configureAttribute("title", { - - value: oAttributes.title, - validator: Lang.isString, - method: this._setTitle - - }); - - - /** - * @config disabled - * @description Boolean indicating if the button should be disabled. - * (Disabled buttons are dimmed and will not respond to user input - * or fire events. Does not apply to button's of type "link.") - * @default false - * @type Boolean - */ - this.setAttributeConfig("disabled", { - - value: (oAttributes.disabled || false), - validator: Lang.isBoolean, - method: this._setDisabled - - }); - - - /** - * @config href - * @description String specifying the href for the button. Applies - * only to buttons of type "link." - * @type String - */ - this.setAttributeConfig("href", { - - value: oAttributes.href, - validator: Lang.isString, - method: this._setHref - - }); - - - /** - * @config target - * @description String specifying the target for the button. - * Applies only to buttons of type "link." - * @type String - */ - this.setAttributeConfig("target", { - - value: oAttributes.target, - validator: Lang.isString, - method: this._setTarget - - }); - - - /** - * @config checked - * @description Boolean indicating if the button is checked. - * Applies only to buttons of type "radio" and "checkbox." - * @default false - * @type Boolean - */ - this.setAttributeConfig("checked", { - - value: (oAttributes.checked || false), - validator: Lang.isBoolean, - method: this._setChecked - - }); - - - /** - * @config container - * @description HTML element reference or string specifying the id - * attribute of the HTML element that the button's markup should be - * rendered into. - * @type HTMLElement|String - * @default null - */ - this.setAttributeConfig("container", { - - value: oAttributes.container, - writeOnce: true - - }); - - - /** - * @config srcelement - * @description Object reference to the HTML element (either - * <input> or <span>) - * used to create the button. - * @type HTMLElement|String - * @default null - */ - this.setAttributeConfig("srcelement", { - - value: oAttributes.srcelement, - writeOnce: true - - }); - - - /** - * @config menu - * @description Object specifying the menu for the button. - * The value can be one of the following: - *
    - *
  • Object specifying a - * YAHOO.widget.Menu instance.
  • - *
  • Object specifying a - * YAHOO.widget.Overlay instance.
  • - *
  • String specifying the id attribute of the <div> - * element used to create the menu. By default the menu - * will be created as an instance of - * YAHOO.widget.Overlay. - * If the - * default CSS class name for YAHOO.widget.Menu is applied to - * the <div> element, it will be created as an - * instance of YAHOO.widget.Menu - * .
  • String specifying the id attribute of the - * <select> element used to create the menu. - *
  • Object specifying the <div> element - * used to create the menu.
  • - *
  • Object specifying the <select> element - * used to create the menu.
  • - *
  • Array of object literals, each representing a set of - * YAHOO.widget.MenuItem - * configuration attributes.
  • - *
  • Array of strings representing the text labels for each menu - * item in the menu.
  • - *
- * @type YAHOO.widget.Menu|YAHOO.widget.Overlay|HTMLElement|String|Array - * @default null - */ - this.setAttributeConfig("menu", { - - value: null, - method: this._setMenu, - writeOnce: true - - }); - - - /** - * @config lazyloadmenu - * @description Boolean indicating the value to set for the - * "lazyload" - * configuration property of the button's menu. Setting - * "lazyloadmenu" to true will defer rendering of - * the button's menu until the first time it is made visible. - * If "lazyloadmenu" is set to false, the button's - * menu will be rendered immediately if the button is in the - * document, or in response to the button's "appendTo" event if - * the button is not yet in the document. In either case, the - * menu is rendered into the button's parent HTML element. - * This attribute does not apply if a - * YAHOO.widget.Menu or - * YAHOO.widget.Overlay - * instance is passed as the value of the button's "menu" - * configuration attribute. - * YAHOO.widget.Menu or - * YAHOO.widget.Overlay instances should be rendered before - * being set as the value for the "menu" configuration - * attribute. - * @default true - * @type Boolean - */ - this.setAttributeConfig("lazyloadmenu", { - - value: (oAttributes.lazyloadmenu === false ? false : true), - validator: Lang.isBoolean, - writeOnce: true - - }); - - - /** - * @config menuclassname - * @description String representing the CSS class name to be - * applied to the root element of the button's menu. - * @type String - * @default "yui-button-menu" - */ - this.setAttributeConfig("menuclassname", { - - value: (oAttributes.menuclassname || "yui-button-menu"), - validator: Lang.isString, - method: this._setMenuClassName, - writeOnce: true - - }); - - - /** - * @config selectedMenuItem - * @description Number representing the index of the item in the - * button's menu that is currently selected. - * @type Number - * @default null - */ - this.setAttributeConfig("selectedMenuItem", { - - value: 0, - validator: Lang.isNumber, - method: this._setSelectedMenuItem - - }); - - - /** - * @config onclick - * @description Object literal representing the code to be executed - * when the button is clicked. Format:
{
- * fn: Function, // The handler to call - * when the event fires.
obj: Object, - * // An object to pass back to the handler.
- * scope: Object // The object to use - * for the scope of the handler.
}
- * @type Object - * @default null - */ - this.setAttributeConfig("onclick", { - - value: oAttributes.onclick, - method: this._setOnClick - - }); - - - /** - * @config focusmenu - * @description Boolean indicating whether or not the button's menu - * should be focused when it is made visible. - * @type Boolean - * @default true - */ - this.setAttributeConfig("focusmenu", { - - value: (oAttributes.focusmenu === false ? false : true), - validator: Lang.isBoolean - - }); - - }, - - - /** - * @method focus - * @description Causes the button to receive the focus and fires the - * button's "focus" event. - */ - focus: function () { - - if (!this.get("disabled")) { - - this._button.focus(); - - } - - }, - - - /** - * @method blur - * @description Causes the button to lose focus and fires the button's - * "blur" event. - */ - blur: function () { - - if (!this.get("disabled")) { - - this._button.blur(); - - } - - }, - - - /** - * @method hasFocus - * @description Returns a boolean indicating whether or not the button - * has focus. - * @return {Boolean} - */ - hasFocus: function () { - - return (m_oFocusedButton == this); - - }, - - - /** - * @method isActive - * @description Returns a boolean indicating whether or not the button - * is active. - * @return {Boolean} - */ - isActive: function () { - - return this.hasClass(this.CSS_CLASS_NAME + "-active"); - - }, - - - /** - * @method getMenu - * @description Returns a reference to the button's menu. - * @return { - * YAHOO.widget.Overlay|YAHOO.widget.Menu} - */ - getMenu: function () { - - return this._menu; - - }, - - - /** - * @method getForm - * @description Returns a reference to the button's parent form. - * @return {HTMLFormElement} - */ - getForm: function () { - - return this._button.form; - - }, - - - /** - * @method getHiddenFields - * @description Returns an <input> element or - * array of form elements used to represent the button when its parent - * form is submitted. - * @return {HTMLInputElement|Array} - */ - getHiddenFields: function () { - - return this._hiddenFields; - - }, - - - /** - * @method destroy - * @description Removes the button's element from its parent element and - * removes all event handlers. - */ - destroy: function () { - - this.logger.log("Destroying ..."); - - var oElement = this.get("element"), - oParentNode = oElement.parentNode, - oMenu = this._menu; - - if (oMenu) { - - this.logger.log("Destroying menu."); - - oMenu.destroy(); - - } - - this.logger.log("Removing DOM event handlers."); - - Event.purgeElement(oElement); - Event.purgeElement(this._button); - Event.removeListener(document, "mouseup", this._onDocumentMouseUp); - Event.removeListener(document, "keyup", this._onDocumentKeyUp); - Event.removeListener(document, "mousedown", - this._onDocumentMouseDown); - - - var oForm = this.getForm(); - - if (oForm) { - - Event.removeListener(oForm, "reset", this._onFormReset); - Event.removeListener(oForm, "submit", this.createHiddenFields); - - } - - - oParentNode.removeChild(oElement); - - this.logger.log("Removing from document."); - - delete m_oButtons[this.get("id")]; - - this.logger.log("Destroyed."); - - }, - - - fireEvent: function (p_sType , p_aArgs) { - - // Disabled buttons should not respond to DOM events - - if (this.DOM_EVENTS[p_sType] && this.get("disabled")) { - - return; - - } - - YAHOO.widget.Button.superclass.fireEvent.call(this, p_sType, - p_aArgs); - - }, - - - /** - * @method toString - * @description Returns a string representing the button. - * @return {String} - */ - toString: function () { - - return ("Button " + this.get("id")); - - } - - }); - - - /** - * @method YAHOO.widget.Button.onFormKeyPress - * @description "keypress" event handler for the button's form. - * @param {Event} p_oEvent Object representing the DOM event object passed - * back by the event utility (YAHOO.util.Event). - */ - YAHOO.widget.Button.onFormKeyPress = function (p_oEvent) { - - var oTarget = Event.getTarget(p_oEvent), - nCharCode = Event.getCharCode(p_oEvent), - sNodeName = oTarget.nodeName && oTarget.nodeName.toUpperCase(), - sType = oTarget.type, - - /* - Boolean indicating if the form contains any enabled or - disabled YUI submit buttons - */ - - bFormContainsYUIButtons = false, - - oButton, - - oYUISubmitButton, // The form's first, enabled YUI submit button - - /* - The form's first, enabled HTML submit button that precedes any - YUI submit button - */ - - oPrecedingSubmitButton, - - - /* - The form's first, enabled HTML submit button that follows a - YUI button - */ - - oFollowingSubmitButton; - - - function isSubmitButton(p_oElement) { - - var sId, - oSrcElement; - - switch (p_oElement.nodeName.toUpperCase()) { - - case "INPUT": - case "BUTTON": - - if (p_oElement.type == "submit" && !p_oElement.disabled) { - - if (!bFormContainsYUIButtons && - !oPrecedingSubmitButton) { - - oPrecedingSubmitButton = p_oElement; - - } - - if (oYUISubmitButton && !oFollowingSubmitButton) { - - oFollowingSubmitButton = p_oElement; - - } - - } - - break; - - - default: - - sId = p_oElement.id; - - if (sId) { - - oButton = m_oButtons[sId]; - - if (oButton) { - - bFormContainsYUIButtons = true; - - if (!oButton.get("disabled")) { - - oSrcElement = oButton.get("srcelement"); - - if (!oYUISubmitButton && - (oButton.get("type") == "submit" || - (oSrcElement && oSrcElement.type == "submit"))) - { - - oYUISubmitButton = oButton; - - } - - } - - } - - } - - break; - - } - - } - - - if (nCharCode == 13 && ((sNodeName == "INPUT" && (sType == "text" || - sType == "password" || sType == "checkbox" || sType == "radio" || - sType == "file") ) || sNodeName == "SELECT")) - { - - Dom.getElementsBy(isSubmitButton, "*", this); - - - if (oPrecedingSubmitButton) { - - /* - Need to set focus to the first enabled submit button - to make sure that IE includes its name and value - in the form's data set. - */ - - oPrecedingSubmitButton.focus(); - - } - else if (!oPrecedingSubmitButton && oYUISubmitButton) { - - if (oFollowingSubmitButton) { - - /* - Need to call "preventDefault" to ensure that - the name and value of the regular submit button - following the YUI button doesn't get added to the - form's data set when it is submitted. - */ - - Event.preventDefault(p_oEvent); - - } - - oYUISubmitButton.submitForm(); - - } - - } - - }; - - - /** - * @method addHiddenFieldsToForm - * @description Searches the specified form and adds hidden fields for - * instances of YAHOO.widget.Button that are of type "radio," "checkbox," - * "menu," and "split." - * @param {HTMLFormElement} p_oForm Object reference - * for the form to search. - */ - YAHOO.widget.Button.addHiddenFieldsToForm = function (p_oForm) { - - var aButtons = Dom.getElementsByClassName( - YAHOO.widget.Button.prototype.CSS_CLASS_NAME, - "*", - p_oForm), - - nButtons = aButtons.length, - oButton, - sId, - i; - - if (nButtons > 0) { - - YAHOO.log("Form contains " + nButtons + " YUI buttons."); - - for (i = 0; i < nButtons; i++) { - - sId = aButtons[i].id; - - if (sId) { - - oButton = m_oButtons[sId]; - - if (oButton) { - - oButton.createHiddenFields(); - - } - - } - - } - - } - - }; - - - - // Events - - - /** - * @event focus - * @description Fires when the menu item receives focus. Passes back a - * single object representing the original DOM event object passed back by - * the event utility (YAHOO.util.Event) when the event was fired. See - * Element.addListener - * for more information on listening for this event. - * @type YAHOO.util.CustomEvent - */ - - - /** - * @event blur - * @description Fires when the menu item loses the input focus. Passes back - * a single object representing the original DOM event object passed back by - * the event utility (YAHOO.util.Event) when the event was fired. See - * Element.addListener for - * more information on listening for this event. - * @type YAHOO.util.CustomEvent - */ - - - /** - * @event option - * @description Fires when the user invokes the button's option. Passes - * back a single object representing the original DOM event (either - * "mousedown" or "keydown") that caused the "option" event to fire. See - * Element.addListener - * for more information on listening for this event. - * @type YAHOO.util.CustomEvent - */ - -})(); -(function () { - - // Shorthard for utilities - - var Dom = YAHOO.util.Dom, - Event = YAHOO.util.Event, - Lang = YAHOO.lang, - Button = YAHOO.widget.Button, - - // Private collection of radio buttons - - m_oButtons = {}; - - - - /** - * The ButtonGroup class creates a set of buttons that are mutually - * exclusive; checking one button in the set will uncheck all others in the - * button group. - * @param {String} p_oElement String specifying the id attribute of the - * <div> element of the button group. - * @param {HTMLDivElement} p_oElement Object - * specifying the <div> element of the button group. - * @param {Object} p_oElement Object literal specifying a set of - * configuration attributes used to create the button group. - * @param {Object} p_oAttributes Optional. Object literal specifying a set - * of configuration attributes used to create the button group. - * @namespace YAHOO.widget - * @class ButtonGroup - * @constructor - * @extends YAHOO.util.Element - */ - YAHOO.widget.ButtonGroup = function (p_oElement, p_oAttributes) { - - var fnSuperClass = YAHOO.widget.ButtonGroup.superclass.constructor, - sNodeName, - oElement, - sId; - - if (arguments.length == 1 && !Lang.isString(p_oElement) && - !p_oElement.nodeName) { - - if (!p_oElement.id) { - - sId = Dom.generateId(); - - p_oElement.id = sId; - - YAHOO.log("No value specified for the button group's \"id\"" + - " attribute. Setting button group id to \"" + sId + "\".", - "warn"); - - } - - this.logger = new YAHOO.widget.LogWriter("ButtonGroup " + sId); - - this.logger.log("No source HTML element. Building the button " + - "group using the set of configuration attributes."); - - fnSuperClass.call(this, (this._createGroupElement()), p_oElement); - - } - else if (Lang.isString(p_oElement)) { - - oElement = Dom.get(p_oElement); - - if (oElement) { - - if (oElement.nodeName.toUpperCase() == this.NODE_NAME) { - - this.logger = - new YAHOO.widget.LogWriter("ButtonGroup " + p_oElement); - - fnSuperClass.call(this, oElement, p_oAttributes); - - } - - } - - } - else { - - sNodeName = p_oElement.nodeName; - - if (sNodeName && sNodeName == this.NODE_NAME) { - - if (!p_oElement.id) { - - p_oElement.id = Dom.generateId(); - - YAHOO.log("No value specified for the button group's" + - " \"id\" attribute. Setting button group id " + - "to \"" + p_oElement.id + "\".", "warn"); - - } - - this.logger = - new YAHOO.widget.LogWriter("ButtonGroup " + p_oElement.id); - - fnSuperClass.call(this, p_oElement, p_oAttributes); - - } - - } - - }; - - - YAHOO.extend(YAHOO.widget.ButtonGroup, YAHOO.util.Element, { - - - // Protected properties - - - /** - * @property _buttons - * @description Array of buttons in the button group. - * @default null - * @protected - * @type Array - */ - _buttons: null, - - - - // Constants - - - /** - * @property NODE_NAME - * @description The name of the tag to be used for the button - * group's element. - * @default "DIV" - * @final - * @type String - */ - NODE_NAME: "DIV", - - - /** - * @property CSS_CLASS_NAME - * @description String representing the CSS class(es) to be applied - * to the button group's element. - * @default "yui-buttongroup" - * @final - * @type String - */ - CSS_CLASS_NAME: "yui-buttongroup", - - - - // Protected methods - - - /** - * @method _createGroupElement - * @description Creates the button group's element. - * @protected - * @return {HTMLDivElement} - */ - _createGroupElement: function () { - - var oElement = document.createElement(this.NODE_NAME); - - return oElement; - - }, - - - - // Protected attribute setter methods - - - /** - * @method _setDisabled - * @description Sets the value of the button groups's - * "disabled" attribute. - * @protected - * @param {Boolean} p_bDisabled Boolean indicating the value for - * the button group's "disabled" attribute. - */ - _setDisabled: function (p_bDisabled) { - - var nButtons = this.getCount(), - i; - - if (nButtons > 0) { - - i = nButtons - 1; - - do { - - this._buttons[i].set("disabled", p_bDisabled); - - } - while (i--); - - } - - }, - - - - // Protected event handlers - - - /** - * @method _onKeyDown - * @description "keydown" event handler for the button group. - * @protected - * @param {Event} p_oEvent Object representing the DOM event object - * passed back by the event utility (YAHOO.util.Event). - */ - _onKeyDown: function (p_oEvent) { - - var oTarget = Event.getTarget(p_oEvent), - nCharCode = Event.getCharCode(p_oEvent), - sId = oTarget.parentNode.parentNode.id, - oButton = m_oButtons[sId], - nIndex = -1; - - - if (nCharCode == 37 || nCharCode == 38) { - - nIndex = (oButton.index === 0) ? - (this._buttons.length - 1) : (oButton.index - 1); - - } - else if (nCharCode == 39 || nCharCode == 40) { - - nIndex = (oButton.index === (this._buttons.length - 1)) ? - 0 : (oButton.index + 1); - - } - - - if (nIndex > -1) { - - this.check(nIndex); - this.getButton(nIndex).focus(); - - } - - }, - - - /** - * @method _onAppendTo - * @description "appendTo" event handler for the button group. - * @protected - * @param {Event} p_oEvent Object representing the event that was fired. - */ - _onAppendTo: function (p_oEvent) { - - var aButtons = this._buttons, - nButtons = aButtons.length, - i; - - for (i = 0; i < nButtons; i++) { - - aButtons[i].appendTo(this.get("element")); - - } - - }, - - - /** - * @method _onButtonCheckedChange - * @description "checkedChange" event handler for each button in the - * button group. - * @protected - * @param {Event} p_oEvent Object representing the event that was fired. - * @param {YAHOO.widget.Button} - * p_oButton Object representing the button that fired the event. - */ - _onButtonCheckedChange: function (p_oEvent, p_oButton) { - - var bChecked = p_oEvent.newValue, - oCheckedButton = this.get("checkedButton"); - - if (bChecked && oCheckedButton != p_oButton) { - - if (oCheckedButton) { - - oCheckedButton.set("checked", false, true); - - } - - this.set("checkedButton", p_oButton); - this.set("value", p_oButton.get("value")); - - } - else if (oCheckedButton && !oCheckedButton.set("checked")) { - - oCheckedButton.set("checked", true, true); - - } - - }, - - - - // Public methods - - - /** - * @method init - * @description The ButtonGroup class's initialization method. - * @param {String} p_oElement String specifying the id attribute of the - * <div> element of the button group. - * @param {HTMLDivElement} p_oElement Object - * specifying the <div> element of the button group. - * @param {Object} p_oElement Object literal specifying a set of - * configuration attributes used to create the button group. - * @param {Object} p_oAttributes Optional. Object literal specifying a - * set of configuration attributes used to create the button group. - */ - init: function (p_oElement, p_oAttributes) { - - this._buttons = []; - - YAHOO.widget.ButtonGroup.superclass.init.call(this, p_oElement, - p_oAttributes); - - this.addClass(this.CSS_CLASS_NAME); - - this.logger.log("Searching for child nodes with the class name " + - "\"yui-radio-button\" to add to the button group."); - - var aButtons = this.getElementsByClassName("yui-radio-button"); - - - if (aButtons.length > 0) { - - this.logger.log("Found " + aButtons.length + - " child nodes with the class name \"yui-radio-button.\"" + - " Attempting to add to button group."); - - this.addButtons(aButtons); - - } - - - this.logger.log("Searching for child nodes with the type of " + - " \"radio\" to add to the button group."); - - function isRadioButton(p_oElement) { - - return (p_oElement.type == "radio"); - - } - - aButtons = - Dom.getElementsBy(isRadioButton, "input", this.get("element")); - - - if (aButtons.length > 0) { - - this.logger.log("Found " + aButtons.length + " child nodes" + - " with the type of \"radio.\" Attempting to add to" + - " button group."); - - this.addButtons(aButtons); - - } - - this.on("keydown", this._onKeyDown); - this.on("appendTo", this._onAppendTo); - - - var oContainer = this.get("container"); - - if (oContainer) { - - if (Lang.isString(oContainer)) { - - Event.onContentReady(oContainer, function () { - - this.appendTo(oContainer); - - }, null, this); - - } - else { - - this.appendTo(oContainer); - - } - - } - - - this.logger.log("Initialization completed."); - - }, - - - /** - * @method initAttributes - * @description Initializes all of the configuration attributes used to - * create the button group. - * @param {Object} p_oAttributes Object literal specifying a set of - * configuration attributes used to create the button group. - */ - initAttributes: function (p_oAttributes) { - - var oAttributes = p_oAttributes || {}; - - YAHOO.widget.ButtonGroup.superclass.initAttributes.call( - this, oAttributes); - - - /** - * @config name - * @description String specifying the name for the button group. - * This name will be applied to each button in the button group. - * @default null - * @type String - */ - this.setAttributeConfig("name", { - - value: oAttributes.name, - validator: Lang.isString - - }); - - - /** - * @config disabled - * @description Boolean indicating if the button group should be - * disabled. Disabling the button group will disable each button - * in the button group. Disabled buttons are dimmed and will not - * respond to user input or fire events. - * @default false - * @type Boolean - */ - this.setAttributeConfig("disabled", { - - value: (oAttributes.disabled || false), - validator: Lang.isBoolean, - method: this._setDisabled - - }); - - - /** - * @config value - * @description Object specifying the value for the button group. - * @default null - * @type Object - */ - this.setAttributeConfig("value", { - - value: oAttributes.value - - }); - - - /** - * @config container - * @description HTML element reference or string specifying the id - * attribute of the HTML element that the button group's markup - * should be rendered into. - * @type HTMLElement|String - * @default null - */ - this.setAttributeConfig("container", { - - value: oAttributes.container, - writeOnce: true - - }); - - - /** - * @config checkedButton - * @description Reference for the button in the button group that - * is checked. - * @type {YAHOO.widget.Button} - * @default null - */ - this.setAttributeConfig("checkedButton", { - - value: null - - }); - - }, - - - /** - * @method addButton - * @description Adds the button to the button group. - * @param {YAHOO.widget.Button} - * p_oButton Object reference for the - * YAHOO.widget.Button instance to be added to the button group. - * @param {String} p_oButton String specifying the id attribute of the - * <input> or <span> element - * to be used to create the button to be added to the button group. - * @param {HTMLInputElement|HTMLElement} p_oButton Object reference for the - * <input> or <span> element - * to be used to create the button to be added to the button group. - * @param {Object} p_oButton Object literal specifying a set of - * YAHOO.widget.Button - * configuration attributes used to configure the button to be added to - * the button group. - * @return {YAHOO.widget.Button} - */ - addButton: function (p_oButton) { - - var oButton, - oButtonElement, - oGroupElement, - nIndex, - sButtonName, - sGroupName; - - - if (p_oButton instanceof Button && - p_oButton.get("type") == "radio") { - - oButton = p_oButton; - - } - else if (!Lang.isString(p_oButton) && !p_oButton.nodeName) { - - p_oButton.type = "radio"; - - oButton = new Button(p_oButton); - - } - else { - - oButton = new Button(p_oButton, { type: "radio" }); - - } - - - if (oButton) { - - nIndex = this._buttons.length; - sButtonName = oButton.get("name"); - sGroupName = this.get("name"); - - oButton.index = nIndex; - - this._buttons[nIndex] = oButton; - m_oButtons[oButton.get("id")] = oButton; - - - if (sButtonName != sGroupName) { - - oButton.set("name", sGroupName); - - } - - - if (this.get("disabled")) { - - oButton.set("disabled", true); - - } - - - if (oButton.get("checked")) { - - this.set("checkedButton", oButton); - - } - - - oButtonElement = oButton.get("element"); - oGroupElement = this.get("element"); - - if (oButtonElement.parentNode != oGroupElement) { - - oGroupElement.appendChild(oButtonElement); - - } - - - oButton.on("checkedChange", - this._onButtonCheckedChange, oButton, this); - - this.logger.log("Button " + oButton.get("id") + " added."); - - return oButton; - - } - - }, - - - /** - * @method addButtons - * @description Adds the array of buttons to the button group. - * @param {Array} p_aButtons Array of - * YAHOO.widget.Button instances to be added - * to the button group. - * @param {Array} p_aButtons Array of strings specifying the id - * attribute of the <input> or <span> - * elements to be used to create the buttons to be added to the - * button group. - * @param {Array} p_aButtons Array of object references for the - * <input> or <span> elements - * to be used to create the buttons to be added to the button group. - * @param {Array} p_aButtons Array of object literals, each containing - * a set of YAHOO.widget.Button - * configuration attributes used to configure each button to be added - * to the button group. - * @return {Array} - */ - addButtons: function (p_aButtons) { - - var nButtons, - oButton, - aButtons, - i; - - if (Lang.isArray(p_aButtons)) { - - nButtons = p_aButtons.length; - aButtons = []; - - if (nButtons > 0) { - - for (i = 0; i < nButtons; i++) { - - oButton = this.addButton(p_aButtons[i]); - - if (oButton) { - - aButtons[aButtons.length] = oButton; - - } - - } - - if (aButtons.length > 0) { - - this.logger.log(aButtons.length + " buttons added."); - - return aButtons; - - } - - } - - } - - }, - - - /** - * @method removeButton - * @description Removes the button at the specified index from the - * button group. - * @param {Number} p_nIndex Number specifying the index of the button - * to be removed from the button group. - */ - removeButton: function (p_nIndex) { - - var oButton = this.getButton(p_nIndex), - nButtons, - i; - - if (oButton) { - - this.logger.log("Removing button " + oButton.get("id") + "."); - - this._buttons.splice(p_nIndex, 1); - delete m_oButtons[oButton.get("id")]; - - oButton.removeListener("checkedChange", - this._onButtonCheckedChange); - - oButton.destroy(); - - - nButtons = this._buttons.length; - - if (nButtons > 0) { - - i = this._buttons.length - 1; - - do { - - this._buttons[i].index = i; - - } - while (i--); - - } - - this.logger.log("Button " + oButton.get("id") + " removed."); - - } - - }, - - - /** - * @method getButton - * @description Returns the button at the specified index. - * @param {Number} p_nIndex The index of the button to retrieve from the - * button group. - * @return {YAHOO.widget.Button} - */ - getButton: function (p_nIndex) { - - if (Lang.isNumber(p_nIndex)) { - - return this._buttons[p_nIndex]; - - } - - }, - - - /** - * @method getButtons - * @description Returns an array of the buttons in the button group. - * @return {Array} - */ - getButtons: function () { - - return this._buttons; - - }, - - - /** - * @method getCount - * @description Returns the number of buttons in the button group. - * @return {Number} - */ - getCount: function () { - - return this._buttons.length; - - }, - - - /** - * @method focus - * @description Sets focus to the button at the specified index. - * @param {Number} p_nIndex Number indicating the index of the button - * to focus. - */ - focus: function (p_nIndex) { - - var oButton, - nButtons, - i; - - if (Lang.isNumber(p_nIndex)) { - - oButton = this._buttons[p_nIndex]; - - if (oButton) { - - oButton.focus(); - - } - - } - else { - - nButtons = this.getCount(); - - for (i = 0; i < nButtons; i++) { - - oButton = this._buttons[i]; - - if (!oButton.get("disabled")) { - - oButton.focus(); - break; - - } - - } - - } - - }, - - - /** - * @method check - * @description Checks the button at the specified index. - * @param {Number} p_nIndex Number indicating the index of the button - * to check. - */ - check: function (p_nIndex) { - - var oButton = this.getButton(p_nIndex); - - if (oButton) { - - oButton.set("checked", true); - - } - - }, - - - /** - * @method destroy - * @description Removes the button group's element from its parent - * element and removes all event handlers. - */ - destroy: function () { - - this.logger.log("Destroying..."); - - var nButtons = this._buttons.length, - oElement = this.get("element"), - oParentNode = oElement.parentNode, - i; - - if (nButtons > 0) { - - i = this._buttons.length - 1; - - do { - - this._buttons[i].destroy(); - - } - while (i--); - - } - - this.logger.log("Removing DOM event handlers."); - - Event.purgeElement(oElement); - - this.logger.log("Removing from document."); - - oParentNode.removeChild(oElement); - - }, - - - /** - * @method toString - * @description Returns a string representing the button group. - * @return {String} - */ - toString: function () { - - return ("ButtonGroup " + this.get("id")); - - } - - }); - -})(); -YAHOO.register("button", YAHOO.widget.Button, {version: "2.3.0", build: "442"}); diff --git a/lib/yui/button/button-beta-min.js b/lib/yui/button/button-beta-min.js deleted file mode 100755 index be19b02b34a48..0000000000000 --- a/lib/yui/button/button-beta-min.js +++ /dev/null @@ -1,162 +0,0 @@ -/* -Copyright (c) 2007, Yahoo! Inc. All rights reserved. -Code licensed under the BSD License: -http://developer.yahoo.net/yui/license.txt -version: 2.3.0 -*/ - -(function(){var Dom=YAHOO.util.Dom,Event=YAHOO.util.Event,Lang=YAHOO.lang,Overlay=YAHOO.widget.Overlay,Menu=YAHOO.widget.Menu,m_oButtons={},m_oOverlayManager=null,m_oSubmitTrigger=null,m_oFocusedButton=null;function createInputElement(p_sType,p_sName,p_sValue,p_bChecked){var oInput,sInput;if(Lang.isString(p_sType)&&Lang.isString(p_sName)){if(YAHOO.env.ua.ie){sInput="0){p_oAttributes.label=sText;}}} -function initConfig(p_oConfig){var oAttributes=p_oConfig.attributes,oSrcElement=oAttributes.srcelement,sSrcElementNodeName=oSrcElement.nodeName.toUpperCase(),me=this;if(sSrcElementNodeName==this.NODE_NAME){p_oConfig.element=oSrcElement;p_oConfig.id=oSrcElement.id;Dom.getElementsBy(function(p_oElement){switch(p_oElement.nodeName.toUpperCase()){case"BUTTON":case"A":case"INPUT":setAttributesFromSrcElement.call(me,p_oElement,oAttributes);break;}},"*",oSrcElement);} -else{switch(sSrcElementNodeName){case"BUTTON":case"A":case"INPUT":setAttributesFromSrcElement.call(this,oSrcElement,oAttributes);break;}}} -YAHOO.widget.Button=function(p_oElement,p_oAttributes){var fnSuperClass=YAHOO.widget.Button.superclass.constructor,oConfig,oElement;if(arguments.length==1&&!Lang.isString(p_oElement)&&!p_oElement.nodeName){if(!p_oElement.id){p_oElement.id=Dom.generateId();} -fnSuperClass.call(this,(this.createButtonElement(p_oElement.type)),p_oElement);} -else{oConfig={element:null,attributes:(p_oAttributes||{})};if(Lang.isString(p_oElement)){oElement=Dom.get(p_oElement);if(oElement){if(!oConfig.attributes.id){oConfig.attributes.id=p_oElement;} -oConfig.attributes.srcelement=oElement;initConfig.call(this,oConfig);if(!oConfig.element){oConfig.element=this.createButtonElement(oConfig.attributes.type);} -fnSuperClass.call(this,oConfig.element,oConfig.attributes);}} -else if(p_oElement.nodeName){if(!oConfig.attributes.id){if(p_oElement.id){oConfig.attributes.id=p_oElement.id;} -else{oConfig.attributes.id=Dom.generateId();}} -oConfig.attributes.srcelement=p_oElement;initConfig.call(this,oConfig);if(!oConfig.element){oConfig.element=this.createButtonElement(oConfig.attributes.type);} -fnSuperClass.call(this,oConfig.element,oConfig.attributes);}}};YAHOO.extend(YAHOO.widget.Button,YAHOO.util.Element,{_button:null,_menu:null,_hiddenFields:null,_onclickAttributeValue:null,_activationKeyPressed:false,_activationButtonPressed:false,_hasKeyEventHandlers:false,_hasMouseEventHandlers:false,NODE_NAME:"SPAN",CHECK_ACTIVATION_KEYS:[32],ACTIVATION_KEYS:[13,32],OPTION_AREA_WIDTH:20,CSS_CLASS_NAME:"yui-button",RADIO_DEFAULT_TITLE:"Unchecked. Click to check.",RADIO_CHECKED_TITLE:"Checked. Click to uncheck.",CHECKBOX_DEFAULT_TITLE:"Unchecked. Click to check.",CHECKBOX_CHECKED_TITLE:"Checked. Click to uncheck.",MENUBUTTON_DEFAULT_TITLE:"Menu collapsed. Click to expand.",MENUBUTTON_MENU_VISIBLE_TITLE:"Menu expanded. Click or press Esc to collapse.",SPLITBUTTON_DEFAULT_TITLE:("Menu collapsed. Click inside option "+"region or press Ctrl + Shift + M to show the menu."),SPLITBUTTON_OPTION_VISIBLE_TITLE:"Menu expanded. Press Esc or Ctrl + Shift + M to hide the menu.",SUBMIT_TITLE:"Click to submit form.",_setType:function(p_sType){if(p_sType=="split"){this.on("option",this._onOption);}},_setLabel:function(p_sLabel){this._button.innerHTML=p_sLabel;},_setTabIndex:function(p_nTabIndex){this._button.tabIndex=p_nTabIndex;},_setTitle:function(p_sTitle){var sTitle=p_sTitle;if(this.get("type")!="link"){if(!sTitle){switch(this.get("type")){case"radio":sTitle=this.RADIO_DEFAULT_TITLE;break;case"checkbox":sTitle=this.CHECKBOX_DEFAULT_TITLE;break;case"menu":sTitle=this.MENUBUTTON_DEFAULT_TITLE;break;case"split":sTitle=this.SPLITBUTTON_DEFAULT_TITLE;break;case"submit":sTitle=this.SUBMIT_TITLE;break;}} -this._button.title=sTitle;}},_setDisabled:function(p_bDisabled){if(this.get("type")!="link"){if(p_bDisabled){if(this._menu){this._menu.hide();} -if(this.hasFocus()){this.blur();} -this._button.setAttribute("disabled","disabled");this.addStateCSSClasses("disabled");} -else{this._button.removeAttribute("disabled");this.removeStateCSSClasses("disabled");}}},_setHref:function(p_sHref){if(this.get("type")=="link"){this._button.href=p_sHref;}},_setTarget:function(p_sTarget){if(this.get("type")=="link"){this._button.setAttribute("target",p_sTarget);}},_setChecked:function(p_bChecked){var sType=this.get("type"),sTitle;if(sType=="checkbox"||sType=="radio"){if(p_bChecked){this.addStateCSSClasses("checked");sTitle=(sType=="radio")?this.RADIO_CHECKED_TITLE:this.CHECKBOX_CHECKED_TITLE;} -else{this.removeStateCSSClasses("checked");sTitle=(sType=="radio")?this.RADIO_DEFAULT_TITLE:this.CHECKBOX_DEFAULT_TITLE;} -this.set("title",sTitle);}},_setMenu:function(p_oMenu){var bLazyLoad=this.get("lazyloadmenu"),oButtonElement=this.get("element"),bInstance=false,oMenu,oMenuElement,oSrcElement,aItems,nItems,oItem,i;if(!Overlay){return false;} -if(!Menu){return false;} -function onAppendTo(){oMenu.render(oButtonElement.parentNode);this.removeListener("appendTo",onAppendTo);} -function initMenu(){if(oMenu){Dom.addClass(oMenu.element,this.get("menuclassname"));Dom.addClass(oMenu.element,"yui-"+this.get("type")+"-button-menu");oMenu.showEvent.subscribe(this._onMenuShow,null,this);oMenu.hideEvent.subscribe(this._onMenuHide,null,this);oMenu.renderEvent.subscribe(this._onMenuRender,null,this);if(oMenu instanceof Menu){oMenu.keyDownEvent.subscribe(this._onMenuKeyDown,this,true);oMenu.clickEvent.subscribe(this._onMenuClick,this,true);oMenu.itemAddedEvent.subscribe(this._onMenuItemAdded,this,true);oSrcElement=oMenu.srcElement;if(oSrcElement&&oSrcElement.nodeName.toUpperCase()=="SELECT"){oSrcElement.style.display="none";oSrcElement.parentNode.removeChild(oSrcElement);}} -else if(oMenu instanceof Overlay){if(!m_oOverlayManager){m_oOverlayManager=new YAHOO.widget.OverlayManager();} -m_oOverlayManager.register(oMenu);} -this._menu=oMenu;if(!bInstance){if(bLazyLoad&&!(oMenu instanceof Menu)){oMenu.beforeShowEvent.subscribe(this._onOverlayBeforeShow,null,this);} -else if(!bLazyLoad){if(Dom.inDocument(oButtonElement)){oMenu.render(oButtonElement.parentNode);} -else{this.on("appendTo",onAppendTo);}}}}} -if(p_oMenu&&(p_oMenu instanceof Menu)){oMenu=p_oMenu;aItems=oMenu.getItems();nItems=aItems.length;bInstance=true;if(nItems>0){i=nItems-1;do{oItem=aItems[i];if(oItem){oItem.cfg.subscribeToConfigEvent("selected",this._onMenuItemSelected,oItem,this);}} -while(i--);} -initMenu.call(this);} -else if(p_oMenu&&(p_oMenu instanceof Overlay)){oMenu=p_oMenu;bInstance=true;oMenu.cfg.setProperty("visible",false);oMenu.cfg.setProperty("context",[oButtonElement,"tl","bl"]);initMenu.call(this);} -else if(Lang.isArray(p_oMenu)){this.on("appendTo",function(){oMenu=new Menu(Dom.generateId(),{lazyload:bLazyLoad,itemdata:p_oMenu});initMenu.call(this);});} -else if(Lang.isString(p_oMenu)){oMenuElement=Dom.get(p_oMenu);if(oMenuElement){if(Dom.hasClass(oMenuElement,Menu.prototype.CSS_CLASS_NAME)||oMenuElement.nodeName=="SELECT"){oMenu=new Menu(p_oMenu,{lazyload:bLazyLoad});initMenu.call(this);} -else{oMenu=new Overlay(p_oMenu,{visible:false,context:[oButtonElement,"tl","bl"]});initMenu.call(this);}}} -else if(p_oMenu&&p_oMenu.nodeName){if(Dom.hasClass(p_oMenu,Menu.prototype.CSS_CLASS_NAME)||p_oMenu.nodeName=="SELECT"){oMenu=new Menu(p_oMenu,{lazyload:bLazyLoad});initMenu.call(this);} -else{if(!p_oMenu.id){Dom.generateId(p_oMenu);} -oMenu=new Overlay(p_oMenu,{visible:false,context:[oButtonElement,"tl","bl"]});initMenu.call(this);}}},_setOnClick:function(p_oObject){if(this._onclickAttributeValue&&(this._onclickAttributeValue!=p_oObject)){this.removeListener("click",this._onclickAttributeValue.fn);this._onclickAttributeValue=null;} -if(!this._onclickAttributeValue&&Lang.isObject(p_oObject)&&Lang.isFunction(p_oObject.fn)){this.on("click",p_oObject.fn,p_oObject.obj,p_oObject.scope);this._onclickAttributeValue=p_oObject;}},_setSelectedMenuItem:function(p_nIndex){var oMenu=this._menu,oMenuItem;if(oMenu&&oMenu instanceof Menu){oMenuItem=oMenu.getItem(p_nIndex);if(oMenuItem&&!oMenuItem.cfg.getProperty("selected")){oMenuItem.cfg.setProperty("selected",true);}}},_isActivationKey:function(p_nKeyCode){var sType=this.get("type"),aKeyCodes=(sType=="checkbox"||sType=="radio")?this.CHECK_ACTIVATION_KEYS:this.ACTIVATION_KEYS,nKeyCodes=aKeyCodes.length,i;if(nKeyCodes>0){i=nKeyCodes-1;do{if(p_nKeyCode==aKeyCodes[i]){return true;}} -while(i--);}},_isSplitButtonOptionKey:function(p_oEvent){return(p_oEvent.ctrlKey&&p_oEvent.shiftKey&&Event.getCharCode(p_oEvent)==77);},_addListenersToForm:function(){var oForm=this.getForm(),oSrcElement,aListeners,nListeners,i,bHasKeyPressListener;if(oForm){Event.on(oForm,"reset",this._onFormReset,null,this);Event.on(oForm,"submit",this.createHiddenFields,null,this);oSrcElement=this.get("srcelement");if(this.get("type")=="submit"||(oSrcElement&&oSrcElement.type=="submit")) -{aListeners=Event.getListeners(oForm,"keypress");bHasKeyPressListener=false;if(aListeners){nListeners=aListeners.length;if(nListeners>0){i=nListeners-1;do{if(aListeners[i].fn==YAHOO.widget.Button.onFormKeyPress) -{bHasKeyPressListener=true;break;}} -while(i--);}} -if(!bHasKeyPressListener){Event.on(oForm,"keypress",YAHOO.widget.Button.onFormKeyPress);}}}},_originalMaxHeight:-1,_showMenu:function(p_oEvent){YAHOO.widget.MenuManager.hideVisible();if(m_oOverlayManager){m_oOverlayManager.hideAll();} -var oMenu=this._menu,nViewportHeight=Dom.getViewportHeight(),nMenuHeight,nScrollTop,nY;if(oMenu&&(oMenu instanceof Menu)){oMenu.cfg.applyConfig({context:[this.get("id"),"tl","bl"],constraintoviewport:false,clicktohide:false,visible:true});oMenu.cfg.fireQueue();oMenu.align("tl","bl");if(p_oEvent.type=="mousedown"){Event.stopPropagation(p_oEvent);} -if(this.get("focusmenu")){this._menu.focus();} -nMenuHeight=oMenu.element.offsetHeight;if((oMenu.cfg.getProperty("y")+nMenuHeight)>nViewportHeight){oMenu.align("bl","tl");nY=oMenu.cfg.getProperty("y");nScrollTop=Dom.getDocumentScrollTop();if(nScrollTop>=nY){if(this._originalMaxHeight==-1){this._originalMaxHeight=oMenu.cfg.getProperty("maxheight");} -oMenu.cfg.setProperty("maxheight",(nMenuHeight-((nScrollTop-nY)+20)));oMenu.align("bl","tl");}}} -else if(oMenu&&(oMenu instanceof Overlay)){oMenu.show();oMenu.align("tl","bl");nMenuHeight=oMenu.element.offsetHeight;if((oMenu.cfg.getProperty("y")+nMenuHeight)>nViewportHeight){oMenu.align("bl","tl");}}},_hideMenu:function(){var oMenu=this._menu;if(oMenu){oMenu.hide();}},_onMouseOver:function(p_oEvent){if(!this._hasMouseEventHandlers){this.on("mouseout",this._onMouseOut);this.on("mousedown",this._onMouseDown);this.on("mouseup",this._onMouseUp);this._hasMouseEventHandlers=true;} -this.addStateCSSClasses("hover");if(this._activationButtonPressed){this.addStateCSSClasses("active");} -if(this._bOptionPressed){this.addStateCSSClasses("activeoption");}},_onMouseOut:function(p_oEvent){this.removeStateCSSClasses("hover");if(this.get("type")!="menu"){this.removeStateCSSClasses("active");} -if(this._activationButtonPressed||this._bOptionPressed){Event.on(document,"mouseup",this._onDocumentMouseUp,null,this);}},_onDocumentMouseUp:function(p_oEvent){this._activationButtonPressed=false;this._bOptionPressed=false;var sType=this.get("type");if(sType=="menu"||sType=="split"){this.removeStateCSSClasses((sType=="menu"?"active":"activeoption"));this._hideMenu();} -Event.removeListener(document,"mouseup",this._onDocumentMouseUp);},_onMouseDown:function(p_oEvent){var sType,oElement,nX,me;function onMouseUp(){this._hideMenu();this.removeListener("mouseup",onMouseUp);} -if((p_oEvent.which||p_oEvent.button)==1){if(!this.hasFocus()){this.focus();} -sType=this.get("type");if(sType=="split"){oElement=this.get("element");nX=Event.getPageX(p_oEvent)-Dom.getX(oElement);if((oElement.offsetWidth-this.OPTION_AREA_WIDTH)"+ -(p_sType=="link"?"":"")+"";return oElement;},addStateCSSClasses:function(p_sState){var sType=this.get("type");if(Lang.isString(p_sState)){if(p_sState!="activeoption"){this.addClass(this.CSS_CLASS_NAME+("-"+p_sState));} -this.addClass("yui-"+sType+("-button-"+p_sState));}},removeStateCSSClasses:function(p_sState){var sType=this.get("type");if(Lang.isString(p_sState)){this.removeClass(this.CSS_CLASS_NAME+("-"+p_sState));this.removeClass("yui-"+sType+("-button-"+p_sState));}},createHiddenFields:function(){this.removeHiddenFields();var oForm=this.getForm(),oButtonField,sType,bCheckable,oMenu,oMenuItem,sName,oValue,oMenuField;if(oForm&&!this.get("disabled")){sType=this.get("type");bCheckable=(sType=="checkbox"||sType=="radio");if(bCheckable||(m_oSubmitTrigger==this)){oButtonField=createInputElement((bCheckable?sType:"hidden"),this.get("name"),this.get("value"),this.get("checked"));if(oButtonField){if(bCheckable){oButtonField.style.display="none";} -oForm.appendChild(oButtonField);}} -oMenu=this._menu;if(oMenu&&(oMenu instanceof Menu)){oMenuField=oMenu.srcElement;oMenuItem=oMenu.getItem(this.get("selectedMenuItem"));if(oMenuField&&oMenuField.nodeName.toUpperCase()=="SELECT"){oForm.appendChild(oMenuField);oMenuField.selectedIndex=oMenuItem.index;} -else{oValue=(oMenuItem.value===null||oMenuItem.value==="")?oMenuItem.cfg.getProperty("text"):oMenuItem.value;sName=this.get("name");if(oValue&&sName){oMenuField=createInputElement("hidden",(sName+"_options"),oValue);oForm.appendChild(oMenuField);}}} -if(oButtonField&&oMenuField){this._hiddenFields=[oButtonField,oMenuField];} -else if(!oButtonField&&oMenuField){this._hiddenFields=oMenuField;} -else if(oButtonField&&!oMenuField){this._hiddenFields=oButtonField;} -return this._hiddenFields;}},removeHiddenFields:function(){var oField=this._hiddenFields,nFields,i;function removeChild(p_oElement){if(Dom.inDocument(p_oElement)){p_oElement.parentNode.removeChild(p_oElement);}} -if(oField){if(Lang.isArray(oField)){nFields=oField.length;if(nFields>0){i=nFields-1;do{removeChild(oField[i]);} -while(i--);}} -else{removeChild(oField);} -this._hiddenFields=null;}},submitForm:function(){var oForm=this.getForm(),oSrcElement=this.get("srcelement"),bSubmitForm=false,oEvent;if(oForm){if(this.get("type")=="submit"||(oSrcElement&&oSrcElement.type=="submit")) -{m_oSubmitTrigger=this;} -if(YAHOO.env.ua.ie){bSubmitForm=oForm.fireEvent("onsubmit");} -else{oEvent=document.createEvent("HTMLEvents");oEvent.initEvent("submit",true,true);bSubmitForm=oForm.dispatchEvent(oEvent);} -if((YAHOO.env.ua.ie||YAHOO.env.ua.webkit)&&bSubmitForm){oForm.submit();}} -return bSubmitForm;},init:function(p_oElement,p_oAttributes){var sNodeName=p_oAttributes.type=="link"?"A":"BUTTON",oSrcElement=p_oAttributes.srcelement,oButton=p_oElement.getElementsByTagName(sNodeName)[0],oInput;if(!oButton){oInput=p_oElement.getElementsByTagName("INPUT")[0];if(oInput){oButton=document.createElement("BUTTON");oButton.setAttribute("type","button");oInput.parentNode.replaceChild(oButton,oInput);}} -this._button=oButton;YAHOO.widget.Button.superclass.init.call(this,p_oElement,p_oAttributes);m_oButtons[this.get("id")]=this;this.addClass(this.CSS_CLASS_NAME);this.addClass("yui-"+this.get("type")+"-button");Event.on(this._button,"focus",this._onFocus,null,this);this.on("mouseover",this._onMouseOver);this.on("click",this._onClick);this.on("appendTo",this._onAppendTo);var oContainer=this.get("container"),oElement=this.get("element"),bElInDoc=Dom.inDocument(oElement),oParentNode;if(oContainer){if(oSrcElement&&oSrcElement!=oElement){oParentNode=oSrcElement.parentNode;if(oParentNode){oParentNode.removeChild(oSrcElement);}} -if(Lang.isString(oContainer)){Event.onContentReady(oContainer,function(){this.appendTo(oContainer);},null,this);} -else{this.appendTo(oContainer);}} -else if(!bElInDoc&&oSrcElement&&oSrcElement!=oElement){oParentNode=oSrcElement.parentNode;if(oParentNode){this.fireEvent("beforeAppendTo",{type:"beforeAppendTo",target:oParentNode});oParentNode.replaceChild(oElement,oSrcElement);this.fireEvent("appendTo",{type:"appendTo",target:oParentNode});}} -else if(this.get("type")!="link"&&bElInDoc&&oSrcElement&&oSrcElement==oElement){this._addListenersToForm();}},initAttributes:function(p_oAttributes){var oAttributes=p_oAttributes||{};YAHOO.widget.Button.superclass.initAttributes.call(this,oAttributes);this.setAttributeConfig("type",{value:(oAttributes.type||"push"),validator:Lang.isString,writeOnce:true,method:this._setType});this.setAttributeConfig("label",{value:oAttributes.label,validator:Lang.isString,method:this._setLabel});this.setAttributeConfig("value",{value:oAttributes.value});this.setAttributeConfig("name",{value:oAttributes.name,validator:Lang.isString});this.setAttributeConfig("tabindex",{value:oAttributes.tabindex,validator:Lang.isNumber,method:this._setTabIndex});this.configureAttribute("title",{value:oAttributes.title,validator:Lang.isString,method:this._setTitle});this.setAttributeConfig("disabled",{value:(oAttributes.disabled||false),validator:Lang.isBoolean,method:this._setDisabled});this.setAttributeConfig("href",{value:oAttributes.href,validator:Lang.isString,method:this._setHref});this.setAttributeConfig("target",{value:oAttributes.target,validator:Lang.isString,method:this._setTarget});this.setAttributeConfig("checked",{value:(oAttributes.checked||false),validator:Lang.isBoolean,method:this._setChecked});this.setAttributeConfig("container",{value:oAttributes.container,writeOnce:true});this.setAttributeConfig("srcelement",{value:oAttributes.srcelement,writeOnce:true});this.setAttributeConfig("menu",{value:null,method:this._setMenu,writeOnce:true});this.setAttributeConfig("lazyloadmenu",{value:(oAttributes.lazyloadmenu===false?false:true),validator:Lang.isBoolean,writeOnce:true});this.setAttributeConfig("menuclassname",{value:(oAttributes.menuclassname||"yui-button-menu"),validator:Lang.isString,method:this._setMenuClassName,writeOnce:true});this.setAttributeConfig("selectedMenuItem",{value:0,validator:Lang.isNumber,method:this._setSelectedMenuItem});this.setAttributeConfig("onclick",{value:oAttributes.onclick,method:this._setOnClick});this.setAttributeConfig("focusmenu",{value:(oAttributes.focusmenu===false?false:true),validator:Lang.isBoolean});},focus:function(){if(!this.get("disabled")){this._button.focus();}},blur:function(){if(!this.get("disabled")){this._button.blur();}},hasFocus:function(){return(m_oFocusedButton==this);},isActive:function(){return this.hasClass(this.CSS_CLASS_NAME+"-active");},getMenu:function(){return this._menu;},getForm:function(){return this._button.form;},getHiddenFields:function(){return this._hiddenFields;},destroy:function(){var oElement=this.get("element"),oParentNode=oElement.parentNode,oMenu=this._menu;if(oMenu){oMenu.destroy();} -Event.purgeElement(oElement);Event.purgeElement(this._button);Event.removeListener(document,"mouseup",this._onDocumentMouseUp);Event.removeListener(document,"keyup",this._onDocumentKeyUp);Event.removeListener(document,"mousedown",this._onDocumentMouseDown);var oForm=this.getForm();if(oForm){Event.removeListener(oForm,"reset",this._onFormReset);Event.removeListener(oForm,"submit",this.createHiddenFields);} -oParentNode.removeChild(oElement);delete m_oButtons[this.get("id")];},fireEvent:function(p_sType,p_aArgs){if(this.DOM_EVENTS[p_sType]&&this.get("disabled")){return;} -YAHOO.widget.Button.superclass.fireEvent.call(this,p_sType,p_aArgs);},toString:function(){return("Button "+this.get("id"));}});YAHOO.widget.Button.onFormKeyPress=function(p_oEvent){var oTarget=Event.getTarget(p_oEvent),nCharCode=Event.getCharCode(p_oEvent),sNodeName=oTarget.nodeName&&oTarget.nodeName.toUpperCase(),sType=oTarget.type,bFormContainsYUIButtons=false,oButton,oYUISubmitButton,oPrecedingSubmitButton,oFollowingSubmitButton;function isSubmitButton(p_oElement){var sId,oSrcElement;switch(p_oElement.nodeName.toUpperCase()){case"INPUT":case"BUTTON":if(p_oElement.type=="submit"&&!p_oElement.disabled){if(!bFormContainsYUIButtons&&!oPrecedingSubmitButton){oPrecedingSubmitButton=p_oElement;} -if(oYUISubmitButton&&!oFollowingSubmitButton){oFollowingSubmitButton=p_oElement;}} -break;default:sId=p_oElement.id;if(sId){oButton=m_oButtons[sId];if(oButton){bFormContainsYUIButtons=true;if(!oButton.get("disabled")){oSrcElement=oButton.get("srcelement");if(!oYUISubmitButton&&(oButton.get("type")=="submit"||(oSrcElement&&oSrcElement.type=="submit"))) -{oYUISubmitButton=oButton;}}}} -break;}} -if(nCharCode==13&&((sNodeName=="INPUT"&&(sType=="text"||sType=="password"||sType=="checkbox"||sType=="radio"||sType=="file"))||sNodeName=="SELECT")) -{Dom.getElementsBy(isSubmitButton,"*",this);if(oPrecedingSubmitButton){oPrecedingSubmitButton.focus();} -else if(!oPrecedingSubmitButton&&oYUISubmitButton){if(oFollowingSubmitButton){Event.preventDefault(p_oEvent);} -oYUISubmitButton.submitForm();}}};YAHOO.widget.Button.addHiddenFieldsToForm=function(p_oForm){var aButtons=Dom.getElementsByClassName(YAHOO.widget.Button.prototype.CSS_CLASS_NAME,"*",p_oForm),nButtons=aButtons.length,oButton,sId,i;if(nButtons>0){for(i=0;i0){i=nButtons-1;do{this._buttons[i].set("disabled",p_bDisabled);} -while(i--);}},_onKeyDown:function(p_oEvent){var oTarget=Event.getTarget(p_oEvent),nCharCode=Event.getCharCode(p_oEvent),sId=oTarget.parentNode.parentNode.id,oButton=m_oButtons[sId],nIndex=-1;if(nCharCode==37||nCharCode==38){nIndex=(oButton.index===0)?(this._buttons.length-1):(oButton.index-1);} -else if(nCharCode==39||nCharCode==40){nIndex=(oButton.index===(this._buttons.length-1))?0:(oButton.index+1);} -if(nIndex>-1){this.check(nIndex);this.getButton(nIndex).focus();}},_onAppendTo:function(p_oEvent){var aButtons=this._buttons,nButtons=aButtons.length,i;for(i=0;i0){this.addButtons(aButtons);} -function isRadioButton(p_oElement){return(p_oElement.type=="radio");} -aButtons=Dom.getElementsBy(isRadioButton,"input",this.get("element"));if(aButtons.length>0){this.addButtons(aButtons);} -this.on("keydown",this._onKeyDown);this.on("appendTo",this._onAppendTo);var oContainer=this.get("container");if(oContainer){if(Lang.isString(oContainer)){Event.onContentReady(oContainer,function(){this.appendTo(oContainer);},null,this);} -else{this.appendTo(oContainer);}}},initAttributes:function(p_oAttributes){var oAttributes=p_oAttributes||{};YAHOO.widget.ButtonGroup.superclass.initAttributes.call(this,oAttributes);this.setAttributeConfig("name",{value:oAttributes.name,validator:Lang.isString});this.setAttributeConfig("disabled",{value:(oAttributes.disabled||false),validator:Lang.isBoolean,method:this._setDisabled});this.setAttributeConfig("value",{value:oAttributes.value});this.setAttributeConfig("container",{value:oAttributes.container,writeOnce:true});this.setAttributeConfig("checkedButton",{value:null});},addButton:function(p_oButton){var oButton,oButtonElement,oGroupElement,nIndex,sButtonName,sGroupName;if(p_oButton instanceof Button&&p_oButton.get("type")=="radio"){oButton=p_oButton;} -else if(!Lang.isString(p_oButton)&&!p_oButton.nodeName){p_oButton.type="radio";oButton=new Button(p_oButton);} -else{oButton=new Button(p_oButton,{type:"radio"});} -if(oButton){nIndex=this._buttons.length;sButtonName=oButton.get("name");sGroupName=this.get("name");oButton.index=nIndex;this._buttons[nIndex]=oButton;m_oButtons[oButton.get("id")]=oButton;if(sButtonName!=sGroupName){oButton.set("name",sGroupName);} -if(this.get("disabled")){oButton.set("disabled",true);} -if(oButton.get("checked")){this.set("checkedButton",oButton);} -oButtonElement=oButton.get("element");oGroupElement=this.get("element");if(oButtonElement.parentNode!=oGroupElement){oGroupElement.appendChild(oButtonElement);} -oButton.on("checkedChange",this._onButtonCheckedChange,oButton,this);return oButton;}},addButtons:function(p_aButtons){var nButtons,oButton,aButtons,i;if(Lang.isArray(p_aButtons)){nButtons=p_aButtons.length;aButtons=[];if(nButtons>0){for(i=0;i0){return aButtons;}}}},removeButton:function(p_nIndex){var oButton=this.getButton(p_nIndex),nButtons,i;if(oButton){this._buttons.splice(p_nIndex,1);delete m_oButtons[oButton.get("id")];oButton.removeListener("checkedChange",this._onButtonCheckedChange);oButton.destroy();nButtons=this._buttons.length;if(nButtons>0){i=this._buttons.length-1;do{this._buttons[i].index=i;} -while(i--);}}},getButton:function(p_nIndex){if(Lang.isNumber(p_nIndex)){return this._buttons[p_nIndex];}},getButtons:function(){return this._buttons;},getCount:function(){return this._buttons.length;},focus:function(p_nIndex){var oButton,nButtons,i;if(Lang.isNumber(p_nIndex)){oButton=this._buttons[p_nIndex];if(oButton){oButton.focus();}} -else{nButtons=this.getCount();for(i=0;i0){i=this._buttons.length-1;do{this._buttons[i].destroy();} -while(i--);} -Event.purgeElement(oElement);oParentNode.removeChild(oElement);},toString:function(){return("ButtonGroup "+this.get("id"));}});})();YAHOO.register("button",YAHOO.widget.Button,{version:"2.3.0",build:"442"}); \ No newline at end of file diff --git a/lib/yui/button/button-beta.js b/lib/yui/button/button-beta.js deleted file mode 100755 index 83195b829f1f9..0000000000000 --- a/lib/yui/button/button-beta.js +++ /dev/null @@ -1,4477 +0,0 @@ -/* -Copyright (c) 2007, Yahoo! Inc. All rights reserved. -Code licensed under the BSD License: -http://developer.yahoo.net/yui/license.txt -version: 2.3.0 -*/ -/** -* @module button -* @description

The Button Control enables the creation of rich, graphical -* buttons that function like traditional HTML form buttons. Unlike -* tradition HTML form buttons, buttons created with the Button Control can have -* a label that is different from its value. With the inclusion of the optional -* Menu Control, the Button Control can also be -* used to create menu buttons and split buttons, controls that are not -* available natively in HTML. The Button Control can also be thought of as a -* way to create more visually engaging implementations of the browser's -* default radio-button and check-box controls.

-*

The Button Control supports the following types:

-*
-*
push
-*
Basic push button that can execute a user-specified command when -* pressed.
-*
link
-*
Navigates to a specified url when pressed.
-*
submit
-*
Submits the parent form when pressed.
-*
reset
-*
Resets the parent form when pressed.
-*
checkbox
-*
Maintains a "checked" state that can be toggled on and off.
-*
radio
-*
Maintains a "checked" state that can be toggled on and off. Use with -* the ButtonGroup class to create a set of controls that are mutually -* exclusive; checking one button in the set will uncheck all others in -* the group.
-*
menu
-*
When pressed will show/hide a menu.
-*
split
-*
Can execute a user-specified command or display a menu when pressed.
-*
-* @title Button -* @namespace YAHOO.widget -* @requires yahoo, dom, element, event -* @optional container, menu -* @beta -*/ - - -(function () { - - - /** - * The Button class creates a rich, graphical button. - * @param {String} p_oElement String specifying the id attribute of the - * <input>, <button>, - * <a>, or <span> element to - * be used to create the button. - * @param {HTMLInputElement| - * HTMLButtonElement|HTMLElement} p_oElement Object reference for the - * <input>, <button>, - * <a>, or <span> element to be - * used to create the button. - * @param {Object} p_oElement Object literal specifying a set of - * configuration attributes used to create the button. - * @param {Object} p_oAttributes Optional. Object literal specifying a set - * of configuration attributes used to create the button. - * @namespace YAHOO.widget - * @class Button - * @constructor - * @extends YAHOO.util.Element - */ - - - - // Shorthard for utilities - - var Dom = YAHOO.util.Dom, - Event = YAHOO.util.Event, - Lang = YAHOO.lang, - Overlay = YAHOO.widget.Overlay, - Menu = YAHOO.widget.Menu, - - - // Private member variables - - m_oButtons = {}, // Collection of all Button instances - m_oOverlayManager = null, // YAHOO.widget.OverlayManager instance - m_oSubmitTrigger = null, // The button that submitted the form - m_oFocusedButton = null; // The button that has focus - - - - // Private methods - - - - /** - * @method createInputElement - * @description Creates an <input> element of the - * specified type. - * @private - * @param {String} p_sType String specifying the type of - * <input> element to create. - * @param {String} p_sName String specifying the name of - * <input> element to create. - * @param {String} p_sValue String specifying the value of - * <input> element to create. - * @param {String} p_bChecked Boolean specifying if the - * <input> element is to be checked. - * @return {HTMLInputElement} - */ - function createInputElement(p_sType, p_sName, p_sValue, p_bChecked) { - - var oInput, - sInput; - - if (Lang.isString(p_sType) && Lang.isString(p_sName)) { - - if (YAHOO.env.ua.ie) { - - /* - For IE it is necessary to create the element with the - "type," "name," "value," and "checked" properties set all - at once. - */ - - sInput = "<input> or <a>) that - * map to Button configuration attributes and sets them into a collection - * that is passed to the Button constructor. - * @private - * @param {HTMLInputElement|HTMLAnchorElement} p_oElement Object reference to the HTML - * element (either <input> or <span> - * ) used to create the button. - * @param {Object} p_oAttributes Object reference for the collection of - * configuration attributes used to create the button. - */ - function setAttributesFromSrcElement(p_oElement, p_oAttributes) { - - var sSrcElementNodeName = p_oElement.nodeName.toUpperCase(), - me = this, - oAttribute, - oRootNode, - sText; - - - /** - * @method setAttributeFromDOMAttribute - * @description Gets the value of the specified DOM attribute and sets it - * into the collection of configuration attributes used to configure - * the button. - * @private - * @param {String} p_sAttribute String representing the name of the - * attribute to retrieve from the DOM element. - */ - function setAttributeFromDOMAttribute(p_sAttribute) { - - if ( !(p_sAttribute in p_oAttributes) ) { - - /* - Need to use "getAttributeNode" instead of "getAttribute" - because using "getAttribute," IE will return the innerText - of a <button> for the value attribute - rather than the value of the "value" attribute. - */ - - oAttribute = p_oElement.getAttributeNode(p_sAttribute); - - - if (oAttribute && ("value" in oAttribute)) { - - - p_oAttributes[p_sAttribute] = oAttribute.value; - - } - - } - - } - - - /** - * @method setFormElementProperties - * @description Gets the value of the attributes from the form element - * and sets them into the collection of configuration attributes used to - * configure the button. - * @private - */ - function setFormElementProperties() { - - setAttributeFromDOMAttribute("type"); - - if (p_oAttributes.type == "button") { - - p_oAttributes.type = "push"; - - } - - if ( !("disabled" in p_oAttributes) ) { - - p_oAttributes.disabled = p_oElement.disabled; - - } - - setAttributeFromDOMAttribute("name"); - setAttributeFromDOMAttribute("value"); - setAttributeFromDOMAttribute("title"); - - } - - - switch (sSrcElementNodeName) { - - case "A": - - p_oAttributes.type = "link"; - - setAttributeFromDOMAttribute("href"); - setAttributeFromDOMAttribute("target"); - - break; - - case "INPUT": - - setFormElementProperties(); - - if ( !("checked" in p_oAttributes) ) { - - p_oAttributes.checked = p_oElement.checked; - - } - - break; - - case "BUTTON": - - setFormElementProperties(); - - oRootNode = p_oElement.parentNode.parentNode; - - if (Dom.hasClass(oRootNode, this.CSS_CLASS_NAME + "-checked")) { - - p_oAttributes.checked = true; - - } - - if (Dom.hasClass(oRootNode, this.CSS_CLASS_NAME + "-disabled")) { - - p_oAttributes.disabled = true; - - } - - p_oElement.removeAttribute("value"); - - p_oElement.setAttribute("type", "button"); - - break; - - } - - p_oElement.removeAttribute("id"); - p_oElement.removeAttribute("name"); - - if ( !("tabindex" in p_oAttributes) ) { - - p_oAttributes.tabindex = p_oElement.tabIndex; - - } - - if ( !("label" in p_oAttributes) ) { - - // Set the "label" property - - sText = sSrcElementNodeName == "INPUT" ? - p_oElement.value : p_oElement.innerHTML; - - - if (sText && sText.length > 0) { - - p_oAttributes.label = sText; - - } - - } - - } - - - /** - * @method initConfig - * @description Initializes the set of configuration attributes that are - * used to instantiate the button. - * @private - * @param {Object} Object representing the button's set of - * configuration attributes. - */ - function initConfig(p_oConfig) { - - var oAttributes = p_oConfig.attributes, - oSrcElement = oAttributes.srcelement, - sSrcElementNodeName = oSrcElement.nodeName.toUpperCase(), - me = this; - - - if (sSrcElementNodeName == this.NODE_NAME) { - - p_oConfig.element = oSrcElement; - p_oConfig.id = oSrcElement.id; - - Dom.getElementsBy(function (p_oElement) { - - switch (p_oElement.nodeName.toUpperCase()) { - - case "BUTTON": - case "A": - case "INPUT": - - setAttributesFromSrcElement.call(me, p_oElement, - oAttributes); - - break; - - } - - }, "*", oSrcElement); - - } - else { - - switch (sSrcElementNodeName) { - - case "BUTTON": - case "A": - case "INPUT": - - setAttributesFromSrcElement.call(this, oSrcElement, - oAttributes); - - break; - - } - - } - - } - - - - // Constructor - - YAHOO.widget.Button = function (p_oElement, p_oAttributes) { - - var fnSuperClass = YAHOO.widget.Button.superclass.constructor, - oConfig, - oElement; - - if (arguments.length == 1 && !Lang.isString(p_oElement) && - !p_oElement.nodeName) { - - if (!p_oElement.id) { - - p_oElement.id = Dom.generateId(); - - - } - - - - fnSuperClass.call(this, - (this.createButtonElement(p_oElement.type)), - p_oElement); - - } - else { - - oConfig = { element: null, attributes: (p_oAttributes || {}) }; - - - if (Lang.isString(p_oElement)) { - - oElement = Dom.get(p_oElement); - - if (oElement) { - - if (!oConfig.attributes.id) { - - oConfig.attributes.id = p_oElement; - - } - - - - - oConfig.attributes.srcelement = oElement; - - initConfig.call(this, oConfig); - - - if (!oConfig.element) { - - - oConfig.element = - this.createButtonElement(oConfig.attributes.type); - - } - - fnSuperClass.call(this, oConfig.element, - oConfig.attributes); - - } - - } - else if (p_oElement.nodeName) { - - if (!oConfig.attributes.id) { - - if (p_oElement.id) { - - oConfig.attributes.id = p_oElement.id; - - } - else { - - oConfig.attributes.id = Dom.generateId(); - - - } - - } - - - - - - oConfig.attributes.srcelement = p_oElement; - - initConfig.call(this, oConfig); - - - if (!oConfig.element) { - - - oConfig.element = - this.createButtonElement(oConfig.attributes.type); - - } - - fnSuperClass.call(this, oConfig.element, oConfig.attributes); - - } - - } - - }; - - - - YAHOO.extend(YAHOO.widget.Button, YAHOO.util.Element, { - - - // Protected properties - - - /** - * @property _button - * @description Object reference to the button's internal - * <a> or <button> element. - * @default null - * @protected - * @type HTMLAnchorElement|HTMLButtonElement - */ - _button: null, - - - /** - * @property _menu - * @description Object reference to the button's menu. - * @default null - * @protected - * @type {YAHOO.widget.Overlay| - * YAHOO.widget.Menu} - */ - _menu: null, - - - /** - * @property _hiddenFields - * @description Object reference to the <input> - * element, or array of HTML form elements used to represent the button - * when its parent form is submitted. - * @default null - * @protected - * @type HTMLInputElement|Array - */ - _hiddenFields: null, - - - /** - * @property _onclickAttributeValue - * @description Object reference to the button's current value for the - * "onclick" configuration attribute. - * @default null - * @protected - * @type Object - */ - _onclickAttributeValue: null, - - - /** - * @property _activationKeyPressed - * @description Boolean indicating if the key(s) that toggle the button's - * "active" state have been pressed. - * @default false - * @protected - * @type Boolean - */ - _activationKeyPressed: false, - - - /** - * @property _activationButtonPressed - * @description Boolean indicating if the mouse button that toggles - * the button's "active" state has been pressed. - * @default false - * @protected - * @type Boolean - */ - _activationButtonPressed: false, - - - /** - * @property _hasKeyEventHandlers - * @description Boolean indicating if the button's "blur", "keydown" and - * "keyup" event handlers are assigned - * @default false - * @protected - * @type Boolean - */ - _hasKeyEventHandlers: false, - - - /** - * @property _hasMouseEventHandlers - * @description Boolean indicating if the button's "mouseout," - * "mousedown," and "mouseup" event handlers are assigned - * @default false - * @protected - * @type Boolean - */ - _hasMouseEventHandlers: false, - - - - // Constants - - - /** - * @property NODE_NAME - * @description The name of the node to be used for the button's - * root element. - * @default "SPAN" - * @final - * @type String - */ - NODE_NAME: "SPAN", - - - /** - * @property CHECK_ACTIVATION_KEYS - * @description Array of numbers representing keys that (when pressed) - * toggle the button's "checked" attribute. - * @default [32] - * @final - * @type Array - */ - CHECK_ACTIVATION_KEYS: [32], - - - /** - * @property ACTIVATION_KEYS - * @description Array of numbers representing keys that (when presed) - * toggle the button's "active" state. - * @default [13, 32] - * @final - * @type Array - */ - ACTIVATION_KEYS: [13, 32], - - - /** - * @property OPTION_AREA_WIDTH - * @description Width (in pixels) of the area of a split button that - * when pressed will display a menu. - * @default 20 - * @final - * @type Number - */ - OPTION_AREA_WIDTH: 20, - - - /** - * @property CSS_CLASS_NAME - * @description String representing the CSS class(es) to be applied to - * the button's root element. - * @default "yui-button" - * @final - * @type String - */ - CSS_CLASS_NAME: "yui-button", - - - /** - * @property RADIO_DEFAULT_TITLE - * @description String representing the default title applied to buttons - * of type "radio." - * @default "Unchecked. Click to check." - * @final - * @type String - */ - RADIO_DEFAULT_TITLE: "Unchecked. Click to check.", - - - /** - * @property RADIO_CHECKED_TITLE - * @description String representing the title applied to buttons of - * type "radio" when checked. - * @default "Checked. Click to uncheck." - * @final - * @type String - */ - RADIO_CHECKED_TITLE: "Checked. Click to uncheck.", - - - /** - * @property CHECKBOX_DEFAULT_TITLE - * @description String representing the default title applied to - * buttons of type "checkbox." - * @default "Unchecked. Click to check." - * @final - * @type String - */ - CHECKBOX_DEFAULT_TITLE: "Unchecked. Click to check.", - - - /** - * @property CHECKBOX_CHECKED_TITLE - * @description String representing the title applied to buttons of type - * "checkbox" when checked. - * @default "Checked. Click to uncheck." - * @final - * @type String - */ - CHECKBOX_CHECKED_TITLE: "Checked. Click to uncheck.", - - - /** - * @property MENUBUTTON_DEFAULT_TITLE - * @description String representing the default title applied to - * buttons of type "menu." - * @default "Menu collapsed. Click to expand." - * @final - * @type String - */ - MENUBUTTON_DEFAULT_TITLE: "Menu collapsed. Click to expand.", - - - /** - * @property MENUBUTTON_MENU_VISIBLE_TITLE - * @description String representing the title applied to buttons of type - * "menu" when the button's menu is visible. - * @default "Menu expanded. Click or press Esc to collapse." - * @final - * @type String - */ - MENUBUTTON_MENU_VISIBLE_TITLE: - "Menu expanded. Click or press Esc to collapse.", - - - /** - * @property SPLITBUTTON_DEFAULT_TITLE - * @description String representing the default title applied to - * buttons of type "split." - * @default "Menu collapsed. Click inside option region or press - * Ctrl + Shift + M to show the menu." - * @final - * @type String - */ - SPLITBUTTON_DEFAULT_TITLE: ("Menu collapsed. Click inside option " + - "region or press Ctrl + Shift + M to show the menu."), - - - /** - * @property SPLITBUTTON_OPTION_VISIBLE_TITLE - * @description String representing the title applied to buttons of type - * "split" when the button's menu is visible. - * @default "Menu expanded. Press Esc or Ctrl + Shift + M to hide - * the menu." - * @final - * @type String - */ - SPLITBUTTON_OPTION_VISIBLE_TITLE: - "Menu expanded. Press Esc or Ctrl + Shift + M to hide the menu.", - - - /** - * @property SUBMIT_TITLE - * @description String representing the title applied to buttons of - * type "submit." - * @default "Click to submit form." - * @final - * @type String - */ - SUBMIT_TITLE: "Click to submit form.", - - - - // Protected attribute setter methods - - - /** - * @method _setType - * @description Sets the value of the button's "type" attribute. - * @protected - * @param {String} p_sType String indicating the value for the button's - * "type" attribute. - */ - _setType: function (p_sType) { - - if (p_sType == "split") { - - this.on("option", this._onOption); - - } - - }, - - - /** - * @method _setLabel - * @description Sets the value of the button's "label" attribute. - * @protected - * @param {String} p_sLabel String indicating the value for the button's - * "label" attribute. - */ - _setLabel: function (p_sLabel) { - - this._button.innerHTML = p_sLabel; - - }, - - - /** - * @method _setTabIndex - * @description Sets the value of the button's "tabindex" attribute. - * @protected - * @param {Number} p_nTabIndex Number indicating the value for the - * button's "tabindex" attribute. - */ - _setTabIndex: function (p_nTabIndex) { - - this._button.tabIndex = p_nTabIndex; - - }, - - - /** - * @method _setTitle - * @description Sets the value of the button's "title" attribute. - * @protected - * @param {String} p_nTabIndex Number indicating the value for - * the button's "title" attribute. - */ - _setTitle: function (p_sTitle) { - - var sTitle = p_sTitle; - - if (this.get("type") != "link") { - - if (!sTitle) { - - switch (this.get("type")) { - - case "radio": - - sTitle = this.RADIO_DEFAULT_TITLE; - - break; - - case "checkbox": - - sTitle = this.CHECKBOX_DEFAULT_TITLE; - - break; - - case "menu": - - sTitle = this.MENUBUTTON_DEFAULT_TITLE; - - break; - - case "split": - - sTitle = this.SPLITBUTTON_DEFAULT_TITLE; - - break; - - case "submit": - - sTitle = this.SUBMIT_TITLE; - - break; - - } - - } - - this._button.title = sTitle; - - } - - }, - - - /** - * @method _setDisabled - * @description Sets the value of the button's "disabled" attribute. - * @protected - * @param {Boolean} p_bDisabled Boolean indicating the value for - * the button's "disabled" attribute. - */ - _setDisabled: function (p_bDisabled) { - - if (this.get("type") != "link") { - - if (p_bDisabled) { - - if (this._menu) { - - this._menu.hide(); - - } - - if (this.hasFocus()) { - - this.blur(); - - } - - this._button.setAttribute("disabled", "disabled"); - - this.addStateCSSClasses("disabled"); - - } - else { - - this._button.removeAttribute("disabled"); - - this.removeStateCSSClasses("disabled"); - - } - - } - - }, - - - /** - * @method _setHref - * @description Sets the value of the button's "href" attribute. - * @protected - * @param {String} p_sHref String indicating the value for the button's - * "href" attribute. - */ - _setHref: function (p_sHref) { - - if (this.get("type") == "link") { - - this._button.href = p_sHref; - - } - - }, - - - /** - * @method _setTarget - * @description Sets the value of the button's "target" attribute. - * @protected - * @param {String} p_sTarget String indicating the value for the button's - * "target" attribute. - */ - _setTarget: function (p_sTarget) { - - if (this.get("type") == "link") { - - this._button.setAttribute("target", p_sTarget); - - } - - }, - - - /** - * @method _setChecked - * @description Sets the value of the button's "target" attribute. - * @protected - * @param {Boolean} p_bChecked Boolean indicating the value for - * the button's "checked" attribute. - */ - _setChecked: function (p_bChecked) { - - var sType = this.get("type"), - sTitle; - - if (sType == "checkbox" || sType == "radio") { - - if (p_bChecked) { - - this.addStateCSSClasses("checked"); - - sTitle = (sType == "radio") ? - this.RADIO_CHECKED_TITLE : - this.CHECKBOX_CHECKED_TITLE; - - } - else { - - this.removeStateCSSClasses("checked"); - - sTitle = (sType == "radio") ? - this.RADIO_DEFAULT_TITLE : - this.CHECKBOX_DEFAULT_TITLE; - - } - - this.set("title", sTitle); - - } - - }, - - - /** - * @method _setMenu - * @description Sets the value of the button's "menu" attribute. - * @protected - * @param {Object} p_oMenu Object indicating the value for the button's - * "menu" attribute. - */ - _setMenu: function (p_oMenu) { - - var bLazyLoad = this.get("lazyloadmenu"), - oButtonElement = this.get("element"), - - /* - Boolean indicating if the value of p_oMenu is an instance - of YAHOO.widget.Menu or YAHOO.widget.Overlay. - */ - - bInstance = false, - - - oMenu, - oMenuElement, - oSrcElement, - aItems, - nItems, - oItem, - i; - - - if (!Overlay) { - - - return false; - - } - - - if (!Menu) { - - - return false; - - } - - - function onAppendTo() { - - oMenu.render(oButtonElement.parentNode); - - this.removeListener("appendTo", onAppendTo); - - } - - - function initMenu() { - - if (oMenu) { - - Dom.addClass(oMenu.element, this.get("menuclassname")); - Dom.addClass(oMenu.element, - "yui-" + this.get("type") + "-button-menu"); - - oMenu.showEvent.subscribe(this._onMenuShow, null, this); - oMenu.hideEvent.subscribe(this._onMenuHide, null, this); - oMenu.renderEvent.subscribe(this._onMenuRender, null, this); - - - if (oMenu instanceof Menu) { - - oMenu.keyDownEvent.subscribe(this._onMenuKeyDown, - this, true); - - oMenu.clickEvent.subscribe(this._onMenuClick, - this, true); - - oMenu.itemAddedEvent.subscribe(this._onMenuItemAdded, - this, true); - - oSrcElement = oMenu.srcElement; - - if (oSrcElement && - oSrcElement.nodeName.toUpperCase() == "SELECT") { - - oSrcElement.style.display = "none"; - oSrcElement.parentNode.removeChild(oSrcElement); - - } - - } - else if (oMenu instanceof Overlay) { - - if (!m_oOverlayManager) { - - m_oOverlayManager = - new YAHOO.widget.OverlayManager(); - - } - - m_oOverlayManager.register(oMenu); - - } - - - this._menu = oMenu; - - - if (!bInstance) { - - if (bLazyLoad && !(oMenu instanceof Menu)) { - - /* - Mimic Menu's "lazyload" functionality by adding - a "beforeshow" event listener that renders the - Overlay instance before it is made visible by - the button. - */ - - oMenu.beforeShowEvent.subscribe( - this._onOverlayBeforeShow, null, this); - - } - else if (!bLazyLoad) { - - if (Dom.inDocument(oButtonElement)) { - - oMenu.render(oButtonElement.parentNode); - - } - else { - - this.on("appendTo", onAppendTo); - - } - - } - - } - - } - - } - - - if (p_oMenu && (p_oMenu instanceof Menu)) { - - oMenu = p_oMenu; - aItems = oMenu.getItems(); - nItems = aItems.length; - bInstance = true; - - - if (nItems > 0) { - - i = nItems - 1; - - do { - - oItem = aItems[i]; - - if (oItem) { - - oItem.cfg.subscribeToConfigEvent("selected", - this._onMenuItemSelected, - oItem, - this); - - } - - } - while (i--); - - } - - initMenu.call(this); - - } - else if (p_oMenu && (p_oMenu instanceof Overlay)) { - - oMenu = p_oMenu; - bInstance = true; - - oMenu.cfg.setProperty("visible", false); - oMenu.cfg.setProperty("context", [oButtonElement, "tl", "bl"]); - - initMenu.call(this); - - } - else if (Lang.isArray(p_oMenu)) { - - this.on("appendTo", function () { - - oMenu = new Menu(Dom.generateId(), { lazyload: bLazyLoad, - itemdata: p_oMenu }); - - initMenu.call(this); - - }); - - } - else if (Lang.isString(p_oMenu)) { - - oMenuElement = Dom.get(p_oMenu); - - if (oMenuElement) { - - if (Dom.hasClass(oMenuElement, - Menu.prototype.CSS_CLASS_NAME) || - oMenuElement.nodeName == "SELECT") { - - oMenu = new Menu(p_oMenu, { lazyload: bLazyLoad }); - - initMenu.call(this); - - } - else { - - oMenu = new Overlay(p_oMenu, { visible: false, - context: [oButtonElement, "tl", "bl"] }); - - initMenu.call(this); - - } - - } - - } - else if (p_oMenu && p_oMenu.nodeName) { - - if (Dom.hasClass(p_oMenu, Menu.prototype.CSS_CLASS_NAME) || - p_oMenu.nodeName == "SELECT") { - - oMenu = new Menu(p_oMenu, { lazyload: bLazyLoad }); - - initMenu.call(this); - - } - else { - - if (!p_oMenu.id) { - - Dom.generateId(p_oMenu); - - } - - oMenu = new Overlay(p_oMenu, { visible: false, - context: [oButtonElement, "tl", "bl"] }); - - initMenu.call(this); - - } - - } - - }, - - - /** - * @method _setOnClick - * @description Sets the value of the button's "onclick" attribute. - * @protected - * @param {Object} p_oObject Object indicating the value for the button's - * "onclick" attribute. - */ - _setOnClick: function (p_oObject) { - - /* - Remove any existing listeners if a "click" event handler - has already been specified. - */ - - if (this._onclickAttributeValue && - (this._onclickAttributeValue != p_oObject)) { - - this.removeListener("click", this._onclickAttributeValue.fn); - - this._onclickAttributeValue = null; - - } - - - if (!this._onclickAttributeValue && - Lang.isObject(p_oObject) && - Lang.isFunction(p_oObject.fn)) { - - this.on("click", p_oObject.fn, p_oObject.obj, p_oObject.scope); - - this._onclickAttributeValue = p_oObject; - - } - - }, - - - /** - * @method _setSelectedMenuItem - * @description Sets the value of the button's - * "selectedMenuItem" attribute. - * @protected - * @param {Number} p_nIndex Number representing the index of the item - * in the button's menu that is currently selected. - */ - _setSelectedMenuItem: function (p_nIndex) { - - var oMenu = this._menu, - oMenuItem; - - - if (oMenu && oMenu instanceof Menu) { - - oMenuItem = oMenu.getItem(p_nIndex); - - - if (oMenuItem && !oMenuItem.cfg.getProperty("selected")) { - - oMenuItem.cfg.setProperty("selected", true); - - } - - } - - }, - - - // Protected methods - - - - /** - * @method _isActivationKey - * @description Determines if the specified keycode is one that toggles - * the button's "active" state. - * @protected - * @param {Number} p_nKeyCode Number representing the keycode to - * be evaluated. - * @return {Boolean} - */ - _isActivationKey: function (p_nKeyCode) { - - var sType = this.get("type"), - aKeyCodes = (sType == "checkbox" || sType == "radio") ? - this.CHECK_ACTIVATION_KEYS : this.ACTIVATION_KEYS, - - nKeyCodes = aKeyCodes.length, - i; - - if (nKeyCodes > 0) { - - i = nKeyCodes - 1; - - do { - - if (p_nKeyCode == aKeyCodes[i]) { - - return true; - - } - - } - while (i--); - - } - - }, - - - /** - * @method _isSplitButtonOptionKey - * @description Determines if the specified keycode is one that toggles - * the display of the split button's menu. - * @protected - * @param {Event} p_oEvent Object representing the DOM event object - * passed back by the event utility (YAHOO.util.Event). - * @return {Boolean} - */ - _isSplitButtonOptionKey: function (p_oEvent) { - - return (p_oEvent.ctrlKey && p_oEvent.shiftKey && - Event.getCharCode(p_oEvent) == 77); - - }, - - - /** - * @method _addListenersToForm - * @description Adds event handlers to the button's form. - * @protected - */ - _addListenersToForm: function () { - - var oForm = this.getForm(), - oSrcElement, - aListeners, - nListeners, - i, - bHasKeyPressListener; - - - if (oForm) { - - Event.on(oForm, "reset", this._onFormReset, null, this); - Event.on(oForm, "submit", this.createHiddenFields, null, this); - - oSrcElement = this.get("srcelement"); - - - if (this.get("type") == "submit" || - (oSrcElement && oSrcElement.type == "submit")) - { - - aListeners = Event.getListeners(oForm, "keypress"); - bHasKeyPressListener = false; - - if (aListeners) { - - nListeners = aListeners.length; - - if (nListeners > 0) { - - i = nListeners - 1; - - do { - - if (aListeners[i].fn == - YAHOO.widget.Button.onFormKeyPress) - { - - bHasKeyPressListener = true; - break; - - } - - } - while (i--); - - } - - } - - - if (!bHasKeyPressListener) { - - Event.on(oForm, "keypress", - YAHOO.widget.Button.onFormKeyPress); - - } - - } - - } - - }, - - - _originalMaxHeight: -1, - - - /** - * @method _showMenu - * @description Shows the button's menu. - * @protected - * @param {Event} p_oEvent Object representing the DOM event object - * passed back by the event utility (YAHOO.util.Event) that triggered - * the display of the menu. - */ - _showMenu: function (p_oEvent) { - - YAHOO.widget.MenuManager.hideVisible(); - - if (m_oOverlayManager) { - - m_oOverlayManager.hideAll(); - - } - - - var oMenu = this._menu, - nViewportHeight = Dom.getViewportHeight(), - nMenuHeight, - nScrollTop, - nY; - - - if (oMenu && (oMenu instanceof Menu)) { - - oMenu.cfg.applyConfig({ context: [this.get("id"), "tl", "bl"], - constraintoviewport: false, - clicktohide: false, - visible: true }); - - oMenu.cfg.fireQueue(); - - oMenu.align("tl", "bl"); - - /* - Stop the propagation of the event so that the MenuManager - doesn't blur the menu after it gets focus. - */ - - if (p_oEvent.type == "mousedown") { - - Event.stopPropagation(p_oEvent); - - } - - - if (this.get("focusmenu")) { - - this._menu.focus(); - - } - - nMenuHeight = oMenu.element.offsetHeight; - - - if ((oMenu.cfg.getProperty("y") + nMenuHeight) > - nViewportHeight) { - - - oMenu.align("bl", "tl"); - - nY = oMenu.cfg.getProperty("y"); - - nScrollTop = Dom.getDocumentScrollTop(); - - - if (nScrollTop >= nY) { - - if (this._originalMaxHeight == -1) { - - this._originalMaxHeight = - oMenu.cfg.getProperty("maxheight"); - - } - - oMenu.cfg.setProperty("maxheight", - (nMenuHeight - ((nScrollTop - nY) + 20))); - - oMenu.align("bl", "tl"); - - } - - } - - } - else if (oMenu && (oMenu instanceof Overlay)) { - - oMenu.show(); - oMenu.align("tl", "bl"); - - nMenuHeight = oMenu.element.offsetHeight; - - - if ((oMenu.cfg.getProperty("y") + nMenuHeight) > - nViewportHeight) { - - - oMenu.align("bl", "tl"); - - } - - } - - }, - - - /** - * @method _hideMenu - * @description Hides the button's menu. - * @protected - */ - _hideMenu: function () { - - var oMenu = this._menu; - - if (oMenu) { - - oMenu.hide(); - - } - - }, - - - - - // Protected event handlers - - - /** - * @method _onMouseOver - * @description "mouseover" event handler for the button. - * @protected - * @param {Event} p_oEvent Object representing the DOM event object - * passed back by the event utility (YAHOO.util.Event). - */ - _onMouseOver: function (p_oEvent) { - - if (!this._hasMouseEventHandlers) { - - this.on("mouseout", this._onMouseOut); - this.on("mousedown", this._onMouseDown); - this.on("mouseup", this._onMouseUp); - - this._hasMouseEventHandlers = true; - - } - - this.addStateCSSClasses("hover"); - - if (this._activationButtonPressed) { - - this.addStateCSSClasses("active"); - - } - - - if (this._bOptionPressed) { - - this.addStateCSSClasses("activeoption"); - - } - - }, - - - /** - * @method _onMouseOut - * @description "mouseout" event handler for the button. - * @protected - * @param {Event} p_oEvent Object representing the DOM event object - * passed back by the event utility (YAHOO.util.Event). - */ - _onMouseOut: function (p_oEvent) { - - this.removeStateCSSClasses("hover"); - - if (this.get("type") != "menu") { - - this.removeStateCSSClasses("active"); - - } - - if (this._activationButtonPressed || this._bOptionPressed) { - - Event.on(document, "mouseup", this._onDocumentMouseUp, - null, this); - - } - - }, - - - /** - * @method _onDocumentMouseUp - * @description "mouseup" event handler for the button. - * @protected - * @param {Event} p_oEvent Object representing the DOM event object - * passed back by the event utility (YAHOO.util.Event). - */ - _onDocumentMouseUp: function (p_oEvent) { - - this._activationButtonPressed = false; - this._bOptionPressed = false; - - var sType = this.get("type"); - - if (sType == "menu" || sType == "split") { - - this.removeStateCSSClasses( - (sType == "menu" ? "active" : "activeoption")); - - this._hideMenu(); - - } - - Event.removeListener(document, "mouseup", this._onDocumentMouseUp); - - }, - - - /** - * @method _onMouseDown - * @description "mousedown" event handler for the button. - * @protected - * @param {Event} p_oEvent Object representing the DOM event object - * passed back by the event utility (YAHOO.util.Event). - */ - _onMouseDown: function (p_oEvent) { - - var sType, - oElement, - nX, - me; - - - function onMouseUp() { - - this._hideMenu(); - this.removeListener("mouseup", onMouseUp); - - } - - - if ((p_oEvent.which || p_oEvent.button) == 1) { - - - if (!this.hasFocus()) { - - this.focus(); - - } - - - sType = this.get("type"); - - - if (sType == "split") { - - oElement = this.get("element"); - nX = Event.getPageX(p_oEvent) - Dom.getX(oElement); - - if ((oElement.offsetWidth - this.OPTION_AREA_WIDTH) < nX) { - - this.fireEvent("option", p_oEvent); - - } - else { - - this.addStateCSSClasses("active"); - - this._activationButtonPressed = true; - - } - - } - else if (sType == "menu") { - - if (this.isActive()) { - - this._hideMenu(); - - this._activationButtonPressed = false; - - } - else { - - this._showMenu(p_oEvent); - - this._activationButtonPressed = true; - - } - - } - else { - - this.addStateCSSClasses("active"); - - this._activationButtonPressed = true; - - } - - - - if (sType == "split" || sType == "menu") { - - me = this; - - this._hideMenuTimerId = window.setTimeout(function () { - - me.on("mouseup", onMouseUp); - - }, 250); - - } - - } - - }, - - - /** - * @method _onMouseUp - * @description "mouseup" event handler for the button. - * @protected - * @param {Event} p_oEvent Object representing the DOM event object - * passed back by the event utility (YAHOO.util.Event). - */ - _onMouseUp: function (p_oEvent) { - - var sType = this.get("type"); - - - if (this._hideMenuTimerId) { - - window.clearTimeout(this._hideMenuTimerId); - - } - - - if (sType == "checkbox" || sType == "radio") { - - this.set("checked", !(this.get("checked"))); - - } - - - this._activationButtonPressed = false; - - - if (this.get("type") != "menu") { - - this.removeStateCSSClasses("active"); - - } - - }, - - - /** - * @method _onFocus - * @description "focus" event handler for the button. - * @protected - * @param {Event} p_oEvent Object representing the DOM event object - * passed back by the event utility (YAHOO.util.Event). - */ - _onFocus: function (p_oEvent) { - - var oElement; - - this.addStateCSSClasses("focus"); - - if (this._activationKeyPressed) { - - this.addStateCSSClasses("active"); - - } - - m_oFocusedButton = this; - - - if (!this._hasKeyEventHandlers) { - - oElement = this._button; - - Event.on(oElement, "blur", this._onBlur, null, this); - Event.on(oElement, "keydown", this._onKeyDown, null, this); - Event.on(oElement, "keyup", this._onKeyUp, null, this); - - this._hasKeyEventHandlers = true; - - } - - - this.fireEvent("focus", p_oEvent); - - }, - - - /** - * @method _onBlur - * @description "blur" event handler for the button. - * @protected - * @param {Event} p_oEvent Object representing the DOM event object - * passed back by the event utility (YAHOO.util.Event). - */ - _onBlur: function (p_oEvent) { - - this.removeStateCSSClasses("focus"); - - if (this.get("type") != "menu") { - - this.removeStateCSSClasses("active"); - - } - - if (this._activationKeyPressed) { - - Event.on(document, "keyup", this._onDocumentKeyUp, null, this); - - } - - - m_oFocusedButton = null; - - this.fireEvent("blur", p_oEvent); - - }, - - - /** - * @method _onDocumentKeyUp - * @description "keyup" event handler for the document. - * @protected - * @param {Event} p_oEvent Object representing the DOM event object - * passed back by the event utility (YAHOO.util.Event). - */ - _onDocumentKeyUp: function (p_oEvent) { - - if (this._isActivationKey(Event.getCharCode(p_oEvent))) { - - this._activationKeyPressed = false; - - Event.removeListener(document, "keyup", this._onDocumentKeyUp); - - } - - }, - - - /** - * @method _onKeyDown - * @description "keydown" event handler for the button. - * @protected - * @param {Event} p_oEvent Object representing the DOM event object - * passed back by the event utility (YAHOO.util.Event). - */ - _onKeyDown: function (p_oEvent) { - - var oMenu = this._menu; - - - if (this.get("type") == "split" && - this._isSplitButtonOptionKey(p_oEvent)) { - - this.fireEvent("option", p_oEvent); - - } - else if (this._isActivationKey(Event.getCharCode(p_oEvent))) { - - if (this.get("type") == "menu") { - - this._showMenu(p_oEvent); - - } - else { - - this._activationKeyPressed = true; - - this.addStateCSSClasses("active"); - - } - - } - - - if (oMenu && oMenu.cfg.getProperty("visible") && - Event.getCharCode(p_oEvent) == 27) { - - oMenu.hide(); - this.focus(); - - } - - }, - - - /** - * @method _onKeyUp - * @description "keyup" event handler for the button. - * @protected - * @param {Event} p_oEvent Object representing the DOM event object - * passed back by the event utility (YAHOO.util.Event). - */ - _onKeyUp: function (p_oEvent) { - - var sType; - - if (this._isActivationKey(Event.getCharCode(p_oEvent))) { - - sType = this.get("type"); - - if (sType == "checkbox" || sType == "radio") { - - this.set("checked", !(this.get("checked"))); - - } - - this._activationKeyPressed = false; - - if (this.get("type") != "menu") { - - this.removeStateCSSClasses("active"); - - } - - } - - }, - - - /** - * @method _onClick - * @description "click" event handler for the button. - * @protected - * @param {Event} p_oEvent Object representing the DOM event object - * passed back by the event utility (YAHOO.util.Event). - */ - _onClick: function (p_oEvent) { - - var sType = this.get("type"), - sTitle, - oForm, - oSrcElement, - oElement, - nX; - - - switch (sType) { - - case "radio": - case "checkbox": - - if (this.get("checked")) { - - sTitle = (sType == "radio") ? - this.RADIO_CHECKED_TITLE : - this.CHECKBOX_CHECKED_TITLE; - - } - else { - - sTitle = (sType == "radio") ? - this.RADIO_DEFAULT_TITLE : - this.CHECKBOX_DEFAULT_TITLE; - - } - - this.set("title", sTitle); - - break; - - case "submit": - - this.submitForm(); - - break; - - case "reset": - - oForm = this.getForm(); - - if (oForm) { - - oForm.reset(); - - } - - break; - - case "menu": - - sTitle = this._menu.cfg.getProperty("visible") ? - this.MENUBUTTON_MENU_VISIBLE_TITLE : - this.MENUBUTTON_DEFAULT_TITLE; - - this.set("title", sTitle); - - break; - - case "split": - - oElement = this.get("element"); - nX = Event.getPageX(p_oEvent) - Dom.getX(oElement); - - if ((oElement.offsetWidth - this.OPTION_AREA_WIDTH) < nX) { - - return false; - - } - else { - - this._hideMenu(); - - oSrcElement = this.get("srcelement"); - - if (oSrcElement && oSrcElement.type == "submit") { - - this.submitForm(); - - } - - } - - sTitle = this._menu.cfg.getProperty("visible") ? - this.SPLITBUTTON_OPTION_VISIBLE_TITLE : - this.SPLITBUTTON_DEFAULT_TITLE; - - this.set("title", sTitle); - - break; - - } - - }, - - - /** - * @method _onAppendTo - * @description "appendTo" event handler for the button. - * @protected - * @param {Event} p_oEvent Object representing the DOM event object - * passed back by the event utility (YAHOO.util.Event). - */ - _onAppendTo: function (p_oEvent) { - - /* - It is necessary to call "getForm" using "setTimeout" to make - sure that the button's "form" property returns a node - reference. Sometimes, if you try to get the reference - immediately after appending the field, it is null. - */ - - var me = this; - - window.setTimeout(function () { - - me._addListenersToForm(); - - }, 0); - - }, - - - /** - * @method _onFormReset - * @description "reset" event handler for the button's form. - * @protected - * @param {Event} p_oEvent Object representing the DOM event - * object passed back by the event utility (YAHOO.util.Event). - */ - _onFormReset: function (p_oEvent) { - - var sType = this.get("type"), - oMenu = this._menu; - - if (sType == "checkbox" || sType == "radio") { - - this.resetValue("checked"); - - } - - - if (oMenu && (oMenu instanceof Menu)) { - - this.resetValue("selectedMenuItem"); - - } - - }, - - - /** - * @method _onDocumentMouseDown - * @description "mousedown" event handler for the document. - * @protected - * @param {Event} p_oEvent Object representing the DOM event object - * passed back by the event utility (YAHOO.util.Event). - */ - _onDocumentMouseDown: function (p_oEvent) { - - var oTarget = Event.getTarget(p_oEvent), - oButtonElement = this.get("element"), - oMenuElement = this._menu.element; - - if (oTarget != oButtonElement && - !Dom.isAncestor(oButtonElement, oTarget) && - oTarget != oMenuElement && - !Dom.isAncestor(oMenuElement, oTarget)) { - - this._hideMenu(); - - Event.removeListener(document, "mousedown", - this._onDocumentMouseDown); - - } - - }, - - - /** - * @method _onOption - * @description "option" event handler for the button. - * @protected - * @param {Event} p_oEvent Object representing the DOM event object - * passed back by the event utility (YAHOO.util.Event). - */ - _onOption: function (p_oEvent) { - - if (this.hasClass("yui-split-button-activeoption")) { - - this._hideMenu(); - - this._bOptionPressed = false; - - } - else { - - this._showMenu(p_oEvent); - - this._bOptionPressed = true; - - } - - }, - - - /** - * @method _onOverlayBeforeShow - * @description "beforeshow" event handler for the - * YAHOO.widget.Overlay instance - * serving as the button's menu. - * @private - * @param {String} p_sType String representing the name of the event - * that was fired. - */ - _onOverlayBeforeShow: function (p_sType) { - - var oMenu = this._menu; - - oMenu.render(this.get("element").parentNode); - - oMenu.beforeShowEvent.unsubscribe(this._onOverlayBeforeShow); - - }, - - - /** - * @method _onMenuShow - * @description "show" event handler for the button's menu. - * @private - * @param {String} p_sType String representing the name of the event - * that was fired. - */ - _onMenuShow: function (p_sType) { - - Event.on(document, "mousedown", this._onDocumentMouseDown, - null, this); - - var sTitle, - sState; - - if (this.get("type") == "split") { - - sTitle = this.SPLITBUTTON_OPTION_VISIBLE_TITLE; - sState = "activeoption"; - - } - else { - - sTitle = this.MENUBUTTON_MENU_VISIBLE_TITLE; - sState = "active"; - - } - - this.addStateCSSClasses(sState); - this.set("title", sTitle); - - }, - - - /** - * @method _onMenuHide - * @description "hide" event handler for the button's menu. - * @private - * @param {String} p_sType String representing the name of the event - * that was fired. - */ - _onMenuHide: function (p_sType) { - - var oMenu = this._menu, - sTitle, - sState; - - if (oMenu && (oMenu instanceof Menu) && - this._originalMaxHeight != -1) { - - this._menu.cfg.setProperty("maxheight", - this._originalMaxHeight); - - } - - - if (this.get("type") == "split") { - - sTitle = this.SPLITBUTTON_DEFAULT_TITLE; - sState = "activeoption"; - - } - else { - - sTitle = this.MENUBUTTON_DEFAULT_TITLE; - sState = "active"; - } - - - this.removeStateCSSClasses(sState); - this.set("title", sTitle); - - - if (this.get("type") == "split") { - - this._bOptionPressed = false; - - } - - }, - - - /** - * @method _onMenuKeyDown - * @description "keydown" event handler for the button's menu. - * @private - * @param {String} p_sType String representing the name of the event - * that was fired. - * @param {Array} p_aArgs Array of arguments sent when the event - * was fired. - */ - _onMenuKeyDown: function (p_sType, p_aArgs) { - - var oEvent = p_aArgs[0]; - - if (Event.getCharCode(oEvent) == 27) { - - this.focus(); - - if (this.get("type") == "split") { - - this._bOptionPressed = false; - - } - - } - - }, - - - /** - * @method _onMenuRender - * @description "render" event handler for the button's menu. - * @private - * @param {String} p_sType String representing the name of the - * event thatwas fired. - */ - _onMenuRender: function (p_sType) { - - var oButtonElement = this.get("element"), - oButtonParent = oButtonElement.parentNode, - oMenuElement = this._menu.element; - - - if (oButtonParent != oMenuElement.parentNode) { - - oButtonParent.appendChild(oMenuElement); - - } - - this.set("selectedMenuItem", this.get("selectedMenuItem")); - - }, - - - /** - * @method _onMenuItemSelected - * @description "selectedchange" event handler for each item in the - * button's menu. - * @private - * @param {String} p_sType String representing the name of the event - * that was fired. - * @param {Array} p_aArgs Array of arguments sent when the event - * was fired. - * @param {Number} p_nItem Number representing the index of the menu - * item that subscribed to the event. - */ - _onMenuItemSelected: function (p_sType, p_aArgs, p_nItem) { - - var bSelected = p_aArgs[0]; - - if (bSelected) { - - this.set("selectedMenuItem", p_nItem); - - } - - }, - - - /** - * @method _onMenuItemAdded - * @description "itemadded" event handler for the button's menu. - * @private - * @param {String} p_sType String representing the name of the event - * that was fired. - * @param {Array} p_aArgs Array of arguments sent when the event - * was fired. - * @param { - * YAHOO.widget.MenuItem} p_oItem Object representing the menu - * item that subscribed to the event. - */ - _onMenuItemAdded: function (p_sType, p_aArgs, p_oItem) { - - var oItem = p_aArgs[0]; - - oItem.cfg.subscribeToConfigEvent("selected", - this._onMenuItemSelected, - oItem.index, - this); - - }, - - - /** - * @method _onMenuClick - * @description "click" event handler for the button's menu. - * @private - * @param {String} p_sType String representing the name of the event - * that was fired. - * @param {Array} p_aArgs Array of arguments sent when the event - * was fired. - */ - _onMenuClick: function (p_sType, p_aArgs) { - - var oItem = p_aArgs[1], - oSrcElement; - - if (oItem) { - - oSrcElement = this.get("srcelement"); - - if (oSrcElement && oSrcElement.type == "submit") { - - this.submitForm(); - - } - - this._hideMenu(); - - } - - }, - - - - // Public methods - - - /** - * @method createButtonElement - * @description Creates the button's HTML elements. - * @param {String} p_sType String indicating the type of element - * to create. - * @return {HTMLElement} - */ - createButtonElement: function (p_sType) { - - var sNodeName = this.NODE_NAME, - oElement = document.createElement(sNodeName); - - oElement.innerHTML = "<" + sNodeName + " class=\"first-child\">" + - (p_sType == "link" ? "" : - "") + ""; - - return oElement; - - }, - - - /** - * @method addStateCSSClasses - * @description Appends state-specific CSS classes to the button's root - * DOM element. - */ - addStateCSSClasses: function (p_sState) { - - var sType = this.get("type"); - - if (Lang.isString(p_sState)) { - - if (p_sState != "activeoption") { - - this.addClass(this.CSS_CLASS_NAME + ("-" + p_sState)); - - } - - this.addClass("yui-" + sType + ("-button-" + p_sState)); - - } - - }, - - - /** - * @method removeStateCSSClasses - * @description Removes state-specific CSS classes to the button's root - * DOM element. - */ - removeStateCSSClasses: function (p_sState) { - - var sType = this.get("type"); - - if (Lang.isString(p_sState)) { - - this.removeClass(this.CSS_CLASS_NAME + ("-" + p_sState)); - this.removeClass("yui-" + sType + ("-button-" + p_sState)); - - } - - }, - - - /** - * @method createHiddenFields - * @description Creates the button's hidden form field and appends it - * to its parent form. - * @return {HTMLInputElement|Array} - */ - createHiddenFields: function () { - - this.removeHiddenFields(); - - var oForm = this.getForm(), - oButtonField, - sType, - bCheckable, - oMenu, - oMenuItem, - sName, - oValue, - oMenuField; - - - if (oForm && !this.get("disabled")) { - - sType = this.get("type"); - bCheckable = (sType == "checkbox" || sType == "radio"); - - - if (bCheckable || (m_oSubmitTrigger == this)) { - - - oButtonField = createInputElement( - (bCheckable ? sType : "hidden"), - this.get("name"), - this.get("value"), - this.get("checked")); - - - if (oButtonField) { - - if (bCheckable) { - - oButtonField.style.display = "none"; - - } - - oForm.appendChild(oButtonField); - - } - - } - - - oMenu = this._menu; - - - if (oMenu && (oMenu instanceof Menu)) { - - - oMenuField = oMenu.srcElement; - oMenuItem = oMenu.getItem(this.get("selectedMenuItem")); - - if (oMenuField && - oMenuField.nodeName.toUpperCase() == "SELECT") { - - oForm.appendChild(oMenuField); - oMenuField.selectedIndex = oMenuItem.index; - - } - else { - - oValue = (oMenuItem.value === null || - oMenuItem.value === "") ? - oMenuItem.cfg.getProperty("text") : - oMenuItem.value; - - sName = this.get("name"); - - if (oValue && sName) { - - oMenuField = createInputElement("hidden", - (sName + "_options"), - oValue); - - oForm.appendChild(oMenuField); - - } - - } - - } - - - if (oButtonField && oMenuField) { - - this._hiddenFields = [oButtonField, oMenuField]; - - } - else if (!oButtonField && oMenuField) { - - this._hiddenFields = oMenuField; - - } - else if (oButtonField && !oMenuField) { - - this._hiddenFields = oButtonField; - - } - - - return this._hiddenFields; - - } - - }, - - - /** - * @method removeHiddenFields - * @description Removes the button's hidden form field(s) from its - * parent form. - */ - removeHiddenFields: function () { - - var oField = this._hiddenFields, - nFields, - i; - - function removeChild(p_oElement) { - - if (Dom.inDocument(p_oElement)) { - - p_oElement.parentNode.removeChild(p_oElement); - - } - - } - - - if (oField) { - - if (Lang.isArray(oField)) { - - nFields = oField.length; - - if (nFields > 0) { - - i = nFields - 1; - - do { - - removeChild(oField[i]); - - } - while (i--); - - } - - } - else { - - removeChild(oField); - - } - - this._hiddenFields = null; - - } - - }, - - - /** - * @method submitForm - * @description Submits the form to which the button belongs. Returns - * true if the form was submitted successfully, false if the submission - * was cancelled. - * @protected - * @return {Boolean} - */ - submitForm: function () { - - var oForm = this.getForm(), - - oSrcElement = this.get("srcelement"), - - /* - Boolean indicating if the event fired successfully - (was not cancelled by any handlers) - */ - - bSubmitForm = false, - - oEvent; - - - if (oForm) { - - if (this.get("type") == "submit" || - (oSrcElement && oSrcElement.type == "submit")) - { - - m_oSubmitTrigger = this; - - } - - - if (YAHOO.env.ua.ie) { - - bSubmitForm = oForm.fireEvent("onsubmit"); - - } - else { // Gecko, Opera, and Safari - - oEvent = document.createEvent("HTMLEvents"); - oEvent.initEvent("submit", true, true); - - bSubmitForm = oForm.dispatchEvent(oEvent); - - } - - - /* - In IE and Safari, dispatching a "submit" event to a form - WILL cause the form's "submit" event to fire, but WILL NOT - submit the form. Therefore, we need to call the "submit" - method as well. - */ - - if ((YAHOO.env.ua.ie || YAHOO.env.ua.webkit) && bSubmitForm) { - - oForm.submit(); - - } - - } - - return bSubmitForm; - - }, - - - /** - * @method init - * @description The Button class's initialization method. - * @param {String} p_oElement String specifying the id attribute of the - * <input>, <button>, - * <a>, or <span> element to - * be used to create the button. - * @param {HTMLInputElement|HTMLButtonElement| - * HTMLElement} p_oElement Object reference for the - * <input>, <button>, - * <a>, or <span> element to be - * used to create the button. - * @param {Object} p_oElement Object literal specifying a set of - * configuration attributes used to create the button. - * @param {Object} p_oAttributes Optional. Object literal specifying a - * set of configuration attributes used to create the button. - */ - init: function (p_oElement, p_oAttributes) { - - var sNodeName = p_oAttributes.type == "link" ? "A" : "BUTTON", - oSrcElement = p_oAttributes.srcelement, - oButton = p_oElement.getElementsByTagName(sNodeName)[0], - oInput; - - - if (!oButton) { - - oInput = p_oElement.getElementsByTagName("INPUT")[0]; - - - if (oInput) { - - oButton = document.createElement("BUTTON"); - oButton.setAttribute("type", "button"); - - oInput.parentNode.replaceChild(oButton, oInput); - - } - - } - - this._button = oButton; - - - YAHOO.widget.Button.superclass.init.call(this, p_oElement, - p_oAttributes); - - - m_oButtons[this.get("id")] = this; - - - this.addClass(this.CSS_CLASS_NAME); - - this.addClass("yui-" + this.get("type") + "-button"); - - Event.on(this._button, "focus", this._onFocus, null, this); - this.on("mouseover", this._onMouseOver); - this.on("click", this._onClick); - this.on("appendTo", this._onAppendTo); - - - var oContainer = this.get("container"), - oElement = this.get("element"), - bElInDoc = Dom.inDocument(oElement), - oParentNode; - - - if (oContainer) { - - if (oSrcElement && oSrcElement != oElement) { - - oParentNode = oSrcElement.parentNode; - - if (oParentNode) { - - oParentNode.removeChild(oSrcElement); - - } - - } - - if (Lang.isString(oContainer)) { - - Event.onContentReady(oContainer, function () { - - this.appendTo(oContainer); - - }, null, this); - - } - else { - - this.appendTo(oContainer); - - } - - } - else if (!bElInDoc && oSrcElement && oSrcElement != oElement) { - - oParentNode = oSrcElement.parentNode; - - if (oParentNode) { - - this.fireEvent("beforeAppendTo", { - type: "beforeAppendTo", - target: oParentNode - }); - - oParentNode.replaceChild(oElement, oSrcElement); - - this.fireEvent("appendTo", { - type: "appendTo", - target: oParentNode - }); - - } - - } - else if (this.get("type") != "link" && bElInDoc && oSrcElement && - oSrcElement == oElement) { - - this._addListenersToForm(); - - } - - - }, - - - /** - * @method initAttributes - * @description Initializes all of the configuration attributes used to - * create the button. - * @param {Object} p_oAttributes Object literal specifying a set of - * configuration attributes used to create the button. - */ - initAttributes: function (p_oAttributes) { - - var oAttributes = p_oAttributes || {}; - - YAHOO.widget.Button.superclass.initAttributes.call(this, - oAttributes); - - - /** - * @config type - * @description String specifying the button's type. Possible - * values are: "push," "link," "submit," "reset," "checkbox," - * "radio," "menu," and "split." - * @default "push" - * @type String - */ - this.setAttributeConfig("type", { - - value: (oAttributes.type || "push"), - validator: Lang.isString, - writeOnce: true, - method: this._setType - - }); - - - /** - * @config label - * @description String specifying the button's text label - * or innerHTML. - * @default null - * @type String - */ - this.setAttributeConfig("label", { - - value: oAttributes.label, - validator: Lang.isString, - method: this._setLabel - - }); - - - /** - * @config value - * @description Object specifying the value for the button. - * @default null - * @type Object - */ - this.setAttributeConfig("value", { - - value: oAttributes.value - - }); - - - /** - * @config name - * @description String specifying the name for the button. - * @default null - * @type String - */ - this.setAttributeConfig("name", { - - value: oAttributes.name, - validator: Lang.isString - - }); - - - /** - * @config tabindex - * @description Number specifying the tabindex for the button. - * @default null - * @type Number - */ - this.setAttributeConfig("tabindex", { - - value: oAttributes.tabindex, - validator: Lang.isNumber, - method: this._setTabIndex - - }); - - - /** - * @config title - * @description String specifying the title for the button. - * @default null - * @type String - */ - this.configureAttribute("title", { - - value: oAttributes.title, - validator: Lang.isString, - method: this._setTitle - - }); - - - /** - * @config disabled - * @description Boolean indicating if the button should be disabled. - * (Disabled buttons are dimmed and will not respond to user input - * or fire events. Does not apply to button's of type "link.") - * @default false - * @type Boolean - */ - this.setAttributeConfig("disabled", { - - value: (oAttributes.disabled || false), - validator: Lang.isBoolean, - method: this._setDisabled - - }); - - - /** - * @config href - * @description String specifying the href for the button. Applies - * only to buttons of type "link." - * @type String - */ - this.setAttributeConfig("href", { - - value: oAttributes.href, - validator: Lang.isString, - method: this._setHref - - }); - - - /** - * @config target - * @description String specifying the target for the button. - * Applies only to buttons of type "link." - * @type String - */ - this.setAttributeConfig("target", { - - value: oAttributes.target, - validator: Lang.isString, - method: this._setTarget - - }); - - - /** - * @config checked - * @description Boolean indicating if the button is checked. - * Applies only to buttons of type "radio" and "checkbox." - * @default false - * @type Boolean - */ - this.setAttributeConfig("checked", { - - value: (oAttributes.checked || false), - validator: Lang.isBoolean, - method: this._setChecked - - }); - - - /** - * @config container - * @description HTML element reference or string specifying the id - * attribute of the HTML element that the button's markup should be - * rendered into. - * @type HTMLElement|String - * @default null - */ - this.setAttributeConfig("container", { - - value: oAttributes.container, - writeOnce: true - - }); - - - /** - * @config srcelement - * @description Object reference to the HTML element (either - * <input> or <span>) - * used to create the button. - * @type HTMLElement|String - * @default null - */ - this.setAttributeConfig("srcelement", { - - value: oAttributes.srcelement, - writeOnce: true - - }); - - - /** - * @config menu - * @description Object specifying the menu for the button. - * The value can be one of the following: - *
    - *
  • Object specifying a - * YAHOO.widget.Menu instance.
  • - *
  • Object specifying a - * YAHOO.widget.Overlay instance.
  • - *
  • String specifying the id attribute of the <div> - * element used to create the menu. By default the menu - * will be created as an instance of - * YAHOO.widget.Overlay. - * If the - * default CSS class name for YAHOO.widget.Menu is applied to - * the <div> element, it will be created as an - * instance of YAHOO.widget.Menu - * .
  • String specifying the id attribute of the - * <select> element used to create the menu. - *
  • Object specifying the <div> element - * used to create the menu.
  • - *
  • Object specifying the <select> element - * used to create the menu.
  • - *
  • Array of object literals, each representing a set of - * YAHOO.widget.MenuItem - * configuration attributes.
  • - *
  • Array of strings representing the text labels for each menu - * item in the menu.
  • - *
- * @type YAHOO.widget.Menu|YAHOO.widget.Overlay|HTMLElement|String|Array - * @default null - */ - this.setAttributeConfig("menu", { - - value: null, - method: this._setMenu, - writeOnce: true - - }); - - - /** - * @config lazyloadmenu - * @description Boolean indicating the value to set for the - * "lazyload" - * configuration property of the button's menu. Setting - * "lazyloadmenu" to true will defer rendering of - * the button's menu until the first time it is made visible. - * If "lazyloadmenu" is set to false, the button's - * menu will be rendered immediately if the button is in the - * document, or in response to the button's "appendTo" event if - * the button is not yet in the document. In either case, the - * menu is rendered into the button's parent HTML element. - * This attribute does not apply if a - * YAHOO.widget.Menu or - * YAHOO.widget.Overlay - * instance is passed as the value of the button's "menu" - * configuration attribute. - * YAHOO.widget.Menu or - * YAHOO.widget.Overlay instances should be rendered before - * being set as the value for the "menu" configuration - * attribute. - * @default true - * @type Boolean - */ - this.setAttributeConfig("lazyloadmenu", { - - value: (oAttributes.lazyloadmenu === false ? false : true), - validator: Lang.isBoolean, - writeOnce: true - - }); - - - /** - * @config menuclassname - * @description String representing the CSS class name to be - * applied to the root element of the button's menu. - * @type String - * @default "yui-button-menu" - */ - this.setAttributeConfig("menuclassname", { - - value: (oAttributes.menuclassname || "yui-button-menu"), - validator: Lang.isString, - method: this._setMenuClassName, - writeOnce: true - - }); - - - /** - * @config selectedMenuItem - * @description Number representing the index of the item in the - * button's menu that is currently selected. - * @type Number - * @default null - */ - this.setAttributeConfig("selectedMenuItem", { - - value: 0, - validator: Lang.isNumber, - method: this._setSelectedMenuItem - - }); - - - /** - * @config onclick - * @description Object literal representing the code to be executed - * when the button is clicked. Format:
{
- * fn: Function, // The handler to call - * when the event fires.
obj: Object, - * // An object to pass back to the handler.
- * scope: Object // The object to use - * for the scope of the handler.
}
- * @type Object - * @default null - */ - this.setAttributeConfig("onclick", { - - value: oAttributes.onclick, - method: this._setOnClick - - }); - - - /** - * @config focusmenu - * @description Boolean indicating whether or not the button's menu - * should be focused when it is made visible. - * @type Boolean - * @default true - */ - this.setAttributeConfig("focusmenu", { - - value: (oAttributes.focusmenu === false ? false : true), - validator: Lang.isBoolean - - }); - - }, - - - /** - * @method focus - * @description Causes the button to receive the focus and fires the - * button's "focus" event. - */ - focus: function () { - - if (!this.get("disabled")) { - - this._button.focus(); - - } - - }, - - - /** - * @method blur - * @description Causes the button to lose focus and fires the button's - * "blur" event. - */ - blur: function () { - - if (!this.get("disabled")) { - - this._button.blur(); - - } - - }, - - - /** - * @method hasFocus - * @description Returns a boolean indicating whether or not the button - * has focus. - * @return {Boolean} - */ - hasFocus: function () { - - return (m_oFocusedButton == this); - - }, - - - /** - * @method isActive - * @description Returns a boolean indicating whether or not the button - * is active. - * @return {Boolean} - */ - isActive: function () { - - return this.hasClass(this.CSS_CLASS_NAME + "-active"); - - }, - - - /** - * @method getMenu - * @description Returns a reference to the button's menu. - * @return { - * YAHOO.widget.Overlay|YAHOO.widget.Menu} - */ - getMenu: function () { - - return this._menu; - - }, - - - /** - * @method getForm - * @description Returns a reference to the button's parent form. - * @return {HTMLFormElement} - */ - getForm: function () { - - return this._button.form; - - }, - - - /** - * @method getHiddenFields - * @description Returns an <input> element or - * array of form elements used to represent the button when its parent - * form is submitted. - * @return {HTMLInputElement|Array} - */ - getHiddenFields: function () { - - return this._hiddenFields; - - }, - - - /** - * @method destroy - * @description Removes the button's element from its parent element and - * removes all event handlers. - */ - destroy: function () { - - - var oElement = this.get("element"), - oParentNode = oElement.parentNode, - oMenu = this._menu; - - if (oMenu) { - - - oMenu.destroy(); - - } - - - Event.purgeElement(oElement); - Event.purgeElement(this._button); - Event.removeListener(document, "mouseup", this._onDocumentMouseUp); - Event.removeListener(document, "keyup", this._onDocumentKeyUp); - Event.removeListener(document, "mousedown", - this._onDocumentMouseDown); - - - var oForm = this.getForm(); - - if (oForm) { - - Event.removeListener(oForm, "reset", this._onFormReset); - Event.removeListener(oForm, "submit", this.createHiddenFields); - - } - - - oParentNode.removeChild(oElement); - - - delete m_oButtons[this.get("id")]; - - - }, - - - fireEvent: function (p_sType , p_aArgs) { - - // Disabled buttons should not respond to DOM events - - if (this.DOM_EVENTS[p_sType] && this.get("disabled")) { - - return; - - } - - YAHOO.widget.Button.superclass.fireEvent.call(this, p_sType, - p_aArgs); - - }, - - - /** - * @method toString - * @description Returns a string representing the button. - * @return {String} - */ - toString: function () { - - return ("Button " + this.get("id")); - - } - - }); - - - /** - * @method YAHOO.widget.Button.onFormKeyPress - * @description "keypress" event handler for the button's form. - * @param {Event} p_oEvent Object representing the DOM event object passed - * back by the event utility (YAHOO.util.Event). - */ - YAHOO.widget.Button.onFormKeyPress = function (p_oEvent) { - - var oTarget = Event.getTarget(p_oEvent), - nCharCode = Event.getCharCode(p_oEvent), - sNodeName = oTarget.nodeName && oTarget.nodeName.toUpperCase(), - sType = oTarget.type, - - /* - Boolean indicating if the form contains any enabled or - disabled YUI submit buttons - */ - - bFormContainsYUIButtons = false, - - oButton, - - oYUISubmitButton, // The form's first, enabled YUI submit button - - /* - The form's first, enabled HTML submit button that precedes any - YUI submit button - */ - - oPrecedingSubmitButton, - - - /* - The form's first, enabled HTML submit button that follows a - YUI button - */ - - oFollowingSubmitButton; - - - function isSubmitButton(p_oElement) { - - var sId, - oSrcElement; - - switch (p_oElement.nodeName.toUpperCase()) { - - case "INPUT": - case "BUTTON": - - if (p_oElement.type == "submit" && !p_oElement.disabled) { - - if (!bFormContainsYUIButtons && - !oPrecedingSubmitButton) { - - oPrecedingSubmitButton = p_oElement; - - } - - if (oYUISubmitButton && !oFollowingSubmitButton) { - - oFollowingSubmitButton = p_oElement; - - } - - } - - break; - - - default: - - sId = p_oElement.id; - - if (sId) { - - oButton = m_oButtons[sId]; - - if (oButton) { - - bFormContainsYUIButtons = true; - - if (!oButton.get("disabled")) { - - oSrcElement = oButton.get("srcelement"); - - if (!oYUISubmitButton && - (oButton.get("type") == "submit" || - (oSrcElement && oSrcElement.type == "submit"))) - { - - oYUISubmitButton = oButton; - - } - - } - - } - - } - - break; - - } - - } - - - if (nCharCode == 13 && ((sNodeName == "INPUT" && (sType == "text" || - sType == "password" || sType == "checkbox" || sType == "radio" || - sType == "file") ) || sNodeName == "SELECT")) - { - - Dom.getElementsBy(isSubmitButton, "*", this); - - - if (oPrecedingSubmitButton) { - - /* - Need to set focus to the first enabled submit button - to make sure that IE includes its name and value - in the form's data set. - */ - - oPrecedingSubmitButton.focus(); - - } - else if (!oPrecedingSubmitButton && oYUISubmitButton) { - - if (oFollowingSubmitButton) { - - /* - Need to call "preventDefault" to ensure that - the name and value of the regular submit button - following the YUI button doesn't get added to the - form's data set when it is submitted. - */ - - Event.preventDefault(p_oEvent); - - } - - oYUISubmitButton.submitForm(); - - } - - } - - }; - - - /** - * @method addHiddenFieldsToForm - * @description Searches the specified form and adds hidden fields for - * instances of YAHOO.widget.Button that are of type "radio," "checkbox," - * "menu," and "split." - * @param {HTMLFormElement} p_oForm Object reference - * for the form to search. - */ - YAHOO.widget.Button.addHiddenFieldsToForm = function (p_oForm) { - - var aButtons = Dom.getElementsByClassName( - YAHOO.widget.Button.prototype.CSS_CLASS_NAME, - "*", - p_oForm), - - nButtons = aButtons.length, - oButton, - sId, - i; - - if (nButtons > 0) { - - - for (i = 0; i < nButtons; i++) { - - sId = aButtons[i].id; - - if (sId) { - - oButton = m_oButtons[sId]; - - if (oButton) { - - oButton.createHiddenFields(); - - } - - } - - } - - } - - }; - - - - // Events - - - /** - * @event focus - * @description Fires when the menu item receives focus. Passes back a - * single object representing the original DOM event object passed back by - * the event utility (YAHOO.util.Event) when the event was fired. See - * Element.addListener - * for more information on listening for this event. - * @type YAHOO.util.CustomEvent - */ - - - /** - * @event blur - * @description Fires when the menu item loses the input focus. Passes back - * a single object representing the original DOM event object passed back by - * the event utility (YAHOO.util.Event) when the event was fired. See - * Element.addListener for - * more information on listening for this event. - * @type YAHOO.util.CustomEvent - */ - - - /** - * @event option - * @description Fires when the user invokes the button's option. Passes - * back a single object representing the original DOM event (either - * "mousedown" or "keydown") that caused the "option" event to fire. See - * Element.addListener - * for more information on listening for this event. - * @type YAHOO.util.CustomEvent - */ - -})(); -(function () { - - // Shorthard for utilities - - var Dom = YAHOO.util.Dom, - Event = YAHOO.util.Event, - Lang = YAHOO.lang, - Button = YAHOO.widget.Button, - - // Private collection of radio buttons - - m_oButtons = {}; - - - - /** - * The ButtonGroup class creates a set of buttons that are mutually - * exclusive; checking one button in the set will uncheck all others in the - * button group. - * @param {String} p_oElement String specifying the id attribute of the - * <div> element of the button group. - * @param {HTMLDivElement} p_oElement Object - * specifying the <div> element of the button group. - * @param {Object} p_oElement Object literal specifying a set of - * configuration attributes used to create the button group. - * @param {Object} p_oAttributes Optional. Object literal specifying a set - * of configuration attributes used to create the button group. - * @namespace YAHOO.widget - * @class ButtonGroup - * @constructor - * @extends YAHOO.util.Element - */ - YAHOO.widget.ButtonGroup = function (p_oElement, p_oAttributes) { - - var fnSuperClass = YAHOO.widget.ButtonGroup.superclass.constructor, - sNodeName, - oElement, - sId; - - if (arguments.length == 1 && !Lang.isString(p_oElement) && - !p_oElement.nodeName) { - - if (!p_oElement.id) { - - sId = Dom.generateId(); - - p_oElement.id = sId; - - - } - - - - fnSuperClass.call(this, (this._createGroupElement()), p_oElement); - - } - else if (Lang.isString(p_oElement)) { - - oElement = Dom.get(p_oElement); - - if (oElement) { - - if (oElement.nodeName.toUpperCase() == this.NODE_NAME) { - - - fnSuperClass.call(this, oElement, p_oAttributes); - - } - - } - - } - else { - - sNodeName = p_oElement.nodeName; - - if (sNodeName && sNodeName == this.NODE_NAME) { - - if (!p_oElement.id) { - - p_oElement.id = Dom.generateId(); - - - } - - - fnSuperClass.call(this, p_oElement, p_oAttributes); - - } - - } - - }; - - - YAHOO.extend(YAHOO.widget.ButtonGroup, YAHOO.util.Element, { - - - // Protected properties - - - /** - * @property _buttons - * @description Array of buttons in the button group. - * @default null - * @protected - * @type Array - */ - _buttons: null, - - - - // Constants - - - /** - * @property NODE_NAME - * @description The name of the tag to be used for the button - * group's element. - * @default "DIV" - * @final - * @type String - */ - NODE_NAME: "DIV", - - - /** - * @property CSS_CLASS_NAME - * @description String representing the CSS class(es) to be applied - * to the button group's element. - * @default "yui-buttongroup" - * @final - * @type String - */ - CSS_CLASS_NAME: "yui-buttongroup", - - - - // Protected methods - - - /** - * @method _createGroupElement - * @description Creates the button group's element. - * @protected - * @return {HTMLDivElement} - */ - _createGroupElement: function () { - - var oElement = document.createElement(this.NODE_NAME); - - return oElement; - - }, - - - - // Protected attribute setter methods - - - /** - * @method _setDisabled - * @description Sets the value of the button groups's - * "disabled" attribute. - * @protected - * @param {Boolean} p_bDisabled Boolean indicating the value for - * the button group's "disabled" attribute. - */ - _setDisabled: function (p_bDisabled) { - - var nButtons = this.getCount(), - i; - - if (nButtons > 0) { - - i = nButtons - 1; - - do { - - this._buttons[i].set("disabled", p_bDisabled); - - } - while (i--); - - } - - }, - - - - // Protected event handlers - - - /** - * @method _onKeyDown - * @description "keydown" event handler for the button group. - * @protected - * @param {Event} p_oEvent Object representing the DOM event object - * passed back by the event utility (YAHOO.util.Event). - */ - _onKeyDown: function (p_oEvent) { - - var oTarget = Event.getTarget(p_oEvent), - nCharCode = Event.getCharCode(p_oEvent), - sId = oTarget.parentNode.parentNode.id, - oButton = m_oButtons[sId], - nIndex = -1; - - - if (nCharCode == 37 || nCharCode == 38) { - - nIndex = (oButton.index === 0) ? - (this._buttons.length - 1) : (oButton.index - 1); - - } - else if (nCharCode == 39 || nCharCode == 40) { - - nIndex = (oButton.index === (this._buttons.length - 1)) ? - 0 : (oButton.index + 1); - - } - - - if (nIndex > -1) { - - this.check(nIndex); - this.getButton(nIndex).focus(); - - } - - }, - - - /** - * @method _onAppendTo - * @description "appendTo" event handler for the button group. - * @protected - * @param {Event} p_oEvent Object representing the event that was fired. - */ - _onAppendTo: function (p_oEvent) { - - var aButtons = this._buttons, - nButtons = aButtons.length, - i; - - for (i = 0; i < nButtons; i++) { - - aButtons[i].appendTo(this.get("element")); - - } - - }, - - - /** - * @method _onButtonCheckedChange - * @description "checkedChange" event handler for each button in the - * button group. - * @protected - * @param {Event} p_oEvent Object representing the event that was fired. - * @param {YAHOO.widget.Button} - * p_oButton Object representing the button that fired the event. - */ - _onButtonCheckedChange: function (p_oEvent, p_oButton) { - - var bChecked = p_oEvent.newValue, - oCheckedButton = this.get("checkedButton"); - - if (bChecked && oCheckedButton != p_oButton) { - - if (oCheckedButton) { - - oCheckedButton.set("checked", false, true); - - } - - this.set("checkedButton", p_oButton); - this.set("value", p_oButton.get("value")); - - } - else if (oCheckedButton && !oCheckedButton.set("checked")) { - - oCheckedButton.set("checked", true, true); - - } - - }, - - - - // Public methods - - - /** - * @method init - * @description The ButtonGroup class's initialization method. - * @param {String} p_oElement String specifying the id attribute of the - * <div> element of the button group. - * @param {HTMLDivElement} p_oElement Object - * specifying the <div> element of the button group. - * @param {Object} p_oElement Object literal specifying a set of - * configuration attributes used to create the button group. - * @param {Object} p_oAttributes Optional. Object literal specifying a - * set of configuration attributes used to create the button group. - */ - init: function (p_oElement, p_oAttributes) { - - this._buttons = []; - - YAHOO.widget.ButtonGroup.superclass.init.call(this, p_oElement, - p_oAttributes); - - this.addClass(this.CSS_CLASS_NAME); - - - var aButtons = this.getElementsByClassName("yui-radio-button"); - - - if (aButtons.length > 0) { - - - this.addButtons(aButtons); - - } - - - - function isRadioButton(p_oElement) { - - return (p_oElement.type == "radio"); - - } - - aButtons = - Dom.getElementsBy(isRadioButton, "input", this.get("element")); - - - if (aButtons.length > 0) { - - - this.addButtons(aButtons); - - } - - this.on("keydown", this._onKeyDown); - this.on("appendTo", this._onAppendTo); - - - var oContainer = this.get("container"); - - if (oContainer) { - - if (Lang.isString(oContainer)) { - - Event.onContentReady(oContainer, function () { - - this.appendTo(oContainer); - - }, null, this); - - } - else { - - this.appendTo(oContainer); - - } - - } - - - - }, - - - /** - * @method initAttributes - * @description Initializes all of the configuration attributes used to - * create the button group. - * @param {Object} p_oAttributes Object literal specifying a set of - * configuration attributes used to create the button group. - */ - initAttributes: function (p_oAttributes) { - - var oAttributes = p_oAttributes || {}; - - YAHOO.widget.ButtonGroup.superclass.initAttributes.call( - this, oAttributes); - - - /** - * @config name - * @description String specifying the name for the button group. - * This name will be applied to each button in the button group. - * @default null - * @type String - */ - this.setAttributeConfig("name", { - - value: oAttributes.name, - validator: Lang.isString - - }); - - - /** - * @config disabled - * @description Boolean indicating if the button group should be - * disabled. Disabling the button group will disable each button - * in the button group. Disabled buttons are dimmed and will not - * respond to user input or fire events. - * @default false - * @type Boolean - */ - this.setAttributeConfig("disabled", { - - value: (oAttributes.disabled || false), - validator: Lang.isBoolean, - method: this._setDisabled - - }); - - - /** - * @config value - * @description Object specifying the value for the button group. - * @default null - * @type Object - */ - this.setAttributeConfig("value", { - - value: oAttributes.value - - }); - - - /** - * @config container - * @description HTML element reference or string specifying the id - * attribute of the HTML element that the button group's markup - * should be rendered into. - * @type HTMLElement|String - * @default null - */ - this.setAttributeConfig("container", { - - value: oAttributes.container, - writeOnce: true - - }); - - - /** - * @config checkedButton - * @description Reference for the button in the button group that - * is checked. - * @type {YAHOO.widget.Button} - * @default null - */ - this.setAttributeConfig("checkedButton", { - - value: null - - }); - - }, - - - /** - * @method addButton - * @description Adds the button to the button group. - * @param {YAHOO.widget.Button} - * p_oButton Object reference for the - * YAHOO.widget.Button instance to be added to the button group. - * @param {String} p_oButton String specifying the id attribute of the - * <input> or <span> element - * to be used to create the button to be added to the button group. - * @param {HTMLInputElement|HTMLElement} p_oButton Object reference for the - * <input> or <span> element - * to be used to create the button to be added to the button group. - * @param {Object} p_oButton Object literal specifying a set of - * YAHOO.widget.Button - * configuration attributes used to configure the button to be added to - * the button group. - * @return {YAHOO.widget.Button} - */ - addButton: function (p_oButton) { - - var oButton, - oButtonElement, - oGroupElement, - nIndex, - sButtonName, - sGroupName; - - - if (p_oButton instanceof Button && - p_oButton.get("type") == "radio") { - - oButton = p_oButton; - - } - else if (!Lang.isString(p_oButton) && !p_oButton.nodeName) { - - p_oButton.type = "radio"; - - oButton = new Button(p_oButton); - - } - else { - - oButton = new Button(p_oButton, { type: "radio" }); - - } - - - if (oButton) { - - nIndex = this._buttons.length; - sButtonName = oButton.get("name"); - sGroupName = this.get("name"); - - oButton.index = nIndex; - - this._buttons[nIndex] = oButton; - m_oButtons[oButton.get("id")] = oButton; - - - if (sButtonName != sGroupName) { - - oButton.set("name", sGroupName); - - } - - - if (this.get("disabled")) { - - oButton.set("disabled", true); - - } - - - if (oButton.get("checked")) { - - this.set("checkedButton", oButton); - - } - - - oButtonElement = oButton.get("element"); - oGroupElement = this.get("element"); - - if (oButtonElement.parentNode != oGroupElement) { - - oGroupElement.appendChild(oButtonElement); - - } - - - oButton.on("checkedChange", - this._onButtonCheckedChange, oButton, this); - - - return oButton; - - } - - }, - - - /** - * @method addButtons - * @description Adds the array of buttons to the button group. - * @param {Array} p_aButtons Array of - * YAHOO.widget.Button instances to be added - * to the button group. - * @param {Array} p_aButtons Array of strings specifying the id - * attribute of the <input> or <span> - * elements to be used to create the buttons to be added to the - * button group. - * @param {Array} p_aButtons Array of object references for the - * <input> or <span> elements - * to be used to create the buttons to be added to the button group. - * @param {Array} p_aButtons Array of object literals, each containing - * a set of YAHOO.widget.Button - * configuration attributes used to configure each button to be added - * to the button group. - * @return {Array} - */ - addButtons: function (p_aButtons) { - - var nButtons, - oButton, - aButtons, - i; - - if (Lang.isArray(p_aButtons)) { - - nButtons = p_aButtons.length; - aButtons = []; - - if (nButtons > 0) { - - for (i = 0; i < nButtons; i++) { - - oButton = this.addButton(p_aButtons[i]); - - if (oButton) { - - aButtons[aButtons.length] = oButton; - - } - - } - - if (aButtons.length > 0) { - - - return aButtons; - - } - - } - - } - - }, - - - /** - * @method removeButton - * @description Removes the button at the specified index from the - * button group. - * @param {Number} p_nIndex Number specifying the index of the button - * to be removed from the button group. - */ - removeButton: function (p_nIndex) { - - var oButton = this.getButton(p_nIndex), - nButtons, - i; - - if (oButton) { - - - this._buttons.splice(p_nIndex, 1); - delete m_oButtons[oButton.get("id")]; - - oButton.removeListener("checkedChange", - this._onButtonCheckedChange); - - oButton.destroy(); - - - nButtons = this._buttons.length; - - if (nButtons > 0) { - - i = this._buttons.length - 1; - - do { - - this._buttons[i].index = i; - - } - while (i--); - - } - - - } - - }, - - - /** - * @method getButton - * @description Returns the button at the specified index. - * @param {Number} p_nIndex The index of the button to retrieve from the - * button group. - * @return {YAHOO.widget.Button} - */ - getButton: function (p_nIndex) { - - if (Lang.isNumber(p_nIndex)) { - - return this._buttons[p_nIndex]; - - } - - }, - - - /** - * @method getButtons - * @description Returns an array of the buttons in the button group. - * @return {Array} - */ - getButtons: function () { - - return this._buttons; - - }, - - - /** - * @method getCount - * @description Returns the number of buttons in the button group. - * @return {Number} - */ - getCount: function () { - - return this._buttons.length; - - }, - - - /** - * @method focus - * @description Sets focus to the button at the specified index. - * @param {Number} p_nIndex Number indicating the index of the button - * to focus. - */ - focus: function (p_nIndex) { - - var oButton, - nButtons, - i; - - if (Lang.isNumber(p_nIndex)) { - - oButton = this._buttons[p_nIndex]; - - if (oButton) { - - oButton.focus(); - - } - - } - else { - - nButtons = this.getCount(); - - for (i = 0; i < nButtons; i++) { - - oButton = this._buttons[i]; - - if (!oButton.get("disabled")) { - - oButton.focus(); - break; - - } - - } - - } - - }, - - - /** - * @method check - * @description Checks the button at the specified index. - * @param {Number} p_nIndex Number indicating the index of the button - * to check. - */ - check: function (p_nIndex) { - - var oButton = this.getButton(p_nIndex); - - if (oButton) { - - oButton.set("checked", true); - - } - - }, - - - /** - * @method destroy - * @description Removes the button group's element from its parent - * element and removes all event handlers. - */ - destroy: function () { - - - var nButtons = this._buttons.length, - oElement = this.get("element"), - oParentNode = oElement.parentNode, - i; - - if (nButtons > 0) { - - i = this._buttons.length - 1; - - do { - - this._buttons[i].destroy(); - - } - while (i--); - - } - - - Event.purgeElement(oElement); - - - oParentNode.removeChild(oElement); - - }, - - - /** - * @method toString - * @description Returns a string representing the button group. - * @return {String} - */ - toString: function () { - - return ("ButtonGroup " + this.get("id")); - - } - - }); - -})(); -YAHOO.register("button", YAHOO.widget.Button, {version: "2.3.0", build: "442"}); diff --git a/lib/yui/colorpicker/colorpicker-beta-debug.js b/lib/yui/colorpicker/colorpicker-beta-debug.js deleted file mode 100755 index 83d861b64f0e2..0000000000000 --- a/lib/yui/colorpicker/colorpicker-beta-debug.js +++ /dev/null @@ -1,1745 +0,0 @@ -/* -Copyright (c) 2007, Yahoo! Inc. All rights reserved. -Code licensed under the BSD License: -http://developer.yahoo.net/yui/license.txt -version: 2.3.0 -*/ -/** - * Provides color conversion and validation utils - * @class YAHOO.util.Color - * @namespace YAHOO.util - */ -YAHOO.util.Color = function() { - - var HCHARS="0123456789ABCDEF", lang=YAHOO.lang; - - return { - - /** - * Converts 0-1 to 0-255 - * @method real2dec - * @param n {float} the number to convert - * @return {int} a number 0-255 - */ - real2dec: function(n) { - return Math.min(255, Math.round(n*256)); - }, - - /** - * Converts HSV (h[0-360], s[0-1]), v[0-1] to RGB [255,255,255] - * @method hsv2rgb - * @param h {int|[int, float, float]} the hue, or an - * array containing all three parameters - * @param s {float} the saturation - * @param v {float} the value/brightness - * @return {[int, int, int]} the red, green, blue values in - * decimal. - */ - hsv2rgb: function(h, s, v) { - - if (lang.isArray(h)) { - return this.hsv2rgb.call(this, h[0], h[1], h[2]); - } - - var r, g, b, i, f, p, q, t; - i = Math.floor((h/60)%6); - f = (h/60)-i; - p = v*(1-s); - q = v*(1-f*s); - t = v*(1-(1-f)*s); - switch(i) { - case 0: r=v; g=t; b=p; break; - case 1: r=q; g=v; b=p; break; - case 2: r=p; g=v; b=t; break; - case 3: r=p; g=q; b=v; break; - case 4: r=t; g=p; b=v; break; - case 5: r=v; g=p; b=q; break; - } - - var fn=this.real2dec; - - return [fn(r), fn(g), fn(b)]; - }, - - /** - * Converts to RGB [255,255,255] to HSV (h[0-360], s[0-1]), v[0-1] - * @method rgb2hsv - * @param r {int|[int, int, int]} the red value, or an - * array containing all three parameters - * @param g {int} the green value - * @param b {int} the blue value - * @return {[int, float, float]} the value converted to hsv - */ - rgb2hsv: function(r, g, b) { - - if (lang.isArray(r)) { - return this.rgb2hsv.call(this, r[0], r[1], r[2]); - } - - r=r/255; - g=g/255; - b=b/255; - - var min,max,delta,h,s,v; - min = Math.min(Math.min(r,g),b); - max = Math.max(Math.max(r,g),b); - delta = max-min; - - switch (max) { - case min: h=0; break; - case r: h=60*(g-b)/delta; - if (g FFFFFF - * @method rgb2hex - * @param r {int|[int, int, int]} the red value, or an - * array containing all three parameters - * @param g {int} the green value - * @param b {int} the blue value - * @return {string} the hex string - */ - rgb2hex: function(r, g, b) { - if (lang.isArray(r)) { - return this.rgb2hex.call(this, r[0], r[1], r[2]); - } - - var f=this.dec2hex; - return f(r) + f(g) + f(b); - }, - - /** - * Converts an int 0...255 to hex pair 00...FF - * @method dec2hex - * @param n {int} the number to convert - * @return {string} the hex equivalent - */ - dec2hex: function(n) { - n = parseInt(n, 10); - n = (lang.isNumber(n)) ? n : 0; - n = (n > 255 || n < 0) ? 0 : n; - - return HCHARS.charAt((n - n % 16) / 16) + HCHARS.charAt(n % 16); - }, - - /** - * Converts a hex pair 00...FF to an int 0...255 - * @method hex2dec - * @param str {string} the hex pair to convert - * @return {int} the decimal - */ - hex2dec: function(str) { - var f = function(c) { - return HCHARS.indexOf(c.toUpperCase()); - }; - - var s=str.split(''); - - return ((f(s[0]) * 16) + f(s[1])); - }, - - /** - * Converts a hex string to rgb - * @method hex2rgb - * @param str {string} the hex string - * @return {[int, int, int]} an array containing the rgb values - */ - hex2rgb: function(s) { - var f = this.hex2dec; - return [f(s.substr(0, 2)), f(s.substr(2, 2)), f(s.substr(4, 2))]; - }, - - /** - * Returns the closest websafe color to the supplied rgb value. - * @method websafe - * @param r {int|[int, int, int]} the red value, or an - * array containing all three parameters - * @param g {int} the green value - * @param b {int} the blue value - * @return {[int, int, int]} an array containing the closes - * websafe rgb colors. - */ - websafe: function(r, g, b) { - - if (lang.isArray(r)) { - return this.websafe.call(this, r[0], r[1], r[2]); - } - - // returns the closest match [0, 51, 102, 153, 204, 255] - var f = function(v) { - if (lang.isNumber(v)) { - v = Math.min(Math.max(0, v), 255); - var i, next; - for (i=0; i<256; i=i+51) { - next = i+51; - if (v >= i && v <= next) { - return (v-i > 25) ? next : i; - } - } - YAHOO.log("Error calculating the websafe value for " + v, "warn"); - } - - return v; - }; - - return [f(r), f(g), f(b)]; - } - }; -}(); - - -(function() { - - var pickercount = 0; - - /** - * The colorpicker module provides a widget for selecting colors - * @module colorpicker - * @requires yahoo, dom, event, element, slider - */ - - /** - * A widget to select colors - * @namespace YAHOO.widget - * @class YAHOO.widget.ColorPicker - * @extends YAHOO.util.Element - * @constructor - * @param {HTMLElement | String | Object} el(optional) The html - * element that represents the colorpicker, or the attribute object to use. - * An element will be created if none provided. - * @param {Object} attr (optional) A key map of the colorpicker's - * initial attributes. Ignored if first arg is attributes object. - */ - YAHOO.widget.ColorPicker = function(el, attr) { - pickercount = pickercount + 1; - this.logger = new YAHOO.widget.LogWriter("ColorPicker"); - attr = attr || {}; - if (arguments.length === 1 && !YAHOO.lang.isString(el) && !el.nodeName) { - attr = el; // treat first arg as attr object - el = attr.element || null; - } - - if (!el && !attr.element) { // create if we dont have one - this.logger.log("creating host element"); - el = _createHostElement.call(this, attr); - } - - YAHOO.widget.ColorPicker.superclass.constructor.call(this, el, attr); - }; - - YAHOO.extend(YAHOO.widget.ColorPicker, YAHOO.util.Element); - - var proto = YAHOO.widget.ColorPicker.prototype, - Slider=YAHOO.widget.Slider, - Color=YAHOO.util.Color, - Dom = YAHOO.util.Dom, - Event = YAHOO.util.Event, - lang = YAHOO.lang, - sub = lang.substitute; - - - var b = "yui-picker"; - - /** - * The element ids used by this control - * @property ID - * @final - */ - proto.ID = { - - /** - * The id for the "red" form field - * @property ID.R - * @type String - * @final - * @default yui-picker-r - */ - R: b + "-r", - - /** - * The id for the "red" hex pair output - * @property ID.R_HEX - * @type String - * @final - * @default yui-picker-rhex - */ - R_HEX: b + "-rhex", - - /** - * The id for the "green" form field - * @property ID.G - * @type String - * @final - * @default yui-picker-g - */ - G: b + "-g", - - /** - * The id for the "green" hex pair output - * @property ID.G_HEX - * @type String - * @final - * @default yui-picker-ghex - */ - G_HEX: b + "-ghex", - - - /** - * The id for the "blue" form field - * @property ID.B - * @type String - * @final - * @default yui-picker-b - */ - B: b + "-b", - - /** - * The id for the "blue" hex pair output - * @property ID.B_HEX - * @type String - * @final - * @default yui-picker-bhex - */ - B_HEX: b + "-bhex", - - /** - * The id for the "hue" form field - * @property ID.H - * @type String - * @final - * @default yui-picker-h - */ - H: b + "-h", - - /** - * The id for the "saturation" form field - * @property ID.S - * @type String - * @final - * @default yui-picker-s - */ - S: b + "-s", - - /** - * The id for the "value" form field - * @property ID.V - * @type String - * @final - * @default yui-picker-v - */ - V: b + "-v", - - /** - * The id for the picker region slider - * @property ID.PICKER_BG - * @type String - * @final - * @default yui-picker-bg - */ - PICKER_BG: b + "-bg", - - /** - * The id for the picker region thumb - * @property ID.PICKER_THUMB - * @type String - * @final - * @default yui-picker-thumb - */ - PICKER_THUMB: b + "-thumb", - - /** - * The id for the hue slider - * @property ID.HUE_BG - * @type String - * @final - * @default yui-picker-hue-bg - */ - HUE_BG: b + "-hue-bg", - - /** - * The id for the hue thumb - * @property ID.HUE_THUMB - * @type String - * @final - * @default yui-picker-hue-thumb - */ - HUE_THUMB: b + "-hue-thumb", - - /** - * The id for the hex value form field - * @property ID.HEX - * @type String - * @final - * @default yui-picker-hex - */ - HEX: b + "-hex", - - /** - * The id for the color swatch - * @property ID.SWATCH - * @type String - * @final - * @default yui-picker-swatch - */ - SWATCH: b + "-swatch", - - /** - * The id for the websafe color swatch - * @property ID.WEBSAFE_SWATCH - * @type String - * @final - * @default yui-picker-websafe-swatch - */ - WEBSAFE_SWATCH: b + "-websafe-swatch", - - /** - * The id for the control details - * @property ID.CONTROLS - * @final - * @default yui-picker-controls - */ - CONTROLS: b + "-controls", - - /** - * The id for the rgb controls - * @property ID.RGB_CONTROLS - * @final - * @default yui-picker-rgb-controls - */ - RGB_CONTROLS: b + "-rgb-controls", - - /** - * The id for the hsv controls - * @property ID.HSV_CONTROLS - * @final - * @default yui-picker-hsv-controls - */ - HSV_CONTROLS: b + "-hsv-controls", - - /** - * The id for the hsv controls - * @property ID.HEX_CONTROLS - * @final - * @default yui-picker-hex-controls - */ - HEX_CONTROLS: b + "-hex-controls", - - /** - * The id for the hex summary - * @property ID.HEX_SUMMARY - * @final - * @default yui-picker-hex-summary - */ - HEX_SUMMARY: b + "-hex-summary", - - /** - * The id for the controls section header - * @property ID.CONTROLS_LABEL - * @final - * @default yui-picker-controls-label - */ - CONTROLS_LABEL: b + "-controls-label" - }; - - /** - * Constants for any script-generated messages. The values here - * are the default messages. They can be updated by providing - * the complete list to the constructor for the "txt" attribute. - * @property TXT - * @final - */ - proto.TXT = { - ILLEGAL_HEX: "Illegal hex value entered", - SHOW_CONTROLS: "Show color details", - HIDE_CONTROLS: "Hide color details", - CURRENT_COLOR: "Currently selected color: {rgb}", - CLOSEST_WEBSAFE: "Closest websafe color: {rgb}. Click to select.", - R: "R", - G: "G", - B: "B", - H: "H", - S: "S", - V: "V", - HEX: "#", - DEG: "\u00B0", - PERCENT: "%" - }; - - /** - * Constants for the default image locations for img tags that are - * generated by the control. They can be modified by passing the - * complete list to the contructor for the "images" attribute - * @property IMAGE - * @final - */ - proto.IMAGE = { - PICKER_THUMB: "../../build/colorpicker/assets/picker_thumb.png", - HUE_THUMB: "../../build/colorpicker/assets/hue_thumb.png" - }; - - /* - * Constants for the control's custom event names. subscribe - * to the rgbChange event instead. - * @property EVENT - * @final - */ - //proto.EVENT = { - //CHANGE: "change" - //}; - - //proto.CSS = { }; - - /** - * Constants for the control's default default values - * @property DEFAULT - * @final - */ - proto.DEFAULT = { - PICKER_SIZE: 180 - }; - - /** - * Constants for the control's configuration attributes - * @property OPT - * @final - */ - proto.OPT = { - HUE: "hue", - SATURATION: "saturation", - VALUE: "value", - RED: "red", - GREEN: "green", - BLUE: "blue", - HSV: "hsv", - RGB: "rgb", - WEBSAFE: "websafe", - HEX: "hex", - PICKER_SIZE: "pickersize", - SHOW_CONTROLS: "showcontrols", - SHOW_RGB_CONTROLS: "showrgbcontrols", - SHOW_HSV_CONTROLS: "showhsvcontrols", - SHOW_HEX_CONTROLS: "showhexcontrols", - SHOW_HEX_SUMMARY: "showhexsummary", - SHOW_WEBSAFE: "showwebsafe", - //SHOW_SUBMIT: "showsubmit", - CONTAINER: "container", - IDS: "ids", - ELEMENTS: "elements", - TXT: "txt", - IMAGES: "images", - ANIMATE: "animate" - }; - - /** - * Sets the control to the specified rgb value and - * moves the sliders to the proper positions - * @method setValue - * @param rgb {[int, int, int]} the rgb value - * @param silent {boolean} whether or not to fire the change event - */ - proto.setValue = function(rgb, silent) { - silent = (silent) || false; - this.set(this.OPT.RGB, rgb, silent); - _updateSliders.call(this); - }; - - /** - * The hue slider - * @property hueSlider - * @type YAHOO.widget.Slider - */ - proto.hueSlider = null; - - /** - * The picker region - * @property pickerSlider - * @type YAHOO.widget.Slider - */ - proto.pickerSlider = null; - - /** - * Translates the slider value into hue, int[0,359] - * @method _getH - * @private - * @return {int} the hue from 0 to 359 - */ - var _getH = function() { - var size = this.get(this.OPT.PICKER_SIZE), - h = (size - this.hueSlider.getValue()) / size; - h = Math.round(h*360); - return (h === 360) ? 0 : h; - }; - - /** - * Translates the slider value into saturation, int[0,1], left to right - * @method _getS - * @private - * @return {int} the saturation from 0 to 1 - */ - var _getS = function() { - return this.pickerSlider.getXValue() / this.get(this.OPT.PICKER_SIZE); - }; - - /** - * Translates the slider value into value/brightness, int[0,1], top - * to bottom - * @method _getV - * @private - * @return {int} the value from 0 to 1 - */ - var _getV = function() { - var size = this.get(this.OPT.PICKER_SIZE); - return (size - this.pickerSlider.getYValue()) / size; - }; - - /** - * Updates the background of the swatch with the current rbg value. - * Also updates the websafe swatch to the closest websafe color - * @method _updateSwatch - * @private - */ - var _updateSwatch = function() { - var rgb = this.get(this.OPT.RGB), - websafe = this.get(this.OPT.WEBSAFE), - el = this.getElement(this.ID.SWATCH), - color = rgb.join(","), - txt = this.get(this.OPT.TXT); - - Dom.setStyle(el, "background-color", "rgb(" + color + ")"); - el.title = lang.substitute(txt.CURRENT_COLOR, { - "rgb": "#" + this.get(this.OPT.HEX) - }); - - - el = this.getElement(this.ID.WEBSAFE_SWATCH); - color = websafe.join(","); - - Dom.setStyle(el, "background-color", "rgb(" + color + ")"); - el.title = lang.substitute(txt.CLOSEST_WEBSAFE, { - "rgb": "#" + Color.rgb2hex(websafe) - }); - - }; - - /** - * Reads the sliders and converts the values to RGB, updating the - * internal state for all the individual form fields - * @method _getValuesFromSliders - * @private - */ - var _getValuesFromSliders = function() { - var h=_getH.call(this), s=_getS.call(this), v=_getV.call(this); - YAHOO.log("hsv " + [h, s, v]); - - rgb = Color.hsv2rgb(h, s, v); - var websafe = Color.websafe(rgb); - var hex = Color.rgb2hex(rgb[0], rgb[1], rgb[2]); - - this.set(this.OPT.RGB, rgb); - }; - - /** - * Updates the form field controls with the state data contained - * in the control. - * @method _updateFormFields - * @private - */ - var _updateFormFields = function() { - this.getElement(this.ID.H).value = this.get(this.OPT.HUE); - this.getElement(this.ID.S).value = this.get(this.OPT.SATURATION); - this.getElement(this.ID.V).value = this.get(this.OPT.VALUE); - this.getElement(this.ID.R).value = this.get(this.OPT.RED); - this.getElement(this.ID.R_HEX).innerHTML = Color.dec2hex(this.get(this.OPT.RED)); - this.getElement(this.ID.G).value = this.get(this.OPT.GREEN); - this.getElement(this.ID.G_HEX).innerHTML = Color.dec2hex(this.get(this.OPT.GREEN)); - this.getElement(this.ID.B).value = this.get(this.OPT.BLUE); - this.getElement(this.ID.B_HEX).innerHTML = Color.dec2hex(this.get(this.OPT.BLUE)); - this.getElement(this.ID.HEX).value = this.get(this.OPT.HEX); - }; - - /** - * Event handler for the hue slider. - * @method _onHueSliderChange - * @param newOffset {int} pixels from the start position - * @private - */ - var _onHueSliderChange = function(newOffset) { - this.logger.log("hue update: " + newOffset , "warn"); - - var h = _getH.call(this); - this.set(this.OPT.HUE, h, true); - - // set picker background to the hue - var rgb = Color.hsv2rgb(h, 1, 1); - var styleDef = "rgb(" + rgb.join(",") + ")"; - - Dom.setStyle(this.getElement(this.ID.PICKER_BG), "background-color", styleDef); - - if (this.hueSlider.valueChangeSource === this.hueSlider.SOURCE_UI_EVENT) { - _getValuesFromSliders.call(this); - } - - _updateFormFields.call(this); - _updateSwatch.call(this); - }; - - /** - * Event handler for the picker slider, which controls the - * saturation and value/brightness. - * @method _onPickerSliderChange - * @param newOffset {{x: int, y: int}} x/y pixels from the start position - * @private - */ - var _onPickerSliderChange = function(newOffset) { - this.logger.log(sub("picker update [{x}, {y}]", newOffset)); - - var s=_getS.call(this), v=_getV.call(this); - this.set(this.OPT.SATURATION, Math.round(s*100), true); - this.set(this.OPT.VALUE, Math.round(v*100), true); - - if (this.pickerSlider.valueChangeSource === this.pickerSlider.SOURCE_UI_EVENT) { - _getValuesFromSliders.call(this); - } - - _updateFormFields.call(this); - _updateSwatch.call(this); - }; - - - /** - * Key map to well-known commands for txt field input - * @method _getCommand - * @param e {Event} the keypress or keydown event - * @return {int} a command code - *
    - *
  • 0 = not a number, letter in range, or special key
  • - *
  • 1 = number
  • - *
  • 2 = a-fA-F
  • - *
  • 3 = increment (up arrow)
  • - *
  • 4 = decrement (down arrow)
  • - *
  • 5 = special key (tab, delete, return, escape, left, right)
  • - *
  • 6 = return
  • - *
- * @private - */ - var _getCommand = function(e) { - var c = Event.getCharCode(e); - - //alert(Event.getCharCode(e) + ", " + e.keyCode + ", " + e.charCode); - - // special keys - if (c === 38) { // up arrow - return 3; - } else if (c === 13) { // return - return 6; - } else if (c === 40) { // down array - return 4; - } else if (c >= 48 && c<=57) { // 0-9 - return 1; - } else if (c >= 97 && c<=102) { // a-f - return 2; - } else if (c >= 65 && c<=70) { // A-F - return 2; - //} else if ("8, 9, 13, 27, 37, 39".indexOf(c) > -1 || - // (c >= 112 && c <=123)) { // including F-keys - // tab, delete, return, escape, left, right - } else if ("8, 9, 13, 27, 37, 39".indexOf(c) > -1) { // special chars - return 5; - } else { // something we probably don't want - return 0; - } - }; - - /** - * Handle keypress on one of the rgb or hsv fields. - * @method _rgbFieldKeypress - * @param e {Event} the keypress event - * @param el {HTMLElement} the field - * @param prop {string} the key to the linked property - * @private - */ - var _rgbFieldKeypress = function(e, el, prop) { - var command = _getCommand(e); - var inc = (e.shiftKey) ? 10 : 1; - switch (command) { - case 6: // return, update the value - _useFieldValue.apply(this, arguments); - break; - - case 3: // up arrow, increment - this.set(prop, Math.min(this.get(prop)+inc, 255)); - _updateFormFields.call(this); - //Event.stopEvent(e); - break; - case 4: // down arrow, decrement - this.set(prop, Math.max(this.get(prop)-inc, 0)); - _updateFormFields.call(this); - //Event.stopEvent(e); - break; - - default: - } - - }; - - /** - * Handle keydown on the hex field - * @method _hexFieldKeypress - * @param e {Event} the keypress event - * @param el {HTMLElement} the field - * @param prop {string} the key to the linked property - * @private - */ - var _hexFieldKeypress = function(e, el, prop) { - var command = _getCommand(e); - if (command === 6) { // return, update the value - _useFieldValue.apply(this, arguments); - } - }; - - /** - * Use the value of the text field to update the control - * @method _hexFieldKeypress - * @param e {Event} an event - * @param el {HTMLElement} the field - * @param prop {string} the key to the linked property - * @private - */ - var _useFieldValue = function(e, el, prop) { - var val = el.value; - - if (prop !== this.OPT.HEX) { - val = parseInt(val, 10); - } - - if (val !== this.get(prop)) { - this.set(prop, val); - } - }; - - /** - * Allows numbers and special chars only. Used for the - * rgb and hsv fields keypress handler. - * @method _numbersOnly - * @param e {Event} the event - * @private - * @return {boolean} false if we are canceling the event - */ - var _numbersOnly = function(e) { - return _hexOnly(e, true); - }; - - /** - * Allows numbers and special chars, and by default allows a-f. - * Used for the hex field keypress handler. - * @method _hexOnly - * @param e {Event} the event - * @param numbersOnly omits a-f if set to true - * @private - * @return {boolean} false if we are canceling the event - */ - var _hexOnly = function(e, numbersOnly) { - var command = _getCommand(e); - switch (command) { - case 6: // return - case 5: // special char - case 1: // number - break; - case 2: // hex char (a-f) - if (numbersOnly !== true) { - break; - } - - // fallthrough is intentional - - default: // prevent alpha and punctuation - Event.stopEvent(e); - return false; - } - }; - - /** - * Returns the element reference that is saved. The id can be either - * the element id, or the key for this id in the "id" config attribute. - * For instance, the host element id can be obtained by passing its - * id (default: "yui_picker") or by its key "YUI_PICKER". - * @param id {string} the element id, or key - * @return {HTMLElement} a reference to the element - */ - proto.getElement = function(id) { - return this.get(this.OPT.ELEMENTS)[this.get(this.OPT.IDS)[id]]; - }; - - _createElements = function() { - this.logger.log("Building markup"); - var el, child, img, fld, i, - ids = this.get(this.OPT.IDS), - txt = this.get(this.OPT.TXT), - images = this.get(this.OPT.IMAGES), - Elem = function(type, o) { - var n = document.createElement(type); - if (o) { - lang.augmentObject(n, o, true); - } - return n; - }, - RGBElem = function(type, obj) { - var o = lang.merge({ - //type: "txt", - autocomplete: "off", - value: "0", - size: 3, - maxlength: 3 - }, obj); - - o.name = o.id; - return new Elem(type, o); - }; - - var p = this.get("element"); - - // Picker slider (S and V) --------------------------------------------- - - el = new Elem("div", { - id: ids[this.ID.PICKER_BG], - className: "yui-picker-bg", - tabIndex: -1, - hideFocus: true - }); - - child = new Elem("div", { - id: ids[this.ID.PICKER_THUMB], - className: "yui-picker-thumb" - }); - - img = new Elem("img", { - src: images.PICKER_THUMB - }); - - child.appendChild(img); - el.appendChild(child); - p.appendChild(el); - - // Hue slider --------------------------------------------- - el = new Elem("div", { - id: ids[this.ID.HUE_BG], - className: "yui-picker-hue-bg", - tabIndex: -1, - hideFocus: true - }); - - child = new Elem("div", { - id: ids[this.ID.HUE_THUMB], - className: "yui-picker-hue-thumb" - }); - - img = new Elem("img", { - src: images.HUE_THUMB - }); - - child.appendChild(img); - el.appendChild(child); - p.appendChild(el); - - - // controls --------------------------------------------- - - el = new Elem("div", { - id: ids[this.ID.CONTROLS], - className: "yui-picker-controls" - }); - - p.appendChild(el); - p = el; - - // controls header - el = new Elem("div", { - className: "hd" - }); - - child = new Elem("a", { - id: ids[this.ID.CONTROLS_LABEL], - //className: "yui-picker-controls-label", - href: "#" - }); - el.appendChild(child); - p.appendChild(el); - - // bd - el = new Elem("div", { - className: "bd" - }); - - p.appendChild(el); - p = el; - - // rgb - el = new Elem("ul", { - id: ids[this.ID.RGB_CONTROLS], - className: "yui-picker-rgb-controls" - }); - - child = new Elem("li"); - child.appendChild(document.createTextNode(txt.R + " ")); - - fld = new RGBElem("input", { - id: ids[this.ID.R], - className: "yui-picker-r" - }); - - child.appendChild(fld); - el.appendChild(child); - - child = new Elem("li"); - child.appendChild(document.createTextNode(txt.G + " ")); - - fld = new RGBElem("input", { - id: ids[this.ID.G], - className: "yui-picker-g" - }); - - child.appendChild(fld); - el.appendChild(child); - - child = new Elem("li"); - child.appendChild(document.createTextNode(txt.B + " ")); - - fld = new RGBElem("input", { - id: ids[this.ID.B], - className: "yui-picker-b" - }); - - child.appendChild(fld); - el.appendChild(child); - - p.appendChild(el); - - // hsv - el = new Elem("ul", { - id: ids[this.ID.HSV_CONTROLS], - className: "yui-picker-hsv-controls" - }); - - child = new Elem("li"); - child.appendChild(document.createTextNode(txt.H + " ")); - - fld = new RGBElem("input", { - id: ids[this.ID.H], - className: "yui-picker-h" - }); - - child.appendChild(fld); - child.appendChild(document.createTextNode(" " + txt.DEG)); - - el.appendChild(child); - - child = new Elem("li"); - child.appendChild(document.createTextNode(txt.S + " ")); - - fld = new RGBElem("input", { - id: ids[this.ID.S], - className: "yui-picker-s" - }); - - child.appendChild(fld); - child.appendChild(document.createTextNode(" " + txt.PERCENT)); - - el.appendChild(child); - - child = new Elem("li"); - child.appendChild(document.createTextNode(txt.V + " ")); - - fld = new RGBElem("input", { - id: ids[this.ID.V], - className: "yui-picker-v" - }); - - child.appendChild(fld); - child.appendChild(document.createTextNode(" " + txt.PERCENT)); - - el.appendChild(child); - p.appendChild(el); - - - // hex summary - - el = new Elem("ul", { - id: ids[this.ID.HEX_SUMMARY], - className: "yui-picker-hex_summary" - }); - - child = new Elem("li", { - id: ids[this.ID.R_HEX] - }); - el.appendChild(child); - - child = new Elem("li", { - id: ids[this.ID.G_HEX] - }); - el.appendChild(child); - - child = new Elem("li", { - id: ids[this.ID.B_HEX] - }); - el.appendChild(child); - p.appendChild(el); - - // hex field - el = new Elem("div", { - id: ids[this.ID.HEX_CONTROLS], - className: "yui-picker-hex-controls" - }); - el.appendChild(document.createTextNode(txt.HEX + " ")); - - child = new RGBElem("input", { - id: ids[this.ID.HEX], - className: "yui-picker-hex", - size: 6, - maxlength: 6 - }); - - el.appendChild(child); - p.appendChild(el); - - p = this.get("element"); - - // swatch - el = new Elem("div", { - id: ids[this.ID.SWATCH], - className: "yui-picker-swatch" - }); - - p.appendChild(el); - - // websafe swatch - el = new Elem("div", { - id: ids[this.ID.WEBSAFE_SWATCH], - className: "yui-picker-websafe-swatch" - }); - - p.appendChild(el); - - }; - - /** - * Sets the initial state of the sliders - * @method initPicker - */ - proto.initPicker = function () { - - // bind all of our elements - var o=this.OPT, - ids = this.get(o.IDS), - els = this.get(o.ELEMENTS), - i, el, id; - - // Add the default value as a key for each element for easier lookup - for (i in this.ID) { - if (lang.hasOwnProperty(this.ID, i)) { - ids[this.ID[i]] = ids[i]; - } - } - - // Check for picker element, if not there, create all of them - el = Dom.get(ids[this.ID.PICKER_BG]); - if (!el) { - _createElements.call(this); - } else { - this.logger.log("Using pre-existing markup"); - } - - for (i in ids) { - if (lang.hasOwnProperty(ids, i)) { - // look for element - el = Dom.get(ids[i]); - - // generate an id if the implementer passed in an element reference, - // and the element did not have an id already - id = Dom.generateId(el); - - // update the id in case we generated the id - ids[i] = id; // key is WEBSAFE_SWATCH - ids[ids[i]] = id; // key is websafe_swatch - - // store the dom ref - els[id] = el; - } - } - - // set the initial visibility state of our controls - els = [o.SHOW_CONTROLS, - o.SHOW_RGB_CONTROLS, - o.SHOW_HSV_CONTROLS, - o.SHOW_HEX_CONTROLS, - o.SHOW_HEX_SUMMARY, - o.SHOW_WEBSAFE - ]; - - for (i=0; i 1) { - for (var i in ids) { - if (lang.hasOwnProperty(ids, i)) { - ids[i] = ids[i] + pickercount; - } - } - } - - - /** - * A list of element ids and/or element references used by the - * control. The default is the this.ID list, and can be customized - * by passing a list in the contructor - * @config ids - * @type {referenceid: realid} - * @writeonce - */ - this.setAttributeConfig(this.OPT.IDS, { - value: ids, - writeonce: true - }); - - /** - * A list of txt strings for internationalization. Default - * is this.TXT - * @config txt - * @type {key: txt} - * @writeonce - */ - this.setAttributeConfig(this.OPT.TXT, { - value: attr.txt || this.TXT, - writeonce: true - }); - - /** - * The img src default list - * is this.IMAGES - * @config images - * @type {key: image} - * @writeonce - */ - this.setAttributeConfig(this.OPT.IMAGES, { - value: attr.images || this.IMAGE, - writeonce: true - }); - /** - * The element refs used by this control. Set at initialization - * @config elements - * @type {id: HTMLElement} - * @readonly - */ - this.setAttributeConfig(this.OPT.ELEMENTS, { - value: {}, - readonly: true - }); - - /** - * Returns the cached element reference. If the id is not a string, it - * is assumed that it is an element and this is returned. - * @param id {string|HTMLElement} the element key, id, or ref - * @param on {boolean} hide or show. If true, show - * @private */ - _hideShowEl = function(id, on) { - var el = (lang.isString(id) ? this.getElement(id) : id); - //Dom.setStyle(id, "visibility", (on) ? "" : "hidden"); - Dom.setStyle(el, "display", (on) ? "" : "none"); - }; - - /** - * Hide/show the entire set of controls - * @config showcontrols - * @type boolean - * @default true - */ - this.setAttributeConfig(this.OPT.SHOW_CONTROLS, { - value: (attr.showcontrols) || true, - method: function(on) { - - var el = Dom.getElementsByClassName("bd", "div", - this.getElement(this.ID.CONTROLS))[0]; - - _hideShowEl.call(this, el, on); - - this.getElement(this.ID.CONTROLS_LABEL).innerHTML = - (on) ? this.get(this.OPT.TXT).HIDE_CONTROLS : - this.get(this.OPT.TXT).SHOW_CONTROLS; - - } - }); - - /** - * Hide/show the rgb controls - * @config showrgbcontrols - * @type boolean - * @default true - */ - this.setAttributeConfig(this.OPT.SHOW_RGB_CONTROLS, { - value: (attr.showrgbcontrols) || true, - method: function(on) { - //Dom.setStyle(this.getElement(this.ID.RBG_CONTROLS), "visibility", (on) ? "" : "hidden"); - _hideShowEl.call(this, this.ID.RGB_CONTROLS, on); - } - }); - - /** - * Hide/show the hsv controls - * @config showhsvcontrols - * @type boolean - * @default false - */ - this.setAttributeConfig(this.OPT.SHOW_HSV_CONTROLS, { - value: (attr.showhsvcontrols) || false, - method: function(on) { - //Dom.setStyle(this.getElement(this.ID.HSV_CONTROLS), "visibility", (on) ? "" : "hidden"); - _hideShowEl.call(this, this.ID.HSV_CONTROLS, on); - - // can't show both the hsv controls and the rbg hex summary - if (on && this.get(this.OPT.SHOW_HEX_SUMMARY)) { - this.set(this.OPT.SHOW_HEX_SUMMARY, false); - } - } - }); - - /** - * Hide/show the hex controls - * @config showhexcontrols - * @type boolean - * @default true - */ - this.setAttributeConfig(this.OPT.SHOW_HEX_CONTROLS, { - value: (attr.showhexcontrols) || false, - method: function(on) { - _hideShowEl.call(this, this.ID.HEX_CONTROLS, on); - } - }); - - /** - * Hide/show the websafe swatch - * @config showwebsafe - * @type boolean - * @default true - */ - this.setAttributeConfig(this.OPT.SHOW_WEBSAFE, { - value: (attr.showwebsafe) || true, - method: function(on) { - _hideShowEl.call(this, this.ID.WEBSAFE_SWATCH, on); - } - }); - - /** - * Hide/show the hex summary - * @config showhexsummary - * @type boolean - * @default true - */ - this.setAttributeConfig(this.OPT.SHOW_HEX_SUMMARY, { - value: (attr.showhexsummary) || true, - method: function(on) { - _hideShowEl.call(this, this.ID.HEX_SUMMARY, on); - - // can't show both the hsv controls and the rbg hex summary - if (on && this.get(this.OPT.SHOW_HSV_CONTROLS)) { - this.set(this.OPT.SHOW_HSV_CONTROLS, false); - } - } - }); - this.setAttributeConfig(this.OPT.ANIMATE, { - value: (attr.animate) || true, - method: function(on) { - this.pickerSlider.animate = on; - this.hueSlider.animate = on; - } - }); - - this.on(this.OPT.HUE + "Change", _updateRGBFromHSV, this, true); - this.on(this.OPT.SATURATION + "Change", _updateRGBFromHSV, this, true); - this.on(this.OPT.VALUE + "Change", _updatePickerSlider, this, true); - - this.on(this.OPT.RED + "Change", _updateRGB, this, true); - this.on(this.OPT.GREEN + "Change", _updateRGB, this, true); - this.on(this.OPT.BLUE + "Change", _updateRGB, this, true); - - this.on(this.OPT.HEX + "Change", _updateHex, this, true); - - this.initPicker(); - }; - - /** - * Updates the rgb attribute with the current state of the r,g,b - * fields. This is invoked from change listeners on these - * attributes to facilitate updating these values from the - * individual form fields - * @method _updateRGB - * @private - */ - var _updateRGB = function() { - var rgb = [this.get(this.OPT.RED), - this.get(this.OPT.GREEN), - this.get(this.OPT.BLUE)]; - - this.logger.log("RGB value set to " + rgb); - this.set(this.OPT.RGB, rgb); - - _updateSliders.call(this); - }; - - /** - * Updates the RGB values from the current state of the HSV - * values. Executed when the one of the HSV form fields are - * updated - * _updateRGBFromHSV - * @private - */ - var _updateRGBFromHSV = function() { - var hsv = [this.get(this.OPT.HUE), - this.get(this.OPT.SATURATION)/100, - this.get(this.OPT.VALUE)/100]; - - var rgb = Color.hsv2rgb(hsv); - - this.logger.log("HSV converted to RGB " + hsv + " : " + rgb); - this.set(this.OPT.RGB, rgb); - - _updateSliders.call(this); - }; - - /** - * Parses the hex string to normalize shorthand values, converts - * the hex value to rgb and updates the rgb attribute (which - * updates the state for all of the other values) - * method _updateHex - * @private - */ - var _updateHex = function() { - - var hex = this.get(this.OPT.HEX), l=hex.length; - - // support #369 -> #336699 shorthand - if (l === 3) { - var c = hex.split(""), i; - for (i=0; i255||n<0)?0:n;return HCHARS.charAt((n-n%16)/16)+HCHARS.charAt(n%16);},hex2dec:function(str){var f=function(c){return HCHARS.indexOf(c.toUpperCase());};var s=str.split('');return((f(s[0])*16)+f(s[1]));},hex2rgb:function(s){var f=this.hex2dec;return[f(s.substr(0,2)),f(s.substr(2,2)),f(s.substr(4,2))];},websafe:function(r,g,b){if(lang.isArray(r)){return this.websafe.call(this,r[0],r[1],r[2]);} -var f=function(v){if(lang.isNumber(v)){v=Math.min(Math.max(0,v),255);var i,next;for(i=0;i<256;i=i+51){next=i+51;if(v>=i&&v<=next){return(v-i>25)?next:i;}}} -return v;};return[f(r),f(g),f(b)];}};}();(function(){var pickercount=0;YAHOO.widget.ColorPicker=function(el,attr){pickercount=pickercount+1;attr=attr||{};if(arguments.length===1&&!YAHOO.lang.isString(el)&&!el.nodeName){attr=el;el=attr.element||null;} -if(!el&&!attr.element){el=_createHostElement.call(this,attr);} -YAHOO.widget.ColorPicker.superclass.constructor.call(this,el,attr);};YAHOO.extend(YAHOO.widget.ColorPicker,YAHOO.util.Element);var proto=YAHOO.widget.ColorPicker.prototype,Slider=YAHOO.widget.Slider,Color=YAHOO.util.Color,Dom=YAHOO.util.Dom,Event=YAHOO.util.Event,lang=YAHOO.lang,sub=lang.substitute;var b="yui-picker";proto.ID={R:b+"-r",R_HEX:b+"-rhex",G:b+"-g",G_HEX:b+"-ghex",B:b+"-b",B_HEX:b+"-bhex",H:b+"-h",S:b+"-s",V:b+"-v",PICKER_BG:b+"-bg",PICKER_THUMB:b+"-thumb",HUE_BG:b+"-hue-bg",HUE_THUMB:b+"-hue-thumb",HEX:b+"-hex",SWATCH:b+"-swatch",WEBSAFE_SWATCH:b+"-websafe-swatch",CONTROLS:b+"-controls",RGB_CONTROLS:b+"-rgb-controls",HSV_CONTROLS:b+"-hsv-controls",HEX_CONTROLS:b+"-hex-controls",HEX_SUMMARY:b+"-hex-summary",CONTROLS_LABEL:b+"-controls-label"};proto.TXT={ILLEGAL_HEX:"Illegal hex value entered",SHOW_CONTROLS:"Show color details",HIDE_CONTROLS:"Hide color details",CURRENT_COLOR:"Currently selected color: {rgb}",CLOSEST_WEBSAFE:"Closest websafe color: {rgb}. Click to select.",R:"R",G:"G",B:"B",H:"H",S:"S",V:"V",HEX:"#",DEG:"\u00B0",PERCENT:"%"};proto.IMAGE={PICKER_THUMB:"../../build/colorpicker/assets/picker_thumb.png",HUE_THUMB:"../../build/colorpicker/assets/hue_thumb.png"};proto.DEFAULT={PICKER_SIZE:180};proto.OPT={HUE:"hue",SATURATION:"saturation",VALUE:"value",RED:"red",GREEN:"green",BLUE:"blue",HSV:"hsv",RGB:"rgb",WEBSAFE:"websafe",HEX:"hex",PICKER_SIZE:"pickersize",SHOW_CONTROLS:"showcontrols",SHOW_RGB_CONTROLS:"showrgbcontrols",SHOW_HSV_CONTROLS:"showhsvcontrols",SHOW_HEX_CONTROLS:"showhexcontrols",SHOW_HEX_SUMMARY:"showhexsummary",SHOW_WEBSAFE:"showwebsafe",CONTAINER:"container",IDS:"ids",ELEMENTS:"elements",TXT:"txt",IMAGES:"images",ANIMATE:"animate"};proto.setValue=function(rgb,silent){silent=(silent)||false;this.set(this.OPT.RGB,rgb,silent);_updateSliders.call(this);};proto.hueSlider=null;proto.pickerSlider=null;var _getH=function(){var size=this.get(this.OPT.PICKER_SIZE),h=(size-this.hueSlider.getValue())/size;h=Math.round(h*360);return(h===360)?0:h;};var _getS=function(){return this.pickerSlider.getXValue()/this.get(this.OPT.PICKER_SIZE);};var _getV=function(){var size=this.get(this.OPT.PICKER_SIZE);return(size-this.pickerSlider.getYValue())/size;};var _updateSwatch=function(){var rgb=this.get(this.OPT.RGB),websafe=this.get(this.OPT.WEBSAFE),el=this.getElement(this.ID.SWATCH),color=rgb.join(","),txt=this.get(this.OPT.TXT);Dom.setStyle(el,"background-color","rgb("+color+")");el.title=lang.substitute(txt.CURRENT_COLOR,{"rgb":"#"+this.get(this.OPT.HEX)});el=this.getElement(this.ID.WEBSAFE_SWATCH);color=websafe.join(",");Dom.setStyle(el,"background-color","rgb("+color+")");el.title=lang.substitute(txt.CLOSEST_WEBSAFE,{"rgb":"#"+Color.rgb2hex(websafe)});};var _getValuesFromSliders=function(){var h=_getH.call(this),s=_getS.call(this),v=_getV.call(this);rgb=Color.hsv2rgb(h,s,v);var websafe=Color.websafe(rgb);var hex=Color.rgb2hex(rgb[0],rgb[1],rgb[2]);this.set(this.OPT.RGB,rgb);};var _updateFormFields=function(){this.getElement(this.ID.H).value=this.get(this.OPT.HUE);this.getElement(this.ID.S).value=this.get(this.OPT.SATURATION);this.getElement(this.ID.V).value=this.get(this.OPT.VALUE);this.getElement(this.ID.R).value=this.get(this.OPT.RED);this.getElement(this.ID.R_HEX).innerHTML=Color.dec2hex(this.get(this.OPT.RED));this.getElement(this.ID.G).value=this.get(this.OPT.GREEN);this.getElement(this.ID.G_HEX).innerHTML=Color.dec2hex(this.get(this.OPT.GREEN));this.getElement(this.ID.B).value=this.get(this.OPT.BLUE);this.getElement(this.ID.B_HEX).innerHTML=Color.dec2hex(this.get(this.OPT.BLUE));this.getElement(this.ID.HEX).value=this.get(this.OPT.HEX);};var _onHueSliderChange=function(newOffset){var h=_getH.call(this);this.set(this.OPT.HUE,h,true);var rgb=Color.hsv2rgb(h,1,1);var styleDef="rgb("+rgb.join(",")+")";Dom.setStyle(this.getElement(this.ID.PICKER_BG),"background-color",styleDef);if(this.hueSlider.valueChangeSource===this.hueSlider.SOURCE_UI_EVENT){_getValuesFromSliders.call(this);} -_updateFormFields.call(this);_updateSwatch.call(this);};var _onPickerSliderChange=function(newOffset){var s=_getS.call(this),v=_getV.call(this);this.set(this.OPT.SATURATION,Math.round(s*100),true);this.set(this.OPT.VALUE,Math.round(v*100),true);if(this.pickerSlider.valueChangeSource===this.pickerSlider.SOURCE_UI_EVENT){_getValuesFromSliders.call(this);} -_updateFormFields.call(this);_updateSwatch.call(this);};var _getCommand=function(e){var c=Event.getCharCode(e);if(c===38){return 3;}else if(c===13){return 6;}else if(c===40){return 4;}else if(c>=48&&c<=57){return 1;}else if(c>=97&&c<=102){return 2;}else if(c>=65&&c<=70){return 2;}else if("8, 9, 13, 27, 37, 39".indexOf(c)>-1){return 5;}else{return 0;}};var _rgbFieldKeypress=function(e,el,prop){var command=_getCommand(e);var inc=(e.shiftKey)?10:1;switch(command){case 6:_useFieldValue.apply(this,arguments);break;case 3:this.set(prop,Math.min(this.get(prop)+inc,255));_updateFormFields.call(this);break;case 4:this.set(prop,Math.max(this.get(prop)-inc,0));_updateFormFields.call(this);break;default:}};var _hexFieldKeypress=function(e,el,prop){var command=_getCommand(e);if(command===6){_useFieldValue.apply(this,arguments);}};var _useFieldValue=function(e,el,prop){var val=el.value;if(prop!==this.OPT.HEX){val=parseInt(val,10);} -if(val!==this.get(prop)){this.set(prop,val);}};var _numbersOnly=function(e){return _hexOnly(e,true);};var _hexOnly=function(e,numbersOnly){var command=_getCommand(e);switch(command){case 6:case 5:case 1:break;case 2:if(numbersOnly!==true){break;} -default:Event.stopEvent(e);return false;}};proto.getElement=function(id){return this.get(this.OPT.ELEMENTS)[this.get(this.OPT.IDS)[id]];};_createElements=function(){var el,child,img,fld,i,ids=this.get(this.OPT.IDS),txt=this.get(this.OPT.TXT),images=this.get(this.OPT.IMAGES),Elem=function(type,o){var n=document.createElement(type);if(o){lang.augmentObject(n,o,true);} -return n;},RGBElem=function(type,obj){var o=lang.merge({autocomplete:"off",value:"0",size:3,maxlength:3},obj);o.name=o.id;return new Elem(type,o);};var p=this.get("element");el=new Elem("div",{id:ids[this.ID.PICKER_BG],className:"yui-picker-bg",tabIndex:-1,hideFocus:true});child=new Elem("div",{id:ids[this.ID.PICKER_THUMB],className:"yui-picker-thumb"});img=new Elem("img",{src:images.PICKER_THUMB});child.appendChild(img);el.appendChild(child);p.appendChild(el);el=new Elem("div",{id:ids[this.ID.HUE_BG],className:"yui-picker-hue-bg",tabIndex:-1,hideFocus:true});child=new Elem("div",{id:ids[this.ID.HUE_THUMB],className:"yui-picker-hue-thumb"});img=new Elem("img",{src:images.HUE_THUMB});child.appendChild(img);el.appendChild(child);p.appendChild(el);el=new Elem("div",{id:ids[this.ID.CONTROLS],className:"yui-picker-controls"});p.appendChild(el);p=el;el=new Elem("div",{className:"hd"});child=new Elem("a",{id:ids[this.ID.CONTROLS_LABEL],href:"#"});el.appendChild(child);p.appendChild(el);el=new Elem("div",{className:"bd"});p.appendChild(el);p=el;el=new Elem("ul",{id:ids[this.ID.RGB_CONTROLS],className:"yui-picker-rgb-controls"});child=new Elem("li");child.appendChild(document.createTextNode(txt.R+" "));fld=new RGBElem("input",{id:ids[this.ID.R],className:"yui-picker-r"});child.appendChild(fld);el.appendChild(child);child=new Elem("li");child.appendChild(document.createTextNode(txt.G+" "));fld=new RGBElem("input",{id:ids[this.ID.G],className:"yui-picker-g"});child.appendChild(fld);el.appendChild(child);child=new Elem("li");child.appendChild(document.createTextNode(txt.B+" "));fld=new RGBElem("input",{id:ids[this.ID.B],className:"yui-picker-b"});child.appendChild(fld);el.appendChild(child);p.appendChild(el);el=new Elem("ul",{id:ids[this.ID.HSV_CONTROLS],className:"yui-picker-hsv-controls"});child=new Elem("li");child.appendChild(document.createTextNode(txt.H+" "));fld=new RGBElem("input",{id:ids[this.ID.H],className:"yui-picker-h"});child.appendChild(fld);child.appendChild(document.createTextNode(" "+txt.DEG));el.appendChild(child);child=new Elem("li");child.appendChild(document.createTextNode(txt.S+" "));fld=new RGBElem("input",{id:ids[this.ID.S],className:"yui-picker-s"});child.appendChild(fld);child.appendChild(document.createTextNode(" "+txt.PERCENT));el.appendChild(child);child=new Elem("li");child.appendChild(document.createTextNode(txt.V+" "));fld=new RGBElem("input",{id:ids[this.ID.V],className:"yui-picker-v"});child.appendChild(fld);child.appendChild(document.createTextNode(" "+txt.PERCENT));el.appendChild(child);p.appendChild(el);el=new Elem("ul",{id:ids[this.ID.HEX_SUMMARY],className:"yui-picker-hex_summary"});child=new Elem("li",{id:ids[this.ID.R_HEX]});el.appendChild(child);child=new Elem("li",{id:ids[this.ID.G_HEX]});el.appendChild(child);child=new Elem("li",{id:ids[this.ID.B_HEX]});el.appendChild(child);p.appendChild(el);el=new Elem("div",{id:ids[this.ID.HEX_CONTROLS],className:"yui-picker-hex-controls"});el.appendChild(document.createTextNode(txt.HEX+" "));child=new RGBElem("input",{id:ids[this.ID.HEX],className:"yui-picker-hex",size:6,maxlength:6});el.appendChild(child);p.appendChild(el);p=this.get("element");el=new Elem("div",{id:ids[this.ID.SWATCH],className:"yui-picker-swatch"});p.appendChild(el);el=new Elem("div",{id:ids[this.ID.WEBSAFE_SWATCH],className:"yui-picker-websafe-swatch"});p.appendChild(el);};proto.initPicker=function(){var o=this.OPT,ids=this.get(o.IDS),els=this.get(o.ELEMENTS),i,el,id;for(i in this.ID){if(lang.hasOwnProperty(this.ID,i)){ids[this.ID[i]]=ids[i];}} -el=Dom.get(ids[this.ID.PICKER_BG]);if(!el){_createElements.call(this);}else{} -for(i in ids){if(lang.hasOwnProperty(ids,i)){el=Dom.get(ids[i]);id=Dom.generateId(el);ids[i]=id;ids[ids[i]]=id;els[id]=el;}} -els=[o.SHOW_CONTROLS,o.SHOW_RGB_CONTROLS,o.SHOW_HSV_CONTROLS,o.SHOW_HEX_CONTROLS,o.SHOW_HEX_SUMMARY,o.SHOW_WEBSAFE];for(i=0;i1){for(var i in ids){if(lang.hasOwnProperty(ids,i)){ids[i]=ids[i]+pickercount;}}} -this.setAttributeConfig(this.OPT.IDS,{value:ids,writeonce:true});this.setAttributeConfig(this.OPT.TXT,{value:attr.txt||this.TXT,writeonce:true});this.setAttributeConfig(this.OPT.IMAGES,{value:attr.images||this.IMAGE,writeonce:true});this.setAttributeConfig(this.OPT.ELEMENTS,{value:{},readonly:true});_hideShowEl=function(id,on){var el=(lang.isString(id)?this.getElement(id):id);Dom.setStyle(el,"display",(on)?"":"none");};this.setAttributeConfig(this.OPT.SHOW_CONTROLS,{value:(attr.showcontrols)||true,method:function(on){var el=Dom.getElementsByClassName("bd","div",this.getElement(this.ID.CONTROLS))[0];_hideShowEl.call(this,el,on);this.getElement(this.ID.CONTROLS_LABEL).innerHTML=(on)?this.get(this.OPT.TXT).HIDE_CONTROLS:this.get(this.OPT.TXT).SHOW_CONTROLS;}});this.setAttributeConfig(this.OPT.SHOW_RGB_CONTROLS,{value:(attr.showrgbcontrols)||true,method:function(on){_hideShowEl.call(this,this.ID.RGB_CONTROLS,on);}});this.setAttributeConfig(this.OPT.SHOW_HSV_CONTROLS,{value:(attr.showhsvcontrols)||false,method:function(on){_hideShowEl.call(this,this.ID.HSV_CONTROLS,on);if(on&&this.get(this.OPT.SHOW_HEX_SUMMARY)){this.set(this.OPT.SHOW_HEX_SUMMARY,false);}}});this.setAttributeConfig(this.OPT.SHOW_HEX_CONTROLS,{value:(attr.showhexcontrols)||false,method:function(on){_hideShowEl.call(this,this.ID.HEX_CONTROLS,on);}});this.setAttributeConfig(this.OPT.SHOW_WEBSAFE,{value:(attr.showwebsafe)||true,method:function(on){_hideShowEl.call(this,this.ID.WEBSAFE_SWATCH,on);}});this.setAttributeConfig(this.OPT.SHOW_HEX_SUMMARY,{value:(attr.showhexsummary)||true,method:function(on){_hideShowEl.call(this,this.ID.HEX_SUMMARY,on);if(on&&this.get(this.OPT.SHOW_HSV_CONTROLS)){this.set(this.OPT.SHOW_HSV_CONTROLS,false);}}});this.setAttributeConfig(this.OPT.ANIMATE,{value:(attr.animate)||true,method:function(on){this.pickerSlider.animate=on;this.hueSlider.animate=on;}});this.on(this.OPT.HUE+"Change",_updateRGBFromHSV,this,true);this.on(this.OPT.SATURATION+"Change",_updateRGBFromHSV,this,true);this.on(this.OPT.VALUE+"Change",_updatePickerSlider,this,true);this.on(this.OPT.RED+"Change",_updateRGB,this,true);this.on(this.OPT.GREEN+"Change",_updateRGB,this,true);this.on(this.OPT.BLUE+"Change",_updateRGB,this,true);this.on(this.OPT.HEX+"Change",_updateHex,this,true);this.initPicker();};var _updateRGB=function(){var rgb=[this.get(this.OPT.RED),this.get(this.OPT.GREEN),this.get(this.OPT.BLUE)];this.set(this.OPT.RGB,rgb);_updateSliders.call(this);};var _updateRGBFromHSV=function(){var hsv=[this.get(this.OPT.HUE),this.get(this.OPT.SATURATION)/100,this.get(this.OPT.VALUE)/100];var rgb=Color.hsv2rgb(hsv);this.set(this.OPT.RGB,rgb);_updateSliders.call(this);};var _updateHex=function(){var hex=this.get(this.OPT.HEX),l=hex.length;if(l===3){var c=hex.split(""),i;for(i=0;i FFFFFF - * @method rgb2hex - * @param r {int|[int, int, int]} the red value, or an - * array containing all three parameters - * @param g {int} the green value - * @param b {int} the blue value - * @return {string} the hex string - */ - rgb2hex: function(r, g, b) { - if (lang.isArray(r)) { - return this.rgb2hex.call(this, r[0], r[1], r[2]); - } - - var f=this.dec2hex; - return f(r) + f(g) + f(b); - }, - - /** - * Converts an int 0...255 to hex pair 00...FF - * @method dec2hex - * @param n {int} the number to convert - * @return {string} the hex equivalent - */ - dec2hex: function(n) { - n = parseInt(n, 10); - n = (lang.isNumber(n)) ? n : 0; - n = (n > 255 || n < 0) ? 0 : n; - - return HCHARS.charAt((n - n % 16) / 16) + HCHARS.charAt(n % 16); - }, - - /** - * Converts a hex pair 00...FF to an int 0...255 - * @method hex2dec - * @param str {string} the hex pair to convert - * @return {int} the decimal - */ - hex2dec: function(str) { - var f = function(c) { - return HCHARS.indexOf(c.toUpperCase()); - }; - - var s=str.split(''); - - return ((f(s[0]) * 16) + f(s[1])); - }, - - /** - * Converts a hex string to rgb - * @method hex2rgb - * @param str {string} the hex string - * @return {[int, int, int]} an array containing the rgb values - */ - hex2rgb: function(s) { - var f = this.hex2dec; - return [f(s.substr(0, 2)), f(s.substr(2, 2)), f(s.substr(4, 2))]; - }, - - /** - * Returns the closest websafe color to the supplied rgb value. - * @method websafe - * @param r {int|[int, int, int]} the red value, or an - * array containing all three parameters - * @param g {int} the green value - * @param b {int} the blue value - * @return {[int, int, int]} an array containing the closes - * websafe rgb colors. - */ - websafe: function(r, g, b) { - - if (lang.isArray(r)) { - return this.websafe.call(this, r[0], r[1], r[2]); - } - - // returns the closest match [0, 51, 102, 153, 204, 255] - var f = function(v) { - if (lang.isNumber(v)) { - v = Math.min(Math.max(0, v), 255); - var i, next; - for (i=0; i<256; i=i+51) { - next = i+51; - if (v >= i && v <= next) { - return (v-i > 25) ? next : i; - } - } - } - - return v; - }; - - return [f(r), f(g), f(b)]; - } - }; -}(); - - -(function() { - - var pickercount = 0; - - /** - * The colorpicker module provides a widget for selecting colors - * @module colorpicker - * @requires yahoo, dom, event, element, slider - */ - - /** - * A widget to select colors - * @namespace YAHOO.widget - * @class YAHOO.widget.ColorPicker - * @extends YAHOO.util.Element - * @constructor - * @param {HTMLElement | String | Object} el(optional) The html - * element that represents the colorpicker, or the attribute object to use. - * An element will be created if none provided. - * @param {Object} attr (optional) A key map of the colorpicker's - * initial attributes. Ignored if first arg is attributes object. - */ - YAHOO.widget.ColorPicker = function(el, attr) { - pickercount = pickercount + 1; - attr = attr || {}; - if (arguments.length === 1 && !YAHOO.lang.isString(el) && !el.nodeName) { - attr = el; // treat first arg as attr object - el = attr.element || null; - } - - if (!el && !attr.element) { // create if we dont have one - el = _createHostElement.call(this, attr); - } - - YAHOO.widget.ColorPicker.superclass.constructor.call(this, el, attr); - }; - - YAHOO.extend(YAHOO.widget.ColorPicker, YAHOO.util.Element); - - var proto = YAHOO.widget.ColorPicker.prototype, - Slider=YAHOO.widget.Slider, - Color=YAHOO.util.Color, - Dom = YAHOO.util.Dom, - Event = YAHOO.util.Event, - lang = YAHOO.lang, - sub = lang.substitute; - - - var b = "yui-picker"; - - /** - * The element ids used by this control - * @property ID - * @final - */ - proto.ID = { - - /** - * The id for the "red" form field - * @property ID.R - * @type String - * @final - * @default yui-picker-r - */ - R: b + "-r", - - /** - * The id for the "red" hex pair output - * @property ID.R_HEX - * @type String - * @final - * @default yui-picker-rhex - */ - R_HEX: b + "-rhex", - - /** - * The id for the "green" form field - * @property ID.G - * @type String - * @final - * @default yui-picker-g - */ - G: b + "-g", - - /** - * The id for the "green" hex pair output - * @property ID.G_HEX - * @type String - * @final - * @default yui-picker-ghex - */ - G_HEX: b + "-ghex", - - - /** - * The id for the "blue" form field - * @property ID.B - * @type String - * @final - * @default yui-picker-b - */ - B: b + "-b", - - /** - * The id for the "blue" hex pair output - * @property ID.B_HEX - * @type String - * @final - * @default yui-picker-bhex - */ - B_HEX: b + "-bhex", - - /** - * The id for the "hue" form field - * @property ID.H - * @type String - * @final - * @default yui-picker-h - */ - H: b + "-h", - - /** - * The id for the "saturation" form field - * @property ID.S - * @type String - * @final - * @default yui-picker-s - */ - S: b + "-s", - - /** - * The id for the "value" form field - * @property ID.V - * @type String - * @final - * @default yui-picker-v - */ - V: b + "-v", - - /** - * The id for the picker region slider - * @property ID.PICKER_BG - * @type String - * @final - * @default yui-picker-bg - */ - PICKER_BG: b + "-bg", - - /** - * The id for the picker region thumb - * @property ID.PICKER_THUMB - * @type String - * @final - * @default yui-picker-thumb - */ - PICKER_THUMB: b + "-thumb", - - /** - * The id for the hue slider - * @property ID.HUE_BG - * @type String - * @final - * @default yui-picker-hue-bg - */ - HUE_BG: b + "-hue-bg", - - /** - * The id for the hue thumb - * @property ID.HUE_THUMB - * @type String - * @final - * @default yui-picker-hue-thumb - */ - HUE_THUMB: b + "-hue-thumb", - - /** - * The id for the hex value form field - * @property ID.HEX - * @type String - * @final - * @default yui-picker-hex - */ - HEX: b + "-hex", - - /** - * The id for the color swatch - * @property ID.SWATCH - * @type String - * @final - * @default yui-picker-swatch - */ - SWATCH: b + "-swatch", - - /** - * The id for the websafe color swatch - * @property ID.WEBSAFE_SWATCH - * @type String - * @final - * @default yui-picker-websafe-swatch - */ - WEBSAFE_SWATCH: b + "-websafe-swatch", - - /** - * The id for the control details - * @property ID.CONTROLS - * @final - * @default yui-picker-controls - */ - CONTROLS: b + "-controls", - - /** - * The id for the rgb controls - * @property ID.RGB_CONTROLS - * @final - * @default yui-picker-rgb-controls - */ - RGB_CONTROLS: b + "-rgb-controls", - - /** - * The id for the hsv controls - * @property ID.HSV_CONTROLS - * @final - * @default yui-picker-hsv-controls - */ - HSV_CONTROLS: b + "-hsv-controls", - - /** - * The id for the hsv controls - * @property ID.HEX_CONTROLS - * @final - * @default yui-picker-hex-controls - */ - HEX_CONTROLS: b + "-hex-controls", - - /** - * The id for the hex summary - * @property ID.HEX_SUMMARY - * @final - * @default yui-picker-hex-summary - */ - HEX_SUMMARY: b + "-hex-summary", - - /** - * The id for the controls section header - * @property ID.CONTROLS_LABEL - * @final - * @default yui-picker-controls-label - */ - CONTROLS_LABEL: b + "-controls-label" - }; - - /** - * Constants for any script-generated messages. The values here - * are the default messages. They can be updated by providing - * the complete list to the constructor for the "txt" attribute. - * @property TXT - * @final - */ - proto.TXT = { - ILLEGAL_HEX: "Illegal hex value entered", - SHOW_CONTROLS: "Show color details", - HIDE_CONTROLS: "Hide color details", - CURRENT_COLOR: "Currently selected color: {rgb}", - CLOSEST_WEBSAFE: "Closest websafe color: {rgb}. Click to select.", - R: "R", - G: "G", - B: "B", - H: "H", - S: "S", - V: "V", - HEX: "#", - DEG: "\u00B0", - PERCENT: "%" - }; - - /** - * Constants for the default image locations for img tags that are - * generated by the control. They can be modified by passing the - * complete list to the contructor for the "images" attribute - * @property IMAGE - * @final - */ - proto.IMAGE = { - PICKER_THUMB: "../../build/colorpicker/assets/picker_thumb.png", - HUE_THUMB: "../../build/colorpicker/assets/hue_thumb.png" - }; - - /* - * Constants for the control's custom event names. subscribe - * to the rgbChange event instead. - * @property EVENT - * @final - */ - //proto.EVENT = { - //CHANGE: "change" - //}; - - //proto.CSS = { }; - - /** - * Constants for the control's default default values - * @property DEFAULT - * @final - */ - proto.DEFAULT = { - PICKER_SIZE: 180 - }; - - /** - * Constants for the control's configuration attributes - * @property OPT - * @final - */ - proto.OPT = { - HUE: "hue", - SATURATION: "saturation", - VALUE: "value", - RED: "red", - GREEN: "green", - BLUE: "blue", - HSV: "hsv", - RGB: "rgb", - WEBSAFE: "websafe", - HEX: "hex", - PICKER_SIZE: "pickersize", - SHOW_CONTROLS: "showcontrols", - SHOW_RGB_CONTROLS: "showrgbcontrols", - SHOW_HSV_CONTROLS: "showhsvcontrols", - SHOW_HEX_CONTROLS: "showhexcontrols", - SHOW_HEX_SUMMARY: "showhexsummary", - SHOW_WEBSAFE: "showwebsafe", - //SHOW_SUBMIT: "showsubmit", - CONTAINER: "container", - IDS: "ids", - ELEMENTS: "elements", - TXT: "txt", - IMAGES: "images", - ANIMATE: "animate" - }; - - /** - * Sets the control to the specified rgb value and - * moves the sliders to the proper positions - * @method setValue - * @param rgb {[int, int, int]} the rgb value - * @param silent {boolean} whether or not to fire the change event - */ - proto.setValue = function(rgb, silent) { - silent = (silent) || false; - this.set(this.OPT.RGB, rgb, silent); - _updateSliders.call(this); - }; - - /** - * The hue slider - * @property hueSlider - * @type YAHOO.widget.Slider - */ - proto.hueSlider = null; - - /** - * The picker region - * @property pickerSlider - * @type YAHOO.widget.Slider - */ - proto.pickerSlider = null; - - /** - * Translates the slider value into hue, int[0,359] - * @method _getH - * @private - * @return {int} the hue from 0 to 359 - */ - var _getH = function() { - var size = this.get(this.OPT.PICKER_SIZE), - h = (size - this.hueSlider.getValue()) / size; - h = Math.round(h*360); - return (h === 360) ? 0 : h; - }; - - /** - * Translates the slider value into saturation, int[0,1], left to right - * @method _getS - * @private - * @return {int} the saturation from 0 to 1 - */ - var _getS = function() { - return this.pickerSlider.getXValue() / this.get(this.OPT.PICKER_SIZE); - }; - - /** - * Translates the slider value into value/brightness, int[0,1], top - * to bottom - * @method _getV - * @private - * @return {int} the value from 0 to 1 - */ - var _getV = function() { - var size = this.get(this.OPT.PICKER_SIZE); - return (size - this.pickerSlider.getYValue()) / size; - }; - - /** - * Updates the background of the swatch with the current rbg value. - * Also updates the websafe swatch to the closest websafe color - * @method _updateSwatch - * @private - */ - var _updateSwatch = function() { - var rgb = this.get(this.OPT.RGB), - websafe = this.get(this.OPT.WEBSAFE), - el = this.getElement(this.ID.SWATCH), - color = rgb.join(","), - txt = this.get(this.OPT.TXT); - - Dom.setStyle(el, "background-color", "rgb(" + color + ")"); - el.title = lang.substitute(txt.CURRENT_COLOR, { - "rgb": "#" + this.get(this.OPT.HEX) - }); - - - el = this.getElement(this.ID.WEBSAFE_SWATCH); - color = websafe.join(","); - - Dom.setStyle(el, "background-color", "rgb(" + color + ")"); - el.title = lang.substitute(txt.CLOSEST_WEBSAFE, { - "rgb": "#" + Color.rgb2hex(websafe) - }); - - }; - - /** - * Reads the sliders and converts the values to RGB, updating the - * internal state for all the individual form fields - * @method _getValuesFromSliders - * @private - */ - var _getValuesFromSliders = function() { - var h=_getH.call(this), s=_getS.call(this), v=_getV.call(this); - - rgb = Color.hsv2rgb(h, s, v); - var websafe = Color.websafe(rgb); - var hex = Color.rgb2hex(rgb[0], rgb[1], rgb[2]); - - this.set(this.OPT.RGB, rgb); - }; - - /** - * Updates the form field controls with the state data contained - * in the control. - * @method _updateFormFields - * @private - */ - var _updateFormFields = function() { - this.getElement(this.ID.H).value = this.get(this.OPT.HUE); - this.getElement(this.ID.S).value = this.get(this.OPT.SATURATION); - this.getElement(this.ID.V).value = this.get(this.OPT.VALUE); - this.getElement(this.ID.R).value = this.get(this.OPT.RED); - this.getElement(this.ID.R_HEX).innerHTML = Color.dec2hex(this.get(this.OPT.RED)); - this.getElement(this.ID.G).value = this.get(this.OPT.GREEN); - this.getElement(this.ID.G_HEX).innerHTML = Color.dec2hex(this.get(this.OPT.GREEN)); - this.getElement(this.ID.B).value = this.get(this.OPT.BLUE); - this.getElement(this.ID.B_HEX).innerHTML = Color.dec2hex(this.get(this.OPT.BLUE)); - this.getElement(this.ID.HEX).value = this.get(this.OPT.HEX); - }; - - /** - * Event handler for the hue slider. - * @method _onHueSliderChange - * @param newOffset {int} pixels from the start position - * @private - */ - var _onHueSliderChange = function(newOffset) { - - var h = _getH.call(this); - this.set(this.OPT.HUE, h, true); - - // set picker background to the hue - var rgb = Color.hsv2rgb(h, 1, 1); - var styleDef = "rgb(" + rgb.join(",") + ")"; - - Dom.setStyle(this.getElement(this.ID.PICKER_BG), "background-color", styleDef); - - if (this.hueSlider.valueChangeSource === this.hueSlider.SOURCE_UI_EVENT) { - _getValuesFromSliders.call(this); - } - - _updateFormFields.call(this); - _updateSwatch.call(this); - }; - - /** - * Event handler for the picker slider, which controls the - * saturation and value/brightness. - * @method _onPickerSliderChange - * @param newOffset {{x: int, y: int}} x/y pixels from the start position - * @private - */ - var _onPickerSliderChange = function(newOffset) { - - var s=_getS.call(this), v=_getV.call(this); - this.set(this.OPT.SATURATION, Math.round(s*100), true); - this.set(this.OPT.VALUE, Math.round(v*100), true); - - if (this.pickerSlider.valueChangeSource === this.pickerSlider.SOURCE_UI_EVENT) { - _getValuesFromSliders.call(this); - } - - _updateFormFields.call(this); - _updateSwatch.call(this); - }; - - - /** - * Key map to well-known commands for txt field input - * @method _getCommand - * @param e {Event} the keypress or keydown event - * @return {int} a command code - *
    - *
  • 0 = not a number, letter in range, or special key
  • - *
  • 1 = number
  • - *
  • 2 = a-fA-F
  • - *
  • 3 = increment (up arrow)
  • - *
  • 4 = decrement (down arrow)
  • - *
  • 5 = special key (tab, delete, return, escape, left, right)
  • - *
  • 6 = return
  • - *
- * @private - */ - var _getCommand = function(e) { - var c = Event.getCharCode(e); - - //alert(Event.getCharCode(e) + ", " + e.keyCode + ", " + e.charCode); - - // special keys - if (c === 38) { // up arrow - return 3; - } else if (c === 13) { // return - return 6; - } else if (c === 40) { // down array - return 4; - } else if (c >= 48 && c<=57) { // 0-9 - return 1; - } else if (c >= 97 && c<=102) { // a-f - return 2; - } else if (c >= 65 && c<=70) { // A-F - return 2; - //} else if ("8, 9, 13, 27, 37, 39".indexOf(c) > -1 || - // (c >= 112 && c <=123)) { // including F-keys - // tab, delete, return, escape, left, right - } else if ("8, 9, 13, 27, 37, 39".indexOf(c) > -1) { // special chars - return 5; - } else { // something we probably don't want - return 0; - } - }; - - /** - * Handle keypress on one of the rgb or hsv fields. - * @method _rgbFieldKeypress - * @param e {Event} the keypress event - * @param el {HTMLElement} the field - * @param prop {string} the key to the linked property - * @private - */ - var _rgbFieldKeypress = function(e, el, prop) { - var command = _getCommand(e); - var inc = (e.shiftKey) ? 10 : 1; - switch (command) { - case 6: // return, update the value - _useFieldValue.apply(this, arguments); - break; - - case 3: // up arrow, increment - this.set(prop, Math.min(this.get(prop)+inc, 255)); - _updateFormFields.call(this); - //Event.stopEvent(e); - break; - case 4: // down arrow, decrement - this.set(prop, Math.max(this.get(prop)-inc, 0)); - _updateFormFields.call(this); - //Event.stopEvent(e); - break; - - default: - } - - }; - - /** - * Handle keydown on the hex field - * @method _hexFieldKeypress - * @param e {Event} the keypress event - * @param el {HTMLElement} the field - * @param prop {string} the key to the linked property - * @private - */ - var _hexFieldKeypress = function(e, el, prop) { - var command = _getCommand(e); - if (command === 6) { // return, update the value - _useFieldValue.apply(this, arguments); - } - }; - - /** - * Use the value of the text field to update the control - * @method _hexFieldKeypress - * @param e {Event} an event - * @param el {HTMLElement} the field - * @param prop {string} the key to the linked property - * @private - */ - var _useFieldValue = function(e, el, prop) { - var val = el.value; - - if (prop !== this.OPT.HEX) { - val = parseInt(val, 10); - } - - if (val !== this.get(prop)) { - this.set(prop, val); - } - }; - - /** - * Allows numbers and special chars only. Used for the - * rgb and hsv fields keypress handler. - * @method _numbersOnly - * @param e {Event} the event - * @private - * @return {boolean} false if we are canceling the event - */ - var _numbersOnly = function(e) { - return _hexOnly(e, true); - }; - - /** - * Allows numbers and special chars, and by default allows a-f. - * Used for the hex field keypress handler. - * @method _hexOnly - * @param e {Event} the event - * @param numbersOnly omits a-f if set to true - * @private - * @return {boolean} false if we are canceling the event - */ - var _hexOnly = function(e, numbersOnly) { - var command = _getCommand(e); - switch (command) { - case 6: // return - case 5: // special char - case 1: // number - break; - case 2: // hex char (a-f) - if (numbersOnly !== true) { - break; - } - - // fallthrough is intentional - - default: // prevent alpha and punctuation - Event.stopEvent(e); - return false; - } - }; - - /** - * Returns the element reference that is saved. The id can be either - * the element id, or the key for this id in the "id" config attribute. - * For instance, the host element id can be obtained by passing its - * id (default: "yui_picker") or by its key "YUI_PICKER". - * @param id {string} the element id, or key - * @return {HTMLElement} a reference to the element - */ - proto.getElement = function(id) { - return this.get(this.OPT.ELEMENTS)[this.get(this.OPT.IDS)[id]]; - }; - - _createElements = function() { - var el, child, img, fld, i, - ids = this.get(this.OPT.IDS), - txt = this.get(this.OPT.TXT), - images = this.get(this.OPT.IMAGES), - Elem = function(type, o) { - var n = document.createElement(type); - if (o) { - lang.augmentObject(n, o, true); - } - return n; - }, - RGBElem = function(type, obj) { - var o = lang.merge({ - //type: "txt", - autocomplete: "off", - value: "0", - size: 3, - maxlength: 3 - }, obj); - - o.name = o.id; - return new Elem(type, o); - }; - - var p = this.get("element"); - - // Picker slider (S and V) --------------------------------------------- - - el = new Elem("div", { - id: ids[this.ID.PICKER_BG], - className: "yui-picker-bg", - tabIndex: -1, - hideFocus: true - }); - - child = new Elem("div", { - id: ids[this.ID.PICKER_THUMB], - className: "yui-picker-thumb" - }); - - img = new Elem("img", { - src: images.PICKER_THUMB - }); - - child.appendChild(img); - el.appendChild(child); - p.appendChild(el); - - // Hue slider --------------------------------------------- - el = new Elem("div", { - id: ids[this.ID.HUE_BG], - className: "yui-picker-hue-bg", - tabIndex: -1, - hideFocus: true - }); - - child = new Elem("div", { - id: ids[this.ID.HUE_THUMB], - className: "yui-picker-hue-thumb" - }); - - img = new Elem("img", { - src: images.HUE_THUMB - }); - - child.appendChild(img); - el.appendChild(child); - p.appendChild(el); - - - // controls --------------------------------------------- - - el = new Elem("div", { - id: ids[this.ID.CONTROLS], - className: "yui-picker-controls" - }); - - p.appendChild(el); - p = el; - - // controls header - el = new Elem("div", { - className: "hd" - }); - - child = new Elem("a", { - id: ids[this.ID.CONTROLS_LABEL], - //className: "yui-picker-controls-label", - href: "#" - }); - el.appendChild(child); - p.appendChild(el); - - // bd - el = new Elem("div", { - className: "bd" - }); - - p.appendChild(el); - p = el; - - // rgb - el = new Elem("ul", { - id: ids[this.ID.RGB_CONTROLS], - className: "yui-picker-rgb-controls" - }); - - child = new Elem("li"); - child.appendChild(document.createTextNode(txt.R + " ")); - - fld = new RGBElem("input", { - id: ids[this.ID.R], - className: "yui-picker-r" - }); - - child.appendChild(fld); - el.appendChild(child); - - child = new Elem("li"); - child.appendChild(document.createTextNode(txt.G + " ")); - - fld = new RGBElem("input", { - id: ids[this.ID.G], - className: "yui-picker-g" - }); - - child.appendChild(fld); - el.appendChild(child); - - child = new Elem("li"); - child.appendChild(document.createTextNode(txt.B + " ")); - - fld = new RGBElem("input", { - id: ids[this.ID.B], - className: "yui-picker-b" - }); - - child.appendChild(fld); - el.appendChild(child); - - p.appendChild(el); - - // hsv - el = new Elem("ul", { - id: ids[this.ID.HSV_CONTROLS], - className: "yui-picker-hsv-controls" - }); - - child = new Elem("li"); - child.appendChild(document.createTextNode(txt.H + " ")); - - fld = new RGBElem("input", { - id: ids[this.ID.H], - className: "yui-picker-h" - }); - - child.appendChild(fld); - child.appendChild(document.createTextNode(" " + txt.DEG)); - - el.appendChild(child); - - child = new Elem("li"); - child.appendChild(document.createTextNode(txt.S + " ")); - - fld = new RGBElem("input", { - id: ids[this.ID.S], - className: "yui-picker-s" - }); - - child.appendChild(fld); - child.appendChild(document.createTextNode(" " + txt.PERCENT)); - - el.appendChild(child); - - child = new Elem("li"); - child.appendChild(document.createTextNode(txt.V + " ")); - - fld = new RGBElem("input", { - id: ids[this.ID.V], - className: "yui-picker-v" - }); - - child.appendChild(fld); - child.appendChild(document.createTextNode(" " + txt.PERCENT)); - - el.appendChild(child); - p.appendChild(el); - - - // hex summary - - el = new Elem("ul", { - id: ids[this.ID.HEX_SUMMARY], - className: "yui-picker-hex_summary" - }); - - child = new Elem("li", { - id: ids[this.ID.R_HEX] - }); - el.appendChild(child); - - child = new Elem("li", { - id: ids[this.ID.G_HEX] - }); - el.appendChild(child); - - child = new Elem("li", { - id: ids[this.ID.B_HEX] - }); - el.appendChild(child); - p.appendChild(el); - - // hex field - el = new Elem("div", { - id: ids[this.ID.HEX_CONTROLS], - className: "yui-picker-hex-controls" - }); - el.appendChild(document.createTextNode(txt.HEX + " ")); - - child = new RGBElem("input", { - id: ids[this.ID.HEX], - className: "yui-picker-hex", - size: 6, - maxlength: 6 - }); - - el.appendChild(child); - p.appendChild(el); - - p = this.get("element"); - - // swatch - el = new Elem("div", { - id: ids[this.ID.SWATCH], - className: "yui-picker-swatch" - }); - - p.appendChild(el); - - // websafe swatch - el = new Elem("div", { - id: ids[this.ID.WEBSAFE_SWATCH], - className: "yui-picker-websafe-swatch" - }); - - p.appendChild(el); - - }; - - /** - * Sets the initial state of the sliders - * @method initPicker - */ - proto.initPicker = function () { - - // bind all of our elements - var o=this.OPT, - ids = this.get(o.IDS), - els = this.get(o.ELEMENTS), - i, el, id; - - // Add the default value as a key for each element for easier lookup - for (i in this.ID) { - if (lang.hasOwnProperty(this.ID, i)) { - ids[this.ID[i]] = ids[i]; - } - } - - // Check for picker element, if not there, create all of them - el = Dom.get(ids[this.ID.PICKER_BG]); - if (!el) { - _createElements.call(this); - } else { - } - - for (i in ids) { - if (lang.hasOwnProperty(ids, i)) { - // look for element - el = Dom.get(ids[i]); - - // generate an id if the implementer passed in an element reference, - // and the element did not have an id already - id = Dom.generateId(el); - - // update the id in case we generated the id - ids[i] = id; // key is WEBSAFE_SWATCH - ids[ids[i]] = id; // key is websafe_swatch - - // store the dom ref - els[id] = el; - } - } - - // set the initial visibility state of our controls - els = [o.SHOW_CONTROLS, - o.SHOW_RGB_CONTROLS, - o.SHOW_HSV_CONTROLS, - o.SHOW_HEX_CONTROLS, - o.SHOW_HEX_SUMMARY, - o.SHOW_WEBSAFE - ]; - - for (i=0; i 1) { - for (var i in ids) { - if (lang.hasOwnProperty(ids, i)) { - ids[i] = ids[i] + pickercount; - } - } - } - - - /** - * A list of element ids and/or element references used by the - * control. The default is the this.ID list, and can be customized - * by passing a list in the contructor - * @config ids - * @type {referenceid: realid} - * @writeonce - */ - this.setAttributeConfig(this.OPT.IDS, { - value: ids, - writeonce: true - }); - - /** - * A list of txt strings for internationalization. Default - * is this.TXT - * @config txt - * @type {key: txt} - * @writeonce - */ - this.setAttributeConfig(this.OPT.TXT, { - value: attr.txt || this.TXT, - writeonce: true - }); - - /** - * The img src default list - * is this.IMAGES - * @config images - * @type {key: image} - * @writeonce - */ - this.setAttributeConfig(this.OPT.IMAGES, { - value: attr.images || this.IMAGE, - writeonce: true - }); - /** - * The element refs used by this control. Set at initialization - * @config elements - * @type {id: HTMLElement} - * @readonly - */ - this.setAttributeConfig(this.OPT.ELEMENTS, { - value: {}, - readonly: true - }); - - /** - * Returns the cached element reference. If the id is not a string, it - * is assumed that it is an element and this is returned. - * @param id {string|HTMLElement} the element key, id, or ref - * @param on {boolean} hide or show. If true, show - * @private */ - _hideShowEl = function(id, on) { - var el = (lang.isString(id) ? this.getElement(id) : id); - //Dom.setStyle(id, "visibility", (on) ? "" : "hidden"); - Dom.setStyle(el, "display", (on) ? "" : "none"); - }; - - /** - * Hide/show the entire set of controls - * @config showcontrols - * @type boolean - * @default true - */ - this.setAttributeConfig(this.OPT.SHOW_CONTROLS, { - value: (attr.showcontrols) || true, - method: function(on) { - - var el = Dom.getElementsByClassName("bd", "div", - this.getElement(this.ID.CONTROLS))[0]; - - _hideShowEl.call(this, el, on); - - this.getElement(this.ID.CONTROLS_LABEL).innerHTML = - (on) ? this.get(this.OPT.TXT).HIDE_CONTROLS : - this.get(this.OPT.TXT).SHOW_CONTROLS; - - } - }); - - /** - * Hide/show the rgb controls - * @config showrgbcontrols - * @type boolean - * @default true - */ - this.setAttributeConfig(this.OPT.SHOW_RGB_CONTROLS, { - value: (attr.showrgbcontrols) || true, - method: function(on) { - //Dom.setStyle(this.getElement(this.ID.RBG_CONTROLS), "visibility", (on) ? "" : "hidden"); - _hideShowEl.call(this, this.ID.RGB_CONTROLS, on); - } - }); - - /** - * Hide/show the hsv controls - * @config showhsvcontrols - * @type boolean - * @default false - */ - this.setAttributeConfig(this.OPT.SHOW_HSV_CONTROLS, { - value: (attr.showhsvcontrols) || false, - method: function(on) { - //Dom.setStyle(this.getElement(this.ID.HSV_CONTROLS), "visibility", (on) ? "" : "hidden"); - _hideShowEl.call(this, this.ID.HSV_CONTROLS, on); - - // can't show both the hsv controls and the rbg hex summary - if (on && this.get(this.OPT.SHOW_HEX_SUMMARY)) { - this.set(this.OPT.SHOW_HEX_SUMMARY, false); - } - } - }); - - /** - * Hide/show the hex controls - * @config showhexcontrols - * @type boolean - * @default true - */ - this.setAttributeConfig(this.OPT.SHOW_HEX_CONTROLS, { - value: (attr.showhexcontrols) || false, - method: function(on) { - _hideShowEl.call(this, this.ID.HEX_CONTROLS, on); - } - }); - - /** - * Hide/show the websafe swatch - * @config showwebsafe - * @type boolean - * @default true - */ - this.setAttributeConfig(this.OPT.SHOW_WEBSAFE, { - value: (attr.showwebsafe) || true, - method: function(on) { - _hideShowEl.call(this, this.ID.WEBSAFE_SWATCH, on); - } - }); - - /** - * Hide/show the hex summary - * @config showhexsummary - * @type boolean - * @default true - */ - this.setAttributeConfig(this.OPT.SHOW_HEX_SUMMARY, { - value: (attr.showhexsummary) || true, - method: function(on) { - _hideShowEl.call(this, this.ID.HEX_SUMMARY, on); - - // can't show both the hsv controls and the rbg hex summary - if (on && this.get(this.OPT.SHOW_HSV_CONTROLS)) { - this.set(this.OPT.SHOW_HSV_CONTROLS, false); - } - } - }); - this.setAttributeConfig(this.OPT.ANIMATE, { - value: (attr.animate) || true, - method: function(on) { - this.pickerSlider.animate = on; - this.hueSlider.animate = on; - } - }); - - this.on(this.OPT.HUE + "Change", _updateRGBFromHSV, this, true); - this.on(this.OPT.SATURATION + "Change", _updateRGBFromHSV, this, true); - this.on(this.OPT.VALUE + "Change", _updatePickerSlider, this, true); - - this.on(this.OPT.RED + "Change", _updateRGB, this, true); - this.on(this.OPT.GREEN + "Change", _updateRGB, this, true); - this.on(this.OPT.BLUE + "Change", _updateRGB, this, true); - - this.on(this.OPT.HEX + "Change", _updateHex, this, true); - - this.initPicker(); - }; - - /** - * Updates the rgb attribute with the current state of the r,g,b - * fields. This is invoked from change listeners on these - * attributes to facilitate updating these values from the - * individual form fields - * @method _updateRGB - * @private - */ - var _updateRGB = function() { - var rgb = [this.get(this.OPT.RED), - this.get(this.OPT.GREEN), - this.get(this.OPT.BLUE)]; - - this.set(this.OPT.RGB, rgb); - - _updateSliders.call(this); - }; - - /** - * Updates the RGB values from the current state of the HSV - * values. Executed when the one of the HSV form fields are - * updated - * _updateRGBFromHSV - * @private - */ - var _updateRGBFromHSV = function() { - var hsv = [this.get(this.OPT.HUE), - this.get(this.OPT.SATURATION)/100, - this.get(this.OPT.VALUE)/100]; - - var rgb = Color.hsv2rgb(hsv); - - this.set(this.OPT.RGB, rgb); - - _updateSliders.call(this); - }; - - /** - * Parses the hex string to normalize shorthand values, converts - * the hex value to rgb and updates the rgb attribute (which - * updates the state for all of the other values) - * method _updateHex - * @private - */ - var _updateHex = function() { - - var hex = this.get(this.OPT.HEX), l=hex.length; - - // support #369 -> #336699 shorthand - if (l === 3) { - var c = hex.split(""), i; - for (i=0; i