summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfisharebest <fisharebest@gmail.com>2010-04-08 21:31:06 +0000
committerfisharebest <fisharebest@gmail.com>2010-04-08 21:31:06 +0000
commit6cf8d1209bf6651e53af8fe1e239a525f31089d4 (patch)
tree16e0affc5481dab50282ef099261858ee42bfb2c
parentf703820da102308064a470c2d744123b689a0c1f (diff)
downloadwebtrees-6cf8d1209bf6651e53af8fe1e239a525f31089d4.tar.gz
webtrees-6cf8d1209bf6651e53af8fe1e239a525f31089d4.tar.bz2
webtrees-6cf8d1209bf6651e53af8fe1e239a525f31089d4.zip
Fix: edit default tab settings in user/gedcom edit pages
-rw-r--r--config_gedcom.php2
-rw-r--r--editconfig_gedcom.php12
-rw-r--r--edituser.php14
-rw-r--r--includes/functions/functions_edit.php9
-rw-r--r--useradmin.php29
5 files changed, 20 insertions, 46 deletions
diff --git a/config_gedcom.php b/config_gedcom.php
index 8132b8cbcc..4277f3d804 100644
--- a/config_gedcom.php
+++ b/config_gedcom.php
@@ -122,7 +122,7 @@ $HIDE_GEDCOM_ERRORS = false; //-- a true value will disable error messages for
$WORD_WRAPPED_NOTES = false; //-- some programs wrap notes at word boundaries while others wrap notes anywhere
//-- setting this to true will add a space between words where they are wrapped in the gedcom
-$GEDCOM_DEFAULT_TAB = "0"; //-- this setting controls which tab on the individual page should first be displayed to visitors
+$GEDCOM_DEFAULT_TAB = "personal_facts"; //-- this setting controls which tab on the individual page should first be displayed to visitors
$SHOW_CONTEXT_HELP = true; // show ? links on the page for contextual popup help
$WEBTREES_EMAIL = ""; // -- "From:" address for automatically generated e-mails
diff --git a/editconfig_gedcom.php b/editconfig_gedcom.php
index a7daacff4d..47e989232e 100644
--- a/editconfig_gedcom.php
+++ b/editconfig_gedcom.php
@@ -1511,16 +1511,8 @@ print "&nbsp;<a href=\"javascript: ".i18n::translate('Layout')."\" onclick=\"exp
<td class="descriptionbox wrap width20">
<?php echo i18n::translate('Default tab to show on Individual page'), help_link('GEDCOM_DEFAULT_TAB'); ?>
</td>
- <td class="optionbox"><select name="NEW_GEDCOM_DEFAULT_TAB" tabindex="<?php echo ++$i; ?>" onfocus="getHelp('GEDCOM_DEFAULT_TAB');">
- <option value="0" <?php if ($GEDCOM_DEFAULT_TAB==0) print "selected=\"selected\""; ?>><?php print i18n::translate('Personal Facts and Details'); ?></option>
- <option value="1" <?php if ($GEDCOM_DEFAULT_TAB==1) print "selected=\"selected\""; ?>><?php print i18n::translate('Notes'); ?></option>
- <option value="2" <?php if ($GEDCOM_DEFAULT_TAB==2) print "selected=\"selected\""; ?>><?php print i18n::translate('Sources'); ?></option>
- <option value="3" <?php if ($GEDCOM_DEFAULT_TAB==3) print "selected=\"selected\""; ?>><?php print i18n::translate('Media'); ?></option>
- <option value="4" <?php if ($GEDCOM_DEFAULT_TAB==4) print "selected=\"selected\""; ?>><?php print i18n::translate('Close Relatives'); ?></option>
- <option value="5" <?php if ($GEDCOM_DEFAULT_TAB==5) print "selected=\"selected\""; ?>><?php print i18n::translate('Tree'); ?></option>
- <option value="-1" <?php if ($GEDCOM_DEFAULT_TAB==-1) print "selected=\"selected\""; ?>><?php print i18n::translate('ALL'); ?></option>
- <option value="-2" <?php if ($GEDCOM_DEFAULT_TAB==-2) print "selected=\"selected\""; ?>><?php print i18n::translate('Last Visited Tab For Individual'); ?></option>
- </select>
+ <td class="optionbox">
+ <?php echo edit_field_default_tab('NEW_GEDCOM_DEFAULT_TAB', $GEDCOM_DEFAULT_TAB, 'tabindex="'.(++$i).'" onfocus="getHelp(\'GEDCOM_DEFAULT_TAB\');"'); ?>
</td>
</tr>
<tr>
diff --git a/edituser.php b/edituser.php
index 6985e0fe35..14a8363568 100644
--- a/edituser.php
+++ b/edituser.php
@@ -42,7 +42,6 @@ if (get_user_setting(WT_USER_ID, 'editaccount')!='Y') {
// Valid values for form variables
$ALL_ACTIONS=array('update');
-$ALL_DEFAULT_TABS=array(0=>'personal_facts', 1=>'notes', 2=>'ssourcess', 3=>'media', 4=>'relatives', -1=>'all', -2=>'lasttab');
$ALL_THEMES_DIRS=array();
foreach (get_theme_names() as $themename=>$themedir) {
$ALL_THEME_DIRS[]=$themedir;
@@ -59,7 +58,7 @@ $form_rootid =safe_POST('form_rootid', WT_REGEX_XREF,
$form_theme =safe_POST('form_theme', $ALL_THEME_DIRS, $THEME_DIR );
$form_language =safe_POST('form_language', array_keys(i18n::installed_languages()), WT_LOCALE );
$form_contact_method=safe_POST('form_contact_method');
-$form_default_tab =safe_POST('form_default_tab', array_keys($ALL_DEFAULT_TABS), $GEDCOM_DEFAULT_TAB);
+$form_default_tab =safe_POST('form_default_tab', array_keys(WT_Module::getActiveTabs()), $GEDCOM_DEFAULT_TAB);
$form_visible_online=safe_POST('form_visible_online', 'Y', 'N');
// Respond to form action
@@ -228,15 +227,8 @@ echo ' /></td></tr>';
echo '<tr><td class="descriptionbox wrap">';
echo i18n::translate('Default Tab to show on Individual Information page'), help_link('edituser_user_default_tab'), '</td><td class="optionbox">';
-echo '<select name="form_default_tab" tabindex="', ++$tab, '">';
-foreach ($ALL_DEFAULT_TABS as $key=>$value) {
- echo '<option value="', $key,'"';
- if ($key==get_user_setting(WT_USER_ID, 'defaulttab')) {
- echo ' selected="selected"';
- }
- echo '>', $value, '</option>';
-}
-echo '</select></td></tr>';
+echo edit_field_default_tab('form_default_tab', get_user_setting(WT_USER_ID, 'defaulttab'), 'tabindex="'.(++$tab).'"');
+echo '</td></tr>';
echo '<tr><td class="topbottombar" colspan="2"><input type="submit" tabindex="', ++$tab, '" value="', i18n::translate('Update MyAccount'), '" /></td></tr>';
diff --git a/includes/functions/functions_edit.php b/includes/functions/functions_edit.php
index a2f158f9a3..7ec947ed00 100644
--- a/includes/functions/functions_edit.php
+++ b/includes/functions/functions_edit.php
@@ -129,6 +129,15 @@ function edit_field_rela($name, $selected='', $extra='') {
return select_edit_control($name, $RELA_CODES, '', $selected, $extra);
}
+// Print an edit control for a default tab field
+function edit_field_default_tab($name, $selected='', $extra='') {
+ $tabs=array();
+ foreach (WT_Module::getActiveTabs() as $module) {
+ $tabs[$module->getName()]=$module->getTitle();
+ }
+ return select_edit_control($name, $tabs, null, $selected, $extra);
+}
+
//-- this function creates a new unique connection
//-- and adds it to the connections file
//-- it returns the connection identifier
diff --git a/useradmin.php b/useradmin.php
index 7432949c8f..cdfe74b45c 100644
--- a/useradmin.php
+++ b/useradmin.php
@@ -42,7 +42,6 @@ if (!WT_USER_IS_ADMIN) {
// Valid values for form variables
$ALL_ACTIONS=array('cleanup', 'cleanup2', 'createform', 'createuser', 'deleteuser', 'edituser', 'edituser2', 'listusers');
-$ALL_DEFAULT_TABS=array(0=>'personal_facts', 1=>'notes', 2=>'ssourcess', 3=>'media', 4=>'relatives', -1=>'all', -2=>'lasttab');
$ALL_THEMES_DIRS=array();
foreach (get_theme_names() as $themename=>$themedir) {
$ALL_THEME_DIRS[]=$themedir;
@@ -79,7 +78,7 @@ $emailaddress =safe_POST('emailaddress', WT_REGEX_EMAIL);
$user_theme =safe_POST('user_theme', $ALL_THEME_DIRS);
$user_language =safe_POST('user_language', array_keys(i18n::installed_languages()), WT_LOCALE);
$new_contact_method =safe_POST('new_contact_method');
-$new_default_tab =safe_POST('new_default_tab', array_keys($ALL_DEFAULT_TABS), $GEDCOM_DEFAULT_TAB);
+$new_default_tab =safe_POST('new_default_tab', array_keys(WT_Module::getActiveTabs()), $GEDCOM_DEFAULT_TAB);
$new_comment =safe_POST('new_comment', WT_REGEX_UNSAFE);
$new_comment_exp =safe_POST('new_comment_exp' );
$new_max_relation_path =safe_POST_integer('new_max_relation_path', 1, $MAX_RELATION_PATH_LENGTH, 2);
@@ -415,17 +414,8 @@ if ($action=="edituser") {
</tr>
<tr>
<td class="descriptionbox wrap"><?php echo i18n::translate('Default Tab to show on Individual Information page'), help_link('useradmin_user_default_tab'); ?></td>
- <td class="optionbox wrap"><select name="new_default_tab" tabindex="<?php echo ++$tab; ?>">
- <?php
- foreach ($ALL_DEFAULT_TABS as $key=>$value) {
- echo '<option value="', $key, '"';
- if (get_user_setting($user_id, 'defaulttab')==$key) {
- echo ' selected="selected"';
- }
- echo '>', $value, '</option>';
- }
- ?>
- </select>
+ <td class="optionbox wrap">
+ <?php echo edit_field_default_tab('new_default_tab', get_user_setting($user_id, 'defaulttab'), 'tabindex="'.(++$tab).'"'); ?>
</td>
</tr>
<tr>
@@ -817,17 +807,8 @@ if ($action == "createform") {
</tr>
<tr>
<td class="descriptionbox wrap"><?php echo i18n::translate('Default Tab to show on Individual Information page'), help_link('useradmin_user_default_tab'); ?></td>
- <td class="optionbox wrap"><select name="new_default_tab" tabindex="<?php echo ++$tab; ?>">
- <?php
- foreach ($ALL_DEFAULT_TABS as $key=>$value) {
- echo '<option value="', $key, '"';
- if ($GEDCOM_DEFAULT_TAB==$key) {
- echo ' selected="selected"';
- }
- echo '>', $value, '</option>';
- }
- ?>
- </select>
+ <td class="optionbox wrap">
+ <?php echo edit_field_default_tab('new_default_tab', $GEDCOM_DEFAULT_TAB, 'tabindex="'.(++$tab).'"'); ?>
</td>
</tr>
<?php if (WT_USER_IS_ADMIN) { ?>