13 August 2005 * * @package webtrees * @subpackage Display * @version $Id$ */ define('WT_SCRIPT_NAME', 'index_edit.php'); require './includes/session.php'; require_once WT_ROOT.'includes/index_cache.php'; if (isset($_REQUEST['action'])) $action = $_REQUEST['action']; if (isset($_REQUEST['ctype'])) $ctype = $_REQUEST['ctype']; if (isset($_REQUEST['main'])) $main = $_REQUEST['main']; if (isset($_REQUEST['right'])) $right = $_REQUEST['right']; if (isset($_REQUEST['setdefault'])) $setdefault = $_REQUEST['setdefault']; if (isset($_REQUEST['side'])) $side = $_REQUEST['side']; if (isset($_REQUEST['index'])) $index = $_REQUEST['index']; if (isset($_REQUEST['name'])) $name = $_REQUEST['name']; //-- make sure that they have user status before they can use this page //-- otherwise have them login again if (!WT_USER_ID) { print_simple_header(''); echo i18n::translate('Access Denied
You do not have access to this resource.'); echo '
', i18n::translate('Close Window').'
'; print_simple_footer(); exit; } if (!WT_USER_IS_ADMIN) $setdefault=false; if (!isset($action)) $action=''; if (!isset($ctype)) $ctype='user'; if (!isset($main)) $main=array(); if (!isset($right)) $right=array(); if (!isset($setdefault)) $setdefault=false; if (!isset($side)) $side='main'; if (!isset($index)) $index=1; // Define all the icons we're going to use $IconUarrow = "\"\""; $IconDarrow = "\"\""; $IconRarrow = "\"\""; $IconLarrow = "\"\""; $IconRDarrow = "\"\""; $IconLDarrow = "\"\""; /** * Load List of Blocks in blocks directory (unchanged) */ $WT_BLOCKS = array(); $d = dir('blocks'); while (false !== ($entry = $d->read())) { if (preg_match("/\.php$/", $entry)>0) { require_once WT_ROOT.'blocks/'.$entry; } } $d->close(); /** * End loading list of Blocks in blocks directory * * Load List of Blocks in modules/XX/blocks directories */ if (file_exists(WT_ROOT.'modules')) { $dir=dir(WT_ROOT.'modules'); while (false !== ($entry = $dir->read())) { if (!strstr($entry,'.') && ($entry!='..') && ($entry!='CVS')&& !strstr($entry, 'svn')) { $path = WT_ROOT.'modules/' . $entry.'/blocks'; if (is_readable($path)) { $d=dir($path); while (false !== ($entry = $d->read())) { if (($entry!='.') && ($entry!='..') && ($entry!='CVS')&& !strstr($entry, 'svn')&&(preg_match("/\.php$/", $entry)>0)) { $p=$path.'/'.$entry; require_once $p; } } } } } } /** * End loading list of Blocks in modules/XX/blocks directories */ // Build sorted table of block names, BUT: // include in this table ONLY if the block is appropriate for this page // If $BLOCK['type'] is 'both', include in both page types // 'user', include in My Page only // 'gedcom', include in Index page only $SortedBlocks = array(); foreach($WT_BLOCKS as $key => $BLOCK) { if ($BLOCK['type']=='both' || $BLOCK['type']==$ctype) { $SortedBlocks[$key] = $BLOCK['name']; } } asort($SortedBlocks); //-- get the blocks list if ($ctype=='user') { $ublocks = getBlocks(WT_USER_NAME); if (($action=='reset') || ((count($ublocks['main'])==0) && (count($ublocks['right'])==0))) { $ublocks['main'] = array(); $ublocks['main'][] = array('print_todays_events', ''); $ublocks['main'][] = array('print_user_messages', ''); $ublocks['main'][] = array('print_user_favorites', ''); $ublocks['right'] = array(); $ublocks['right'][] = array('print_welcome_block', ''); $ublocks['right'][] = array('print_random_media', ''); $ublocks['right'][] = array('print_upcoming_events', ''); $ublocks['right'][] = array('print_logged_in_users', ''); } } else { $ublocks = getBlocks($GEDCOM); if (($action=='reset') or ((count($ublocks['main'])==0) and (count($ublocks['right'])==0))) { $ublocks['main'] = array(); $ublocks['main'][] = array('print_gedcom_stats', ''); $ublocks['main'][] = array('print_gedcom_news', ''); $ublocks['main'][] = array('print_gedcom_favorites', ''); $ublocks['main'][] = array('review_changes_block', ''); $ublocks['right'] = array(); $ublocks['right'][] = array('print_gedcom_block', ''); $ublocks['right'][] = array('print_random_media', ''); $ublocks['right'][] = array('print_todays_events', ''); $ublocks['right'][] = array('print_logged_in_users', ''); } } if ($ctype=='user') { print_simple_header(i18n::translate('My Page')); } else { print_simple_header(get_gedcom_setting(WT_GED_ID, 'title')); } $GEDCOM_TITLE=PrintReady(get_gedcom_setting(WT_GED_ID, 'title')); if ($action=='updateconfig') { $block = $ublocks[$side][$index]; if ($WT_BLOCKS[$block[0]]['canconfig'] && is_array($WT_BLOCKS[$block[0]]['config'])) { $config = $block[1]; foreach($WT_BLOCKS[$block[0]]['config'] as $config_name=>$config_value) { if (isset($_POST[$config_name])) { $config[$config_name] = $_POST[$config_name]; } else { $config[$config_name] = ''; } } $ublocks[$side][$index][1] = $config; setBlocks($name, $ublocks, $setdefault); } echo WT_JS_START, 'opener.window.location.reload(); window.close();', WT_JS_END; exit; } if ($action=='update') { $newublocks['main'] = array(); if (is_array($main)) { foreach($main as $indexval => $b) { $config = ''; $index = ''; reset($ublocks['main']); foreach($ublocks['main'] as $index=>$block) { if ($block[0]==$b) { $config = $block[1]; break; } } if ($index!='') unset($ublocks['main'][$index]); $newublocks['main'][] = array($b, $config); } } $newublocks['right'] = array(); if (is_array($right)) { foreach($right as $indexval => $b) { $config = ''; $index = ''; reset($ublocks['right']); foreach($ublocks['right'] as $index=>$block) { if ($block[0]==$b) { $config = $block[1]; break; } } if ($index!='') unset($ublocks['right'][$index]); $newublocks['right'][] = array($b, $config); } } $ublocks = $newublocks; setBlocks($name, $ublocks, $setdefault); if (isset($_POST['nextaction'])) $action = $_POST['nextaction']; echo WT_JS_START, 'opener.window.location.reload(); window.close();', WT_JS_END; exit; } if ($action=="clearcache") { clearCache(); echo "".i18n::translate('The cache files have been removed.')."

