From 664f5a84cce34660e57e0ead947fc887e84c0cd0 Mon Sep 17 00:00:00 2001 From: fisharebest Date: Fri, 21 Oct 2011 15:03:42 +0000 Subject: #821931 - Individual.php: Default tab isn't selected --- admin_pgv_to_wt.php | 16 +------------ admin_trees_config.php | 9 -------- admin_users.php | 11 --------- edituser.php | 7 ------ help_text.php | 15 ------------ includes/db_schema/db_schema_14_15.php | 42 ++++++++++++++++++++++++++++++++++ includes/functions/functions_edit.php | 16 ------------- includes/session.php | 2 +- includes/set_gedcom_defaults.php | 1 - individual.php | 10 ++++---- library/WT/Controller/Individual.php | 15 ------------ login_register.php | 1 - save.php | 3 +-- 13 files changed, 50 insertions(+), 98 deletions(-) create mode 100644 includes/db_schema/db_schema_14_15.php diff --git a/admin_pgv_to_wt.php b/admin_pgv_to_wt.php index ce979d8d79..c598f9eeab 100644 --- a/admin_pgv_to_wt.php +++ b/admin_pgv_to_wt.php @@ -312,15 +312,7 @@ if ($PGV_SCHEMA_VERSION>=12) { " WHEN 'themes/simplyred/' THEN 'colors'". " WHEN 'themes/xenea/' THEN 'xenea'". " ELSE 'themes/webtrees/'". // ocean, simplyred/blue/green, standard, wood - " END". - " WHEN 'defaulttab' THEN". - " CASE setting_value". - " WHEN '1' THEN 'notes'". - " WHEN '2' THEN 'sources_tab'". - " WHEN '3' THEN 'media'". - " WHEN '4' THEN 'relatives'". - " ELSE 'personal_facts'". // -1=all and -2=last are not supported - " END". + " END". " ELSE". " CASE". " WHEN setting_value IN ('Y', 'yes') THEN 1 WHEN setting_value IN ('N', 'no') THEN 0 ELSE setting_value END". @@ -471,11 +463,6 @@ if ($PGV_SCHEMA_VERSION>=12) { " FROM `{$DBNAME}`.`{$TBLPREFIX}users`". " JOIN `##user` ON (user_name=CONVERT(u_username USING utf8) COLLATE utf8_unicode_ci)". " UNION ALL". - " SELECT user_id, 'defaulttab', ". - " CASE u_defaulttab WHEN 1 THEN 'notes' WHEN 2 THEN 'sources_tab' WHEN 3 THEN 'media' WHEN 4 THEN 'relatives' ELSE 'personal_facts' END". - " FROM `{$DBNAME}`.`{$TBLPREFIX}users`". - " JOIN `##user` ON (user_name=CONVERT(u_username USING utf8) COLLATE utf8_unicode_ci)". - " UNION ALL". " SELECT user_id, 'comment', u_comment". " FROM `{$DBNAME}`.`{$TBLPREFIX}users`". " JOIN `##user` ON (user_name=CONVERT(u_username USING utf8) COLLATE utf8_unicode_ci)". @@ -607,7 +594,6 @@ foreach (get_all_gedcoms() as $ged_id=>$gedcom) { @set_gedcom_setting($ged_id, 'FAM_FACTS_UNIQUE', $FAM_FACTS_UNIQUE); @set_gedcom_setting($ged_id, 'FAM_ID_PREFIX', $FAM_ID_PREFIX); @set_gedcom_setting($ged_id, 'FULL_SOURCES', $FULL_SOURCES); - @set_gedcom_setting($ged_id, 'GEDCOM_DEFAULT_TAB', $GEDCOM_DEFAULT_TAB); @set_gedcom_setting($ged_id, 'GEDCOM_ID_PREFIX', $GEDCOM_ID_PREFIX); @set_gedcom_setting($ged_id, 'GENERATE_UIDS', $GENERATE_UIDS); @set_gedcom_setting($ged_id, 'HIDE_GEDCOM_ERRORS', $HIDE_GEDCOM_ERRORS); diff --git a/admin_trees_config.php b/admin_trees_config.php index 0c7defd958..24c8d1a3a0 100644 --- a/admin_trees_config.php +++ b/admin_trees_config.php @@ -185,7 +185,6 @@ case 'update': set_gedcom_setting(WT_GED_ID, 'FAM_FACTS_UNIQUE', str_replace(' ', '', safe_POST('NEW_FAM_FACTS_UNIQUE'))); set_gedcom_setting(WT_GED_ID, 'FAM_ID_PREFIX', safe_POST('NEW_FAM_ID_PREFIX')); set_gedcom_setting(WT_GED_ID, 'FULL_SOURCES', safe_POST_bool('NEW_FULL_SOURCES')); - set_gedcom_setting(WT_GED_ID, 'GEDCOM_DEFAULT_TAB', safe_POST('NEW_GEDCOM_DEFAULT_TAB')); set_gedcom_setting(WT_GED_ID, 'GEDCOM_ID_PREFIX', safe_POST('NEW_GEDCOM_ID_PREFIX')); set_gedcom_setting(WT_GED_ID, 'GENERATE_UIDS', safe_POST_bool('NEW_GENERATE_UIDS')); set_gedcom_setting(WT_GED_ID, 'HIDE_GEDCOM_ERRORS', !safe_POST_bool('NEW_HIDE_GEDCOM_ERRORS')); @@ -1162,14 +1161,6 @@ echo WT_JS_START;?> - - - - - - - - diff --git a/admin_users.php b/admin_users.php index a6f1f46781..d049b4922d 100644 --- a/admin_users.php +++ b/admin_users.php @@ -64,7 +64,6 @@ $emailaddress =safe_POST('emailaddress', WT_REGEX_EMAIL); $user_theme =safe_POST('user_theme', $ALL_THEME_DIRS); $user_language =safe_POST('user_language', array_keys(WT_I18N::installed_languages()), WT_LOCALE); $new_contact_method =safe_POST('new_contact_method'); -$new_default_tab =safe_POST('new_default_tab', array_keys(WT_Module::getActiveTabs()), get_gedcom_setting(WT_GED_ID, 'GEDCOM_DEFAULT_TAB')); $new_comment =safe_POST('new_comment', WT_REGEX_UNSAFE); $new_auto_accept =safe_POST_bool('new_auto_accept'); $canadmin =safe_POST_bool('canadmin'); @@ -224,9 +223,6 @@ case 'load1row': echo '
', WT_I18N::translate('Theme'), '
'; echo '
', select_edit_control_inline('user_setting-'.$user_id.'-theme', array_flip(get_theme_names()), WT_I18N::translate(''), get_user_setting($user_id, 'theme')), '
'; - echo '
', WT_I18N::translate('Default Tab to show on Individual Information page'), '
'; - echo '
', edit_field_default_tab_inline('user_setting-'.$user_id.'-defaulttab', get_user_setting($user_id, 'defaulttab', 'personal_facts')), '
'; - echo '
', WT_I18N::translate('Visible to other users when online'), '
'; echo '
', edit_field_yes_no_inline('user_setting-'.$user_id.'-visibleonline', get_user_setting($user_id, 'visibleonline')), '
'; @@ -313,7 +309,6 @@ if ($action=='createuser' || $action=='edituser2') { set_user_setting($user_id, 'theme', $user_theme); set_user_setting($user_id, 'language', $user_language); set_user_setting($user_id, 'contactmethod', $new_contact_method); - set_user_setting($user_id, 'defaulttab', $new_default_tab); set_user_setting($user_id, 'comment', $new_comment); set_user_setting($user_id, 'auto_accept', $new_auto_accept); set_user_setting($user_id, 'canadmin', $canadmin); @@ -499,12 +494,6 @@ case 'createform': - - - - - - diff --git a/edituser.php b/edituser.php index f1e0f47be1..21813bf17d 100644 --- a/edituser.php +++ b/edituser.php @@ -51,7 +51,6 @@ $form_rootid =safe_POST('form_rootid', WT_REGEX_XREF, $form_theme =safe_POST('form_theme', $ALL_THEME_DIRS); $form_language =safe_POST('form_language', array_keys(WT_I18N::installed_languages()), WT_LOCALE ); $form_contact_method=safe_POST('form_contact_method'); -$form_default_tab =safe_POST('form_default_tab', array_keys(WT_Module::getActiveTabs()), get_gedcom_setting(WT_GED_ID, 'GEDCOM_DEFAULT_TAB')); $form_visible_online=safe_POST_bool('form_visible_online'); // Respond to form action @@ -78,7 +77,6 @@ if ($form_action=='update') { $_SESSION['locale']=$form_language; // switch to the new language right away set_user_setting(WT_USER_ID, 'contactmethod', $form_contact_method); set_user_setting(WT_USER_ID, 'visibleonline', $form_visible_online); - set_user_setting(WT_USER_ID, 'defaulttab', $form_default_tab); set_user_gedcom_setting(WT_USER_ID, WT_GED_ID, 'rootid', $form_rootid); // Change username @@ -215,11 +213,6 @@ echo ''; echo checkbox('form_visible_online', get_user_setting(WT_USER_ID, 'visibleonline')); echo ''; -echo ''; -echo WT_I18N::translate('Default Tab to show on Individual Information page'), help_link('edituser_user_default_tab'), ''; -echo edit_field_default_tab('form_default_tab', get_user_setting(WT_USER_ID, 'defaulttab')); -echo ''; - echo ''; echo ''; diff --git a/help_text.php b/help_text.php index 6220c73c4f..647221303e 100644 --- a/help_text.php +++ b/help_text.php @@ -1439,11 +1439,6 @@ case 'FULL_SOURCES': $text=WT_I18N::translate('Source citations can include fields to record the quality of the data (primary, secondary, etc.) and the date the event was recorded in the source. If you don\'t use these fields, you can disable them when creating new source citations.'); break; -case 'GEDCOM_DEFAULT_TAB': - $title=WT_I18N::translate('Default tab to show on individual page'); - $text=WT_I18N::translate('This option allows you to choose which tab opens automatically on the Individual page when that page is accessed.'); - break; - case 'GEDCOM_ID_PREFIX': $title=WT_I18N::translate('Individual ID prefix'); $text=WT_I18N::translate('When a new individual record is added online in webtrees, a new ID for that individual will be generated automatically. The individual ID will have this prefix.'); @@ -2395,11 +2390,6 @@ case 'edituser_rootid': $text=WT_I18N::translate('This is the starting (Root) person of all your charts.

If, for example, you were to click the link to the Pedigree, you would see this root person in the leftmost box. This root person does not have to be you; you can start with any person (your grandfather or your mother\'s aunt, for instance), as long you have the rights to see that person.

This changes the default Root person for most charts. You can change the Root person on many charts, but that is just for that page at that particular invocation.'); break; -case 'edituser_user_default_tab': - $title=WT_I18N::translate('Default tab setting'); - $text=WT_I18N::translate('This setting allows you to specify which tab is opened automatically when you access the Individual Information page.'); - break; - case 'edituser_username': $title=WT_I18N::translate('Username'); $text=WT_I18N::translate('You can change your username by updating it here. Usernames are case insensitive and ignore accented letters, so that "chloe", "chloë" and "CHLOE" are considered to be the same. Usernames may not contain the following characters: <>"%%{};'); @@ -2902,11 +2892,6 @@ case 'useradmin_rootid': $text=WT_I18N::translate('For each genealogical database, you can designate a Root Person for the user.

This Root Person does not need to be the user himself; it can be anybody. The user will probably want to start the Pedigree chart with himself. You control that, as well as the default Root person on other charts, here.

If the user has Edit rights to his own account information, he can change this setting himself.'); break; -case 'useradmin_user_default_tab': - $title=WT_I18N::translate('User default tab setting'); - $text=WT_I18N::translate('This setting allows you to specify which tab is opened automatically when this user accesses the Individual Information page. If allowed to edit their account, the user can change this setting later.'); - break; - case 'useradmin_verification': $title=WT_I18N::translate('Account approval and email verification'); $text=WT_I18N::translate('When a user registers for an account, an email is sent to their email address with a verification link. When they click this link, we know the email address is correct, and the "email verified" option is selected automatically.'). diff --git a/includes/db_schema/db_schema_14_15.php b/includes/db_schema/db_schema_14_15.php new file mode 100644 index 0000000000..e842bc53bc --- /dev/null +++ b/includes/db_schema/db_schema_14_15.php @@ -0,0 +1,42 @@ +getName()]=$module->getTitle(); - } - return select_edit_control($name, $tabs, null, $selected, $extra); -} -function edit_field_default_tab_inline($name, $selected='', $extra='') { - $tabs=array(); - foreach (WT_Module::getActiveTabs() as $module) { - $tabs[$module->getName()]=$module->getTitle(); - } - return select_edit_control_inline($name, $tabs, null, $selected, $extra); -} - /** * Check if the given gedcom record has changed since the last session access * This is used to check if the gedcom record changed between the time the user diff --git a/includes/session.php b/includes/session.php index fff20df4ff..767c326135 100644 --- a/includes/session.php +++ b/includes/session.php @@ -78,7 +78,7 @@ define('WT_DEBUG_LANG', false); define('WT_ERROR_LEVEL', 2); // 0=none, 1=minimal, 2=full // Required version of database tables/columns/indexes/etc. -define('WT_SCHEMA_VERSION', 14); +define('WT_SCHEMA_VERSION', 15); // Regular expressions for validating user input, etc. define('WT_REGEX_XREF', '[A-Za-z0-9:_-]+'); diff --git a/includes/set_gedcom_defaults.php b/includes/set_gedcom_defaults.php index a30c52429b..060eaabb2c 100644 --- a/includes/set_gedcom_defaults.php +++ b/includes/set_gedcom_defaults.php @@ -56,7 +56,6 @@ set_gedcom_setting($ged_id, 'FAM_FACTS_QUICK', 'MARR,DIV,_NMR'); set_gedcom_setting($ged_id, 'FAM_FACTS_UNIQUE', 'NCHI,MARL,DIV,ANUL,DIVF,ENGA,MARB,MARC,MARS'); set_gedcom_setting($ged_id, 'FAM_ID_PREFIX', 'F'); set_gedcom_setting($ged_id, 'FULL_SOURCES', false); -set_gedcom_setting($ged_id, 'GEDCOM_DEFAULT_TAB', 'personal_facts'); set_gedcom_setting($ged_id, 'GEDCOM_ID_PREFIX', 'I'); set_gedcom_setting($ged_id, 'GENERATE_UIDS', false); set_gedcom_setting($ged_id, 'HIDE_GEDCOM_ERRORS', true); diff --git a/individual.php b/individual.php index 7d24fa8d71..21fc57107b 100644 --- a/individual.php +++ b/individual.php @@ -250,12 +250,12 @@ foreach ($controller->tabs as $tab) { $greyed_out=''; } if ($tab->hasTabContent()) { - if ($tab->getName()==$controller->default_tab || !$tab->canLoadAjax()) { - // The default tab and non-AJAX tabs load immediately - echo '
  • '; - } else { + if ($tab->canLoadAjax()) { // AJAX tabs load only when selected echo '
  • '; + } else { + // Non-AJAX tabs load immediately + echo '
  • '; } echo '', $tab->getTitle(), '
  • '; } @@ -263,7 +263,7 @@ foreach ($controller->tabs as $tab) { echo ''; foreach ($controller->tabs as $tab) { if ($tab->hasTabContent()) { - if ($tab->getName()==$controller->default_tab || !$tab->canLoadAjax()) { + if (!$tab->canLoadAjax()) { echo '
    ', $tab->getTabContent(), '
    '; } } diff --git a/library/WT/Controller/Individual.php b/library/WT/Controller/Individual.php index 3d2b9eb4ea..d7958ec479 100644 --- a/library/WT/Controller/Individual.php +++ b/library/WT/Controller/Individual.php @@ -35,8 +35,6 @@ class WT_Controller_Individual extends WT_Controller_Base { var $pid = ''; var $indi = null; var $diffindi = null; - var $default_tab = ''; - var $name_count = 0; var $total_names = 0; var $SEX_COUNT = 0; @@ -63,14 +61,6 @@ class WT_Controller_Individual extends WT_Controller_Base { $gedrec = "0 @".$this->pid."@ INDI\n"; } - if (WT_USER_ID) { - // Start with the user's default tab - $this->default_tab=get_user_setting(WT_USER_ID, 'defaulttab'); - } else { - // Start with the gedcom's default tab - $this->default_tab=get_gedcom_setting(WT_GED_ID, 'GEDCOM_DEFAULT_TAB'); - } - if (find_person_record($this->pid, WT_GED_ID) || find_updated_record($this->pid, WT_GED_ID)!==null) { $this->indi = new WT_Person($gedrec); $this->indi->ged_id=WT_GED_ID; // This record is from a file @@ -140,11 +130,6 @@ class WT_Controller_Individual extends WT_Controller_Base { $this->tabs = WT_Module::getActiveTabs(); foreach ($this->tabs as $mod) { $mod->setController($this); - if ($mod->hasTabContent()) { - if (empty($this->default_tab)) { - $this->default_tab=$mod->getName(); - } - } } if (!isset($_SESSION['WT_pin']) && $DEFAULT_PIN_STATE) diff --git a/login_register.php b/login_register.php index 68be13b883..384affc6b1 100644 --- a/login_register.php +++ b/login_register.php @@ -335,7 +335,6 @@ switch ($action) { set_user_setting($user_id, 'reg_timestamp', date('U')); set_user_setting($user_id, 'reg_hashcode', md5(uniqid(rand(), true))); set_user_setting($user_id, 'contactmethod', "messaging2"); - set_user_setting($user_id, 'defaulttab', get_gedcom_setting(WT_GED_ID, 'GEDCOM_DEFAULT_TAB')); set_user_setting($user_id, 'visibleonline', 1); set_user_setting($user_id, 'editaccount', 1); set_user_setting($user_id, 'auto_accept', 0); diff --git a/save.php b/save.php index b785965cb1..9ff4888d68 100644 --- a/save.php +++ b/save.php @@ -190,7 +190,7 @@ case 'user_setting': ////////////////////////////////////////////////////////////////////////////// // Authorisation - if (!(WT_USER_IS_ADMIN || WT_USER_ID && get_user_setting($id1, 'editaccount') && _array($id2, array('language','defaulttab','visible_online','contact_method')))) { + if (!(WT_USER_IS_ADMIN || WT_USER_ID && get_user_setting($id1, 'editaccount') && _array($id2, array('language','visible_online','contact_method')))) { fail(); } @@ -212,7 +212,6 @@ case 'user_setting': break; case 'contactmethod': case 'comment': - case 'defaulttab': case 'language': case 'theme': break; -- cgit v1.3