0 && !Auth::isManager(WT_Tree::get($gedcom_id)) || $user_id && Auth::id() != $user_id && !Auth::isAdmin() ) { $controller->pageHeader(); $controller->addInlineJavascript('window.location.reload();'); exit; } $action = WT_Filter::get('action'); if (isset($_REQUEST['main'])) { $main=$_REQUEST['main']; } else { $main=array(); } if (isset($_REQUEST['right'])) { $right=$_REQUEST['right']; } else { $right=array(); } // Define all the icons we're going to use $IconUarrow = 'icon-uarrow'; $IconDarrow = 'icon-darrow'; if($TEXT_DIRECTION=='ltr') { $IconRarrow = 'icon-rarrow'; $IconLarrow = 'icon-larrow'; $IconRDarrow = 'icon-rdarrow'; $IconLDarrow = 'icon-ldarrow'; } else { $IconRarrow = 'icon-larrow'; $IconLarrow = 'icon-rarrow'; $IconRDarrow = 'icon-ldarrow'; $IconLDarrow = 'icon-rdarrow'; } $all_blocks=array(); foreach (WT_Module::getActiveBlocks() as $name=>$block) { if ($user_id && $block->isUserBlock() || $gedcom_id && $block->isGedcomBlock()) { $all_blocks[$name]=$block; } } if ($user_id) { $blocks=get_user_blocks($user_id); } elseif ($gedcom_id) { $blocks=get_gedcom_blocks($gedcom_id); } if ($action=='update') { Zend_Session::writeClose(); foreach (array('main', 'side') as $location) { if ($location=='main') { $new_blocks=$main; } else { $new_blocks=$right; } foreach ($new_blocks as $order=>$block_name) { if (is_numeric($block_name)) { // existing block WT_DB::prepare("UPDATE `##block` SET block_order=? WHERE block_id=?")->execute(array($order, $block_name)); // existing block moved location WT_DB::prepare("UPDATE `##block` SET location=? WHERE block_id=?")->execute(array($location, $block_name)); } else { // new block if ($user_id) { WT_DB::prepare("INSERT INTO `##block` (user_id, location, block_order, module_name) VALUES (?, ?, ?, ?)")->execute(array($user_id, $location, $order, $block_name)); } else { WT_DB::prepare("INSERT INTO `##block` (gedcom_id, location, block_order, module_name) VALUES (?, ?, ?, ?)")->execute(array($gedcom_id, $location, $order, $block_name)); } } } // deleted blocks foreach ($blocks[$location] as $block_id=>$block_name) { if (!in_array($block_id, $main) && !in_array($block_id, $right)) { WT_DB::prepare("DELETE FROM `##block_setting` WHERE block_id=?")->execute(array($block_id)); WT_DB::prepare("DELETE FROM `##block` WHERE block_id=?")->execute(array($block_id)); } } } exit; } $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) { if (section_select.selectedIndex <= 0) return false; index = section_select.selectedIndex; temp = new Option(section_select.options[index-1].text, section_select.options[index-1].value); section_select.options[index-1] = new Option(section_select.options[index].text, section_select.options[index].value); section_select.options[index] = temp; section_select.selectedIndex = index-1; } } /** * 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) { if (section_select.selectedIndex < 0) return false; if (section_select.selectedIndex >= section_select.length-1) return false; index = section_select.selectedIndex; temp = new Option(section_select.options[index+1].text, section_select.options[index+1].value); section_select.options[index+1] = new Option(section_select.options[index].text, section_select.options[index].value); section_select.options[index] = temp; section_select.selectedIndex = index+1; } } /** * Move Block from one column to the other Javascript function * * This function moves the selected option down in the given select list * * @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"); if ((to_select) && (from_select)) { add_option = from_select.options[from_select.selectedIndex]; if (to_column != "available_select") { to_select.options[to_select.length] = new Option(add_option.text, add_option.value); } 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 */ function select_options() { section_select = document.getElementById("main_select"); if (section_select) { for (i=0; i$block) { $controller->addInlineJavascript( 'block_descr["'.$block_name.'"] = "'.WT_Filter::escapeJs($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.').'";' ); ?>
'; echo ''; echo ''; echo ''; echo ''; echo ''; // NOTE: Row 2 column 1: Up/Down buttons for left (main) block list echo ''; // NOTE: Row 2 column 2: Left (Main) block list echo ''; // NOTE: Row 2 column 3: Left/Right buttons for left (main) block list echo ''; // Row 2 column 4: Middle (Available) block list echo ''; // NOTE: Row 2 column 5: Left/Right buttons for right block list echo ''; // NOTE: Row 2 column 6: Right block list echo ''; // NOTE: Row 2 column 7: Up/Down buttons for right block list echo ''; echo ''; // NOTE: Row 3 columns 1-7: Summary description of currently selected block echo ''; echo '
'; echo '', WT_I18N::translate('Main section blocks'), ''; echo ''; echo '', WT_I18N::translate('Available blocks'), ''; echo ''; echo '', WT_I18N::translate('Right section blocks'), ''; echo '
'; echo ''; echo '
'; echo ''; echo '

'; echo help_link('block_move_up'); echo '
'; echo ''; echo ''; echo ''; echo '
'; echo ''; echo '
'; echo ''; echo '

'; echo help_link('block_move_right'); echo '
'; echo ''; echo ''; echo ''; echo '
'; echo ''; echo '
'; echo ''; echo '

'; echo help_link('block_move_right'); echo '
'; echo ''; echo ''; echo ''; echo '
'; echo ''; echo '

'; echo help_link('block_move_up'); echo '
'; echo 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.'); echo '
'; echo ''; echo '
'; echo '
';