"; } if ($action=="configure" && isset($ublocks[$side][$index])) { $block = $ublocks[$side][$index]; echo ""; echo ""; echo ""; echo "
"; echo "

".i18n::translate('Configure')."

"; echo "
"; echo "".$WT_BLOCKS[$block[0]]["name"].""; echo "
"; ?> \n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo ""; if ($WT_BLOCKS[$block[0]]["canconfig"]) { eval($block[0]."_config(\$block[1]);"); echo ""; } else { echo ""; echo ""; } echo "
"; echo ""; echo "  "; echo "
"; echo i18n::translate('This block cannot be configured.'); echo "
"; echo ""; echo "
"; echo ""; } else { ?>

"; // NOTE: Row 1: Column legends echo ""; echo "\n"; echo "\n"; echo ""; echo "\n"; 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 "
".i18n::translate('Customize My Page').""; else echo "".i18n::translate('Customize this GEDCOM Home Page').""; echo help_link('portal_config_intructions'); echo "
\n"; echo "".i18n::translate('Main Section Blocks').""; echo ""; echo "".i18n::translate('Available Blocks').""; echo ""; echo "".i18n::translate('Right Section Blocks').""; echo "
"; echo "".$IconUarrow.""; echo "
"; echo "".$IconDarrow.""; echo "

"; echo help_link('block_move_up'); echo "
\n"; echo "\n"; echo ""; echo "".$IconRDarrow.""; echo "
"; echo "".$IconRarrow.""; echo "
"; echo "".$IconLarrow.""; echo "

"; echo help_link('block_move_right'); echo "
"; echo "\n"; echo ""; echo "".$IconLDarrow.""; echo "
"; echo "".$IconLarrow.""; echo "
"; echo "".$IconRarrow.""; echo "

"; echo help_link('block_move_right'); echo "
"; echo "\n"; echo ""; echo "".$IconUarrow.""; echo "
"; echo "".$IconDarrow.""; echo "

"; echo help_link('block_move_up'); echo "
"; echo 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 "
"; if (WT_USER_IS_ADMIN && $ctype=='user') { echo i18n::translate('Use these blocks as the default block configuration for all users?')."

\n"; } echo "\n"; if ($ctype=='user') { echo help_link('block_default_portal'); } else { echo help_link('block_default_index'); } if (WT_USER_GEDCOM_ADMIN && $ctype!="user") { echo ""; echo help_link('clear_cache'); } echo "  "; echo "\n"; echo "  "; echo ""; echo "
"; echo "
\n"; // end of 1st tab echo "
\n"; //--------------------------------Start 2nd tab Help page echo "\n\t
\n\t"; echo "


\n"; echo i18n::translate("Here is a short description of each of the blocks you can place on the Welcome or My Page.
 
NameDescription
"); // end of 2nd tab echo "
\n"; } echo ""; // Yes! Absolutely NOTHING at page bottom, please.