diff options
| author | fisharebest <fisharebest@gmail.com> | 2012-03-18 09:29:33 +0000 |
|---|---|---|
| committer | fisharebest <fisharebest@gmail.com> | 2012-03-18 09:29:33 +0000 |
| commit | e543f04b9dd72ab6a0842224147a1e77256c4ecb (patch) | |
| tree | c04989b8979ddb1174a28d879d2568f34ddcee25 /index_edit.php | |
| parent | 19ef0f7127b1eca3f07691228fe4ab0a76166b61 (diff) | |
| download | webtrees-e543f04b9dd72ab6a0842224147a1e77256c4ecb.tar.gz webtrees-e543f04b9dd72ab6a0842224147a1e77256c4ecb.tar.bz2 webtrees-e543f04b9dd72ab6a0842224147a1e77256c4ecb.zip | |
#957717 - Set default blocks
Diffstat (limited to 'index_edit.php')
| -rw-r--r-- | index_edit.php | 124 |
1 files changed, 62 insertions, 62 deletions
diff --git a/index_edit.php b/index_edit.php index 86deec5c64..0749020ec7 100644 --- a/index_edit.php +++ b/index_edit.php @@ -92,8 +92,6 @@ if ($user_id) { $blocks=get_gedcom_blocks($gedcom_id); } -$controller->pageHeader(); - if ($action=='update') { foreach (array('main', 'side') as $location) { if ($location=='main') { @@ -127,15 +125,15 @@ if ($action=='update') { exit; } -?> - <script type="text/javascript"> - <!-- -/** - * Move Up Block JavaScript function - * - * This function moves the selected option up in the given select list - * @param String section_name the name of the select to move the options - */ +$controller + ->pageHeader() + ->addInlineJavaScript(' + /** + * Move Up Block JavaScript function + * + * This function moves the selected option up in the given select list + * @param String section_name the name of the select to move the options + */ function move_up_block(section_name) { section_select = document.getElementById(section_name); if (section_select) { @@ -148,12 +146,12 @@ if ($action=='update') { } } -/** - * Move Down Block JavaScript function - * - * This function moves the selected option down in the given select list - * @param String section_name the name of the select to move the options - */ + /** + * Move Down Block JavaScript function + * + * This function moves the selected option down in the given select list + * @param String section_name the name of the select to move the options + */ function move_down_block(section_name) { section_select = document.getElementById(section_name); if (section_select) { @@ -167,41 +165,41 @@ if ($action=='update') { } } -/** - * Move Block from one column to the other JavaScript function - * - * This function moves the selected option down in the given select list - * @author KosherJava - * @param String from_column the name of the select to move the option from - * @param String to_column the name of the select to remove the option to - */ + /** + * Move Block from one column to the other JavaScript function + * + * This function moves the selected option down in the given select list + * @author KosherJava + * @param String from_column the name of the select to move the option from + * @param String to_column the name of the select to remove the option to + */ function move_left_right_block(from_column, to_column) { to_select = document.getElementById(to_column); from_select = document.getElementById(from_column); - instruct = document.getElementById('instructions'); + instruct = document.getElementById("instructions"); if ((to_select) && (from_select)) { add_option = from_select.options[from_select.selectedIndex]; - if (to_column != 'available_select') { + if (to_column != "available_select") { to_select.options[to_select.length] = new Option(add_option.text, add_option.value); } - if (from_column != 'available_select') { + if (from_column != "available_select") { from_select.options[from_select.selectedIndex] = null; //remove from list } } } -/** - * Select Options JavaScript function - * - * This function selects all the options in the multiple select lists - */ + /** + * Select Options JavaScript function + * + * This function selects all the options in the multiple select lists + */ function select_options() { - section_select = document.getElementById('main_select'); + section_select = document.getElementById("main_select"); if (section_select) { for (i=0; i<section_select.length; i++) { section_select.options[i].selected=true; } } - section_select = document.getElementById('right_select'); + section_select = document.getElementById("right_select"); if (section_select) { for (i=0; i<section_select.length; i++) { section_select.options[i].selected=true; @@ -209,49 +207,51 @@ if ($action=='update') { } return true; } - -/** - * Load Block Description array for use by javascript - */ - <?php - echo "var block_descr = new Array();"; - foreach ($all_blocks as $block_name=>$block) { - echo "block_descr['$block_name'] = '".addslashes($block->getDescription())."';"; - } - echo "block_descr['advice1'] = '".addslashes(WT_I18N::translate('Highlight a block name and then click on one of the arrow icons to move that highlighted block in the indicated direction.'))."';"; - ?> -/** - * Show Block Description JavaScript function - * - * This function shows a description for the selected option - * @param String list_name the name of the select to get the option from - */ + /** + * Show Block Description JavaScript function + * + * This function shows a description for the selected option + * @param String list_name the name of the select to get the option from + */ function show_description(list_name) { list_select = document.getElementById(list_name); - instruct = document.getElementById('instructions'); + instruct = document.getElementById("instructions"); if (block_descr[list_select.options[list_select.selectedIndex].value] && instruct) { instruct.innerHTML = block_descr[list_select.options[list_select.selectedIndex].value]; } else { - instruct.innerHTML = block_descr['advice1']; + instruct.innerHTML = block_descr["advice1"]; } - list1 = document.getElementById('main_select'); - list2 = document.getElementById('available_select'); - list3 = document.getElementById('right_select'); - if (list_name=='main_select') { + list1 = document.getElementById("main_select"); + list2 = document.getElementById("available_select"); + list3 = document.getElementById("right_select"); + if (list_name=="main_select") { list2.selectedIndex = -1; list3.selectedIndex = -1; } - if (list_name=='available_select') { + if (list_name=="available_select") { list1.selectedIndex = -1; list3.selectedIndex = -1; } - if (list_name=='right_select') { + if (list_name=="right_select") { list1.selectedIndex = -1; list2.selectedIndex = -1; } } -//--> -</script> + var block_descr = new Array(); + '); + + + // Load Block Description array for use by javascript + foreach ($all_blocks as $block_name=>$block) { + $controller->addInlineJavaScript( + 'block_descr["'.$block_name.'"] = "'.addslashes($block->getDescription()).'";' + ); + } + $controller->addInlineJavaScript( + 'block_descr["advice1"] = "'.WT_I18N::translate('Highlight a block name and then click on one of the arrow icons to move that highlighted block in the indicated direction.').'";' + ); + +?> <form name="config_setup" method="post" action="index_edit.php?action=update" onsubmit="select_options(); return modalDialogSubmitAjax(this);" > <input type="hidden" name="user_id" value="<?php echo $user_id; ?>"> <input type="hidden" name="gedcom_id" value="<?php echo $gedcom_id; ?>"> |
