summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfisharebest <fisharebest@gmail.com>2010-05-12 18:02:44 +0000
committerfisharebest <fisharebest@gmail.com>2010-05-12 18:02:44 +0000
commitccf91e120a8099f216b109277444926485f68e36 (patch)
tree8a1afc20580bdfdeb755511c1d149147929080e9
parent1dc29368a477203270953fd023e74aaa324da7fc (diff)
downloadwebtrees-ccf91e120a8099f216b109277444926485f68e36.tar.gz
webtrees-ccf91e120a8099f216b109277444926485f68e36.tar.bz2
webtrees-ccf91e120a8099f216b109277444926485f68e36.zip
Convert blocks to modules
-rw-r--r--blocks/.htaccess3
-rw-r--r--blocks/block_htmlplus.php343
-rw-r--r--blocks/charts.php237
-rw-r--r--blocks/gedcom_block.php68
-rw-r--r--blocks/gedcom_favorites.php206
-rw-r--r--blocks/gedcom_news.php189
-rw-r--r--blocks/gedcom_stats.php362
-rw-r--r--blocks/html_block.php116
-rw-r--r--blocks/logged_in.php114
-rw-r--r--blocks/login_block.php166
-rw-r--r--blocks/random_media.php466
-rw-r--r--blocks/recent_changes.php137
-rw-r--r--blocks/review_changes.php187
-rw-r--r--blocks/rss_block.php94
-rw-r--r--blocks/theme_select.php65
-rw-r--r--blocks/todays_events.php191
-rw-r--r--blocks/todo.php159
-rw-r--r--blocks/top10_givnnames.php168
-rw-r--r--blocks/top10_pageviews.php167
-rw-r--r--blocks/top10_surnames.php168
-rw-r--r--blocks/upcoming_events.php216
-rw-r--r--blocks/user_blog.php92
-rw-r--r--blocks/user_favorites.php204
-rw-r--r--blocks/user_messages.php169
-rw-r--r--blocks/user_welcome.php79
-rw-r--r--blocks/yahrzeit.php302
-rw-r--r--includes/authentication.php51
-rw-r--r--includes/classes/class_module.php9
-rw-r--r--includes/functions/functions_db.php109
-rw-r--r--index.php368
-rw-r--r--index_edit.php224
-rw-r--r--modules/block_htmlplus/block_htmlplus_keywords.tpl (renamed from blocks/block_htmlplus_keywords.tpl)0
-rw-r--r--modules/block_htmlplus/block_htmlplus_narrative.tpl (renamed from blocks/block_htmlplus_narrative.tpl)0
-rw-r--r--modules/block_htmlplus/block_htmlplus_stats.tpl (renamed from blocks/block_htmlplus_stats.tpl)0
-rw-r--r--modules/block_htmlplus/module.php279
-rw-r--r--modules/charts/module.php183
-rw-r--r--modules/gedcom_block/module.php38
-rw-r--r--modules/gedcom_favorites/module.php243
-rw-r--r--modules/gedcom_news/module.php152
-rw-r--r--modules/gedcom_stats/module.php330
-rw-r--r--modules/html_block/module.php69
-rw-r--r--modules/logged_in/module.php68
-rw-r--r--modules/login_block/module.php127
-rw-r--r--modules/random_media/module.php447
-rw-r--r--modules/recent_changes/module.php93
-rw-r--r--modules/review_changes/module.php142
-rw-r--r--modules/rss_block/module.php53
-rw-r--r--modules/theme_select/module.php30
-rw-r--r--modules/todays_events/module.php135
-rw-r--r--modules/todo/module.php122
-rw-r--r--modules/top10_givnnames/module.php115
-rw-r--r--modules/top10_pageviews/module.php108
-rw-r--r--modules/top10_surnames/module.php126
-rw-r--r--modules/upcoming_events/module.php121
-rw-r--r--modules/user_blog/module.php65
-rw-r--r--modules/user_favorites/module.php238
-rw-r--r--modules/user_messages/module.php152
-rw-r--r--modules/user_welcome/module.php42
-rw-r--r--modules/yahrzeit/module.php230
-rw-r--r--setup.php35
60 files changed, 3810 insertions, 5362 deletions
diff --git a/blocks/.htaccess b/blocks/.htaccess
deleted file mode 100644
index a01109e320..0000000000
--- a/blocks/.htaccess
+++ /dev/null
@@ -1,3 +0,0 @@
-# $Id$
-order allow,deny
-deny from all
diff --git a/blocks/block_htmlplus.php b/blocks/block_htmlplus.php
deleted file mode 100644
index edf4570910..0000000000
--- a/blocks/block_htmlplus.php
+++ /dev/null
@@ -1,343 +0,0 @@
-<?php
-/**
- * Advanced HTML Block
- *
- * This block will print advanced HTML text with keyword support entered by an admin
- *
- * webtrees: Web based Family History software
- * Copyright (C) 2010 webtrees development team.
- *
- * Derived from PhpGedView
- * Copyright (C) 2002 to 2009 PGV Development Team. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * @author Patrick Kellum
- * @package webtrees
- * @subpackage Blocks
- * @version $Id$
- */
-
-if (!defined('WT_WEBTREES')) {
- header('HTTP/1.0 403 Forbidden');
- exit;
-}
-
-define('WT_BLOCK_HTMLPLUS_PHP', '');
-
-require_once WT_ROOT.'includes/functions/functions_print_lists.php';
-require_once WT_ROOT.'includes/classes/class_stats.php';
-
-$WT_BLOCKS['print_htmlplus_block']=array(
- 'name'=>i18n::translate('Advanced HTML'),
- 'type'=>'both',
- 'descr'=>i18n::translate('This is an HTML block that you can place on your page to add any sort of message you may want. You can insert references to information from your GEDCOM into the HTML text.'),
- 'canconfig'=>true,
- 'config'=>array(
- 'cache'=>0,
- 'title'=>'',
- 'html'=>i18n::translate('<p class="blockhc"><b>Put your title here</b></p><br /><p>Click the configure button')." <img src=\"{$WT_IMAGE_DIR}/{$WT_IMAGES['admin']['small']}\" alt=\"".i18n::translate('Configure')."\" /> ".i18n::translate('to change what is printed here.</p>'),
- 'gedcom'=>'__current__',
- 'compat'=>0,
- 'ui'=>0
- )
-);
-
-function print_htmlplus_block($block=true, $config='', $side, $index) {
- global $ctype, $GEDCOM, $HTML_BLOCK_COUNT, $WT_BLOCKS, $WT_IMAGE_DIR, $WT_IMAGES, $TEXT_DIRECTION, $MULTI_MEDIA, $SHOW_ID_NUMBERS;
- // config sanity check
- if (empty($config)){$config = $WT_BLOCKS['print_htmlplus_block']['config'];}else{foreach($WT_BLOCKS['print_htmlplus_block']['config'] as $k=>$v){if (!isset($config[$k])){$config[$k] = $v;}}}
-
- if (!isset($HTML_BLOCK_COUNT)){$HTML_BLOCK_COUNT = 0;}$HTML_BLOCK_COUNT++;
-
- /*
- * Select GEDCOM
- */
- switch($config['gedcom']) {
- case '__current__':
- break;
- case '':
- break;
- case '__default__':
- $GEDCOM=get_site_setting('DEFAULT_GEDCOM');
- if (!$GEDCOM) {
- foreach (get_all_gedcoms() as $gedcom) {
- $GEDCOM=$gedcom;
- break;
- }
- }
- break;
- default:
- if (get_gedcom_setting(get_gedcom_from_id($config['gedcom']), 'imported')) {
- $GEDCOM = $config['gedcom'];
- }
- break;
- }
-
- /*
- * Initiate the stats object.
- */
- if($config['compat'] == 1)
- {
- require_once WT_ROOT.'includes/classes/class_stats_compat.php';
- $stats = new stats_compat($GEDCOM);
- }
- elseif($config['ui'] == 1)
- {
- require_once WT_ROOT.'includes/classes/class_stats_ui.php';
- $stats = new stats_ui($GEDCOM);
- }
- else
- {
- $stats = new stats($GEDCOM);
- }
-
- // Make some values from the GEDCOM's 0 HEAD record visible to the world
- global $CREATED_SOFTWARE, $CREATED_VERSION, $CREATED_DATE;
- $CREATED_SOFTWARE = $stats->gedcomCreatedSoftware();
- $CREATED_VERSION = $stats->gedcomCreatedVersion();
- $CREATED_DATE = $stats->gedcomDate();
-
- /*
- * First Pass.
- * Handle embedded language, fact, global, etc. references
- * This needs to be done first because the language variables could themselves
- * contain embedded keywords.
- */
- // Title
- $config['title'] = embed_globals($config['title']);
- // Content
- $config['html'] = embed_globals($config['html']);
-
- /*
- * Second Pass.
- */
- list($new_tags, $new_values) = $stats->getTags("{$config['title']} {$config['html']}");
- // Title
- if (strstr($config['title'], '#')){$config['title'] = str_replace($new_tags, $new_values, $config['title']);}
- // Content
- $config['html'] = str_replace($new_tags, $new_values, $config['html']);
-
- /*
- * Restore Current GEDCOM
- */
- $GEDCOM = WT_GEDCOM;
-
- /*
- * Start Of Output
- */
- $id = "html_block{$HTML_BLOCK_COUNT}";
- $title = "";
- if ($config['title'] != '') {
- if ($WT_BLOCKS['print_htmlplus_block']['canconfig']) {
- if ($ctype=="gedcom" && WT_USER_GEDCOM_ADMIN || $ctype=="user" && WT_USER_ID) {
- if ($ctype=="gedcom") {
- $name = WT_GEDCOM;
- } else {
- $name = WT_USER_NAME;
- }
- $title .= "<a href=\"javascript: configure block\" onclick=\"window.open('".encode_url("index_edit.php?name={$name}&ctype={$ctype}&action=configure&side={$side}&index={$index}")."', '_blank', 'top=50,left=50,width=600,height=350,scrollbars=1,resizable=1'); return false;\">"
- ."<img class=\"adminicon\" src=\"{$WT_IMAGE_DIR}/{$WT_IMAGES['admin']['small']}\" width=\"15\" height=\"15\" border=\"0\" alt=\"".i18n::translate('Configure').'" /></a>'
- ;
- }
- }
- $title .= $config['title'];
- }
- if (WT_USER_GEDCOM_ADMIN) {
- $title .= help_link('index_htmlplus_a');
- } else {
- $title .= help_link('index_htmlplus');
- }
-
- $content = $config['html'];
- if ($config['title'] == '' && $WT_BLOCKS['print_htmlplus_block']['canconfig']) {
- if ($ctype=="gedcom" && WT_USER_GEDCOM_ADMIN || $ctype=="user" && WT_USER_ID) {
- if ($ctype=="gedcom") {
- $name = str_replace("'", "\'", $GEDCOM);
- } else {
- $name = WT_USER_NAME;
- }
- $content .= "<br />"
- ."<a href=\"javascript:;\" onclick=\"window.open('".encode_url("index_edit.php?name={$name}&ctype={$ctype}&action=configure&side={$side}&index={$index}")."', '_blank', 'top=50,left=50,width=600,height=500,scrollbars=1,resizable=1'); return false;\">"
- ."<img class=\"adminicon\" src=\"{$WT_IMAGE_DIR}/{$WT_IMAGES['admin']['small']}\" width=\"15\" height=\"15\" border=\"0\" alt=\"".i18n::translate('Configure')."\" title=\"".i18n::translate('Configure')."\" /></a>"
- .help_link('index_htmlplus_ahelp');
- }
- }
-
- global $THEME_DIR;
- if ($block) {
- require $THEME_DIR.'templates/block_small_temp.php';
- } else {
- require $THEME_DIR.'templates/block_main_temp.php';
- }
-}
-
-function print_htmlplus_block_config($config)
-{
- global $ctype, $WT_BLOCKS, $TEXT_DIRECTION, $GEDCOM;
- $useFCK = file_exists(WT_ROOT.'modules/FCKeditor/fckeditor.php');
- $templates = array();
- $d = dir('blocks/');
- while(false !== ($entry = $d->read()))
- {
- if(strstr($entry, 'block_htmlplus_'))
- {
- $tpl = file("blocks/{$entry}");
- $info = array_shift($tpl);
- $bits = explode('|', $info);
- if(count($bits) != 2)
- {
- $bits = array($entry, '');
- }
- $templates[] = array(
- 'filename' =>$entry,
- 'title' =>$bits[0],
- 'description' =>$bits[1],
- 'template' =>htmlspecialchars(join('', $tpl),ENT_COMPAT,'UTF-8')
- );
- }
- }
- $d->close();
-
- // config sanity check
- if(empty($config)){$config = $WT_BLOCKS['print_htmlplus_block']['config'];}else{foreach($WT_BLOCKS['print_htmlplus_block']['config'] as $k=>$v){if (!isset($config[$k])){$config[$k] = $v;}}}
-
- // title
- $config['title'] = htmlentities($config['title'], ENT_COMPAT, 'UTF-8');
- print "<tr><td class=\"descriptionbox wrap width33\">"
- .i18n::translate('TITL')
- .help_link('index_htmlplus_title')
- ."</td><td class=\"optionbox\"><input type=\"text\" name=\"title\" size=\"30\" value=\"{$config['title']}\" /></td></tr>"
- ;
-
- // templates
- print "<tr><td class=\"descriptionbox wrap width33\">"
- .i18n::translate('Templates')
- .help_link('index_htmlplus_template')
- ."</td><td class=\"optionbox\">"
- ;
- if($useFCK)
- {
- print "\t\t\t<script language=\"JavaScript\" type=\"text/javascript\">\n"
- ."\t\t\t<!--\n"
- ."\t\t\t\tfunction loadTemplate(html)\n"
- ."\t\t\t\t{\n"
- ."\t\t\t\t\tvar oEditor = FCKeditorAPI.GetInstance('html');\n"
- ."\t\t\t\t\toEditor.SetHTML(html);\n"
- ."\t\t\t\t}\n"
- ."\t\t\t-->\n"
- ."\t\t\t</script>\n"
- ."\t\t\t<select name=\"template\" onchange=\"loadTemplate(document.block.template.options[document.block.template.selectedIndex].value);\">\n"
- ;
- }
- else
- {
- print "\t\t\t<select name=\"template\" onchange=\"document.block.html.value=document.block.template.options[document.block.template.selectedIndex].value;\">\n";
- }
- print "\t\t\t\t<option value=\"\">".i18n::translate('Custom')."</option>\n";
- foreach($templates as $tpl)
- {
- print "\t\t\t\t<option value=\"{$tpl['template']}\">{$tpl['title']}</option>\n";
- }
- print "\t\t\t</select>\n"
- ."\t\t</td>\n\t</tr>\n"
- ;
-
- // gedcom
- $gedcoms = get_all_gedcoms();
- if(count($gedcoms) > 1)
- {
- if($config['gedcom'] == '__current__'){$sel_current = ' selected="selected"';}else{$sel_current = '';}
- if($config['gedcom'] == '__default__'){$sel_default = ' selected="selected"';}else{$sel_default = '';}
- print "\t<tr>\n\t\t<td class=\"descriptionbox wrap width33\">"
- .i18n::translate('Family Tree')
- .help_link('index_htmlplus_gedcom')
- ."</td><td class=\"optionbox\">\n"
- ."\t\t\t<select name=\"gedcom\">\n"
- ."\t\t\t\t<option value=\"__current__\"{$sel_current}>".i18n::translate('Current')."</option>\n"
- ."\t\t\t\t<option value=\"__default__\"{$sel_default}>".i18n::translate('Default')."</option>\n"
- ;
- foreach($gedcoms as $ged_id=>$ged_name)
- {
- if($ged_name == $config['gedcom']){$sel = ' selected="selected"';}else{$sel = '';}
- print "\t\t\t\t<option value=\"{$ged_name}\"{$sel}>".PrintReady(get_gedcom_setting($ged_id, 'title'))."</option>\n";
- }
- print "\t\t\t</select>\n"
- ."\t\t</td>\n\t</tr>\n"
- ;
- }
-
- // html
- print "\t<tr>\n\t\t<td class=\"descriptionbox wrap width33\">\n"
- .i18n::translate('Content')
- .help_link('index_htmlplus_content')
- ."<br /><br /></td>"
- ."<td class=\"optionbox\">"
- ;
- if($useFCK)
- {
- // use FCKeditor module
- require_once WT_ROOT.'modules/FCKeditor/fckeditor.php';
- $oFCKeditor = new FCKeditor('html') ;
- $oFCKeditor->BasePath = './modules/FCKeditor/';
- $oFCKeditor->Value = $config['html'];
- $oFCKeditor->Width = 700;
- $oFCKeditor->Height = 250;
- $oFCKeditor->Config['AutoDetectLanguage'] = false ;
- $oFCKeditor->Config['DefaultLanguage'] = WT_LOCALE;
- $oFCKeditor->Create() ;
- }
- else
- {
- //use standard textarea
- print "<textarea name=\"html\" rows=\"10\" cols=\"80\">".str_replace("<", "&lt;", $config['html'])."</textarea>";
- }
-
- print "\n\t\t</td>\n\t</tr>\n";
-
- // compatibility mode
- if($config['compat'] == 1){$compat = ' checked="checked"';}else{$compat = '';}
- print "\t<tr>\n\t\t<td class=\"descriptionbox wrap width33\">"
- .i18n::translate('Compatibility Mode')
- .help_link('index_htmlplus_compat')
- ."</td>\n<td class=\"optionbox\"><input type=\"checkbox\" name=\"compat\" value=\"1\"{$compat} /></td>\n"
- ."\t</tr>\n"
- ;
-
- // extended features
- if ($config['ui'] == 1) {
- $ui = ' checked="checked"';
- } else {
- $ui = '';
- }
- print "\t<tr>\n\t\t<td class=\"descriptionbox wrap width33\">"
- .i18n::translate('Extended Interface')
- .help_link('index_htmlplus_ui')
- ."</td><td class=\"optionbox\"><input type=\"checkbox\" name=\"ui\" value=\"1\"{$ui} /></td>\n"
- ."\t</tr>\n"
- ;
-
- // Cache file life
- if($ctype == 'gedcom')
- {
- print "\t<tr>\n\t\t<td class=\"descriptionbox wrap width33\">"
- .i18n::translate('Cache file life')
- .help_link('cache_life')
- ."</td><td class=\"optionbox\">"
- ."<input type=\"text\" name=\"cache\" size=\"2\" value=\"{$config['cache']}\" /></td>\n"
- ."\t</tr>\n"
- ;
- }
-}
diff --git a/blocks/charts.php b/blocks/charts.php
deleted file mode 100644
index 0cc8225419..0000000000
--- a/blocks/charts.php
+++ /dev/null
@@ -1,237 +0,0 @@
-<?php
-/**
- * Charts Block
- *
- * This block prints pedigree, descendency, or hourglass charts for the chosen person
- *
- * webtrees: Web based Family History software
- * Copyright (C) 2010 webtrees development team.
- *
- * Derived from PhpGedView
- * Copyright (C) 2002 to 2009 PGV Development Team. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * @version $Id$
- * -- Slightly modified (rtl in table values) 2006/06/09 18:00:00 pfblair
- * @package webtrees
- * @subpackage Blocks
- */
-
-if (!defined('WT_WEBTREES')) {
- header('HTTP/1.0 403 Forbidden');
- exit;
-}
-
-define('WT_CHARTS_PHP', '');
-
-require_once WT_ROOT.'includes/controllers/hourglass_ctrl.php';
-require_once WT_ROOT.'includes/classes/class_treenav.php';
-
-$WT_BLOCKS['print_charts_block']=array(
- 'name'=>i18n::translate('Charts Block'),
- 'type'=>'both',
- 'descr'=>i18n::translate('The Charts block allows you to place a chart on the Home or My Page. You can configure the block to show an ancestors, descendants, or hourglass view. You can also choose the root person for the chart.'),
- 'canconfig'=>true,
- 'config'=>array(
- 'cache'=>1,
- 'pid'=>'',
- 'type'=>'pedigree',
- 'details'=>'no'
- )
-);
-
-function print_charts_block($block = true, $config="", $side, $index) {
- global $WT_BLOCKS, $ctype, $WT_IMAGE_DIR, $WT_IMAGES, $PEDIGREE_ROOT_ID, $PEDIGREE_FULL_DETAILS;
- global $show_full, $bwidth, $bheight;
-
- if (empty($config)) $config = $WT_BLOCKS["print_charts_block"]["config"];
- if (empty($config['details'])) $config['details'] = 'no';
- if (empty($config["pid"])) {
- if (!WT_USER_ID) {
- $config["pid"] = $PEDIGREE_ROOT_ID;
- } else {
- if (WT_USER_GEDCOM_ID) {
- $config["pid"] = WT_USER_GEDCOM_ID;
- } else {
- $config["pid"] = $PEDIGREE_ROOT_ID;
- }
- }
- }
-
- // Override GEDCOM configuration temporarily
- if (isset($show_full)) $saveShowFull = $show_full;
- $savePedigreeFullDetails = $PEDIGREE_FULL_DETAILS;
- if ($config["details"]=="no") {
- $show_full = 0;
- // Here we could adjust the block width & height to accommodate larger displays
- } else {
- $show_full = 1;
- // Here we could adjust the block width & height to accommodate larger displays
- }
- $PEDIGREE_FULL_DETAILS = $show_full;
-
- if ($config['type']!='treenav') {
- $controller = new HourglassController();
- $controller->init($config["pid"],0,3);
- $controller->setupJavascript();
- }
- else {
- $nav = new TreeNav($config['pid'],'blocknav',-1);
- $nav->generations = 2;
- }
-
- $person = Person::getInstance($config["pid"]);
- if ($person==null) {
- $config["pid"] = $PEDIGREE_ROOT_ID;
- $person = Person::getInstance($PEDIGREE_ROOT_ID);
- }
-
- $id = "charts_block";
- $title='';
- if ($WT_BLOCKS["print_charts_block"]["canconfig"]) {
- if ($ctype=="gedcom" && WT_USER_GEDCOM_ADMIN || $ctype=="user" && WT_USER_ID) {
- if ($ctype=="gedcom") {
- $name = WT_GEDCOM;
- } else {
- $name = WT_USER_NAME;
- }
- $title .= "<a href=\"javascript: configure block\" onclick=\"window.open('".encode_url("index_edit.php?name={$name}&ctype={$ctype}&action=configure&side={$side}&index={$index}")."', '_blank', 'top=50,left=50,width=700,height=400,scrollbars=1,resizable=1'); return false;\">";
- $title .= "<img class=\"adminicon\" src=\"$WT_IMAGE_DIR/".$WT_IMAGES["admin"]["small"]."\" width=\"15\" height=\"15\" border=\"0\" alt=\"".i18n::translate('Configure')."\" /></a>";
- }
- }
- if ($person) {
- $name=PrintReady($person->getFullName());
- switch($config['type']) {
- case 'pedigree':
- $title .= $name." ".i18n::translate('Pedigree Tree');
- break;
- case 'descendants':
- $title .= $name." ".i18n::translate('Descendancy Chart');
- break;
- case 'hourglass':
- $title .= $name." ".i18n::translate('Hourglass Chart');
- break;
- case 'treenav':
- $title .= $name." ".i18n::translate('Tree');
- break;
- }
- $title .= help_link('index_charts');
- $content = "";
- $content .= "<script src=\"js/webtrees.js\" language=\"JavaScript\" type=\"text/javascript\"></script>";
- if ($show_full==0) {
- $content .= '<center><span class="details2">'.i18n::translate('Click on any of the boxes to get more information about that person.').'</span></center><br />';
- }
- $content .= '<table cellspacing="0" cellpadding="0" border="0"><tr>';
- if ($config['type']=='descendants' || $config['type']=='hourglass') {
- $content .= "<td valign=\"middle\">";
- ob_start();
- $controller->print_descendency($person->getXref(), 1, false);
- $content .= ob_get_clean();
- $content .= "</td>";
- }
- if ($config['type']=='pedigree' || $config['type']=='hourglass') {
- //-- print out the root person
- if ($config['type']!='hourglass') {
- $content .= "<td valign=\"middle\">";
- ob_start();
- print_pedigree_person($person->getXref());
- $content .= ob_get_clean();
- $content .= "</td>";
- }
- $content .= "<td valign=\"middle\">";
- ob_start();
- $controller->print_person_pedigree($person->getXref(), 1);
- $content .= ob_get_clean();
- $content .= "</td>";
- }
- if ($config['type']=='treenav') {
- $content .= "<td>";
- ob_start();
- $nav->drawViewport('blocknav', "", "240px");
- $content .= ob_get_clean();
- $content .= "</td>";
- }
- $content .= "</tr></table>";
- $content .= '<script language="JavaScript" type="text/javascript">
- <!--
- if (sizeLines) sizeLines();
- -->
- </script>';
- } else {
- $content=i18n::translate('No such ID exists in this GEDCOM file.');
- }
-
- global $THEME_DIR;
- require $THEME_DIR.'templates/block_small_temp.php';
- // Restore GEDCOM configuration
- unset($show_full);
- if (isset($saveShowFull)) $show_full = $saveShowFull;
- $PEDIGREE_FULL_DETAILS = $savePedigreeFullDetails;
-}
-
-function print_charts_block_config($config) {
- global $ctype, $WT_BLOCKS, $TEXT_DIRECTION, $PEDIGREE_ROOT_ID, $ENABLE_AUTOCOMPLETE;
- if (empty($config)) $config = $WT_BLOCKS["print_charts_block"]["config"];
- if (empty($config["rootId"])) $config["rootId"] = $PEDIGREE_ROOT_ID;
- if (empty($config['details'])) $config['details'] = 'no';
-
- if ($ENABLE_AUTOCOMPLETE) require WT_ROOT.'js/autocomplete.js.htm';
-?>
- <tr><td class="descriptionbox wrap width33"><?php print i18n::translate('Chart Type'); ?></td>
- <td class="optionbox">
- <select name="type">
- <option value="pedigree"<?php if ($config["type"]=="pedigree") print " selected=\"selected\""; ?>><?php print i18n::translate('Pedigree Tree'); ?></option>
- <option value="descendants"<?php if ($config["type"]=="descendants") print " selected=\"selected\""; ?>><?php print i18n::translate('Descendancy Chart'); ?></option>
- <option value="hourglass"<?php if ($config["type"]=="hourglass") print " selected=\"selected\""; ?>><?php print i18n::translate('Hourglass Chart'); ?></option>
- <?php if (file_exists(WT_ROOT.'includes/classes/class_treenav.php')) { ?>
- <option value="treenav"<?php if ($config["type"]=="treenav") print " selected=\"selected\""; ?>><?php print i18n::translate('Interactive Tree'); ?></option>
- <?php } ?>
- </select>
- </td></tr>
- <tr>
- <td class="descriptionbox wrap width33"><?php print i18n::translate('Show Details'); ?></td>
- <td class="optionbox">
- <select name="details">
- <option value="no" <?php if ($config["details"]=="no") print " selected=\"selected\""; ?>><?php print i18n::translate('No'); ?></option>
- <option value="yes" <?php if ($config["details"]=="yes") print " selected=\"selected\""; ?>><?php print i18n::translate('Yes'); ?></option>
- </select>
- </td>
- </tr>
- <tr>
- <td class="descriptionbox wrap width33"><?php print i18n::translate('Root Person ID'); ?></td>
- <td class="optionbox">
- <input type="text" name="pid" id="pid" value="<?php print $config['pid']; ?>" size="5" />
- <?php
- print_findindi_link('pid','');
- $root=Person::getInstance($config['pid']);
- if ($root) {
- echo ' <span class="list_item">', $root->getFullName(), $root->format_first_major_fact(WT_EVENTS_BIRT, 1), '</span>';
- }
- ?>
- </td>
- </tr>
- <?php
-
- // Cache file life
- if ($ctype=="gedcom") {
- echo "<tr><td class=\"descriptionbox wrap width33\">";
- echo i18n::translate('Cache file life'), help_link('cache_life');
- echo "</td><td class=\"optionbox\">";
- echo "<input type=\"text\" name=\"cache\" size=\"2\" value=\"".$config["cache"]."\" />";
- echo "</td></tr>";
- }
-}
-?>
diff --git a/blocks/gedcom_block.php b/blocks/gedcom_block.php
deleted file mode 100644
index 268a37f5fa..0000000000
--- a/blocks/gedcom_block.php
+++ /dev/null
@@ -1,68 +0,0 @@
-<?php
-/**
- * Gedcom Welcome Block
- *
- * This block prints basic information about the active gedcom
- *
- * webtrees: Web based Family History software
- * Copyright (C) 2010 webtrees development team.
- *
- * Derived from PhpGedView
- * Copyright (C) 2002 to 2009 PGV Development Team. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * @package webtrees
- * @subpackage Blocks
- * @version $Id$
- */
-
-if (!defined('WT_WEBTREES')) {
- header('HTTP/1.0 403 Forbidden');
- exit;
-}
-
-define('WT_GEDCOM_BLOCK_PHP', '');
-
-$WT_BLOCKS['print_gedcom_block']=array(
- 'name'=>i18n::translate('GEDCOM Welcome'),
- 'type'=>'gedcom',
- 'descr'=>i18n::translate('The GEDCOM Welcome block works the same as the User Welcome block. It welcomes the visitor to the site and displays the title of the currently active database as well as the current date and time.'),
- 'canconfig'=>false,
- 'config'=>array(
- 'cache'=>0
- )
-);
-
-//-- function to print the gedcom block
-function print_gedcom_block($block = true, $config="", $side, $index) {
- global $hitCount, $SHOW_COUNTER;
-
- $id = "gedcom_welcome";
- $title = PrintReady(get_gedcom_setting(WT_GED_ID, 'title'));
- $content = "<div class=\"center\">";
- $content .= "<br />".format_timestamp(client_time())."<br />\n";
- if ($SHOW_COUNTER)
- $content .= i18n::translate('Hit Count:')." ".$hitCount."<br />\n";
- $content .= "\n<br />";
- if (WT_USER_GEDCOM_ADMIN) {
- $content .= "<a href=\"javascript:;\" onclick=\"window.open('".encode_url("index_edit.php?name=".WT_GEDCOM."&ctype=gedcom")."', '_blank', 'top=50,left=10,width=600,height=500,scrollbars=1,resizable=1'); return false;\">".i18n::translate('Customize this GEDCOM Home Page')."</a><br />\n";
- }
- $content .= "</div>";
-
- global $THEME_DIR;
- require $THEME_DIR.'templates/block_main_temp.php';
-}
-?>
diff --git a/blocks/gedcom_favorites.php b/blocks/gedcom_favorites.php
deleted file mode 100644
index 3bb67a9fe0..0000000000
--- a/blocks/gedcom_favorites.php
+++ /dev/null
@@ -1,206 +0,0 @@
-<?php
-/**
- * Gedcom Favorites Block
- *
- * This block prints the active gedcom favorites
- *
- * webtrees: Web based Family History software
- * Copyright (C) 2010 webtrees development team.
- *
- * Derived from PhpGedView
- * Copyright (C) 2002 to 2009 PGV Development Team. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * $Id$
- * @package webtrees
- * @subpackage Blocks
- */
-
-if (!defined('WT_WEBTREES')) {
- header('HTTP/1.0 403 Forbidden');
- exit;
-}
-
-define('WT_GEDCOM_FAVORITES_PHP', '');
-
-$WT_BLOCKS['print_gedcom_favorites']=array(
- 'name'=>i18n::translate('GEDCOM Favorites'),
- 'type'=>'both',
- 'descr'=>i18n::translate('The GEDCOM Favorites block gives the administrator the ability to designate individuals from the database so that their information is easily accessible to all. This is a way to highlight people who are important in your family history.'),
- 'canconfig'=>false,
- 'config'=>array(
- 'cache'=>7
- )
-);
-
-//-- print gedcom favorites
-function print_gedcom_favorites($block = true, $config="", $side, $index) {
- global $WT_IMAGE_DIR, $WT_IMAGES, $ctype, $TEXT_DIRECTION;
- global $show_full, $PEDIGREE_FULL_DETAILS, $BROWSERTYPE, $ENABLE_AUTOCOMPLETE;
-
- // Override GEDCOM configuration temporarily
- if (isset($show_full)) $saveShowFull = $show_full;
- $savePedigreeFullDetails = $PEDIGREE_FULL_DETAILS;
- $show_full = 1;
- $PEDIGREE_FULL_DETAILS = 1;
-
- $userfavs = getUserFavorites(WT_GEDCOM);
- if (!is_array($userfavs)) $userfavs = array();
-
- $id = "gedcom_favorites";
- $title = i18n::translate('This GEDCOM\'s Favorites').help_link('index_favorites');
- if ($TEXT_DIRECTION=="rtl") $title .= getRLM();
- $title .= "(".count($userfavs).")";
- if ($TEXT_DIRECTION=="rtl") $title .= getRLM();
-
- if (WT_USER_IS_ADMIN && $ENABLE_AUTOCOMPLETE) {
- $content = '<script type="text/javascript" src="js/jquery/jquery.min.js"></script>
- <script type="text/javascript" src="js/jquery/jquery.autocomplete.js"></script>
- <script type="text/javascript" src="js/jquery/jquery.ajaxQueue.js"></script>
- <script type="text/javascript">
- jQuery.noConflict(); // @see http://docs.jquery.com/Using_jQuery_with_Other_Libraries/
- jQuery(document).ready(function($){
- $("input[name^=gid]").autocomplete("autocomplete.php", {
- extraParams: {field:"IFSRO"},
- formatItem: function(row, i) {
- return row[0] + " (" + row[1] + ")";
- },
- formatResult: function(row) {
- return row[1];
- },
- width: 400,
- minChars: 2
- });
- });
- </script>';
- } else $content = '';
-
- if ($block) {
- $style = 2; // 1 means "regular box", 2 means "wide box"
- $tableWidth = ($BROWSERTYPE=="msie") ? "95%" : "99%"; // IE needs to have room for vertical scroll bar inside the box
- $cellSpacing = "1px";
- } else {
- $style = 2;
- $tableWidth = "99%";
- $cellSpacing = "3px";
- }
- if (count($userfavs)==0) {
- if (WT_USER_GEDCOM_ADMIN) {
- $content .= i18n::translate('You have not selected any favorites.<br /><br />To add an individual, a family, or a source to your favorites, click on the <b>Add a new favorite</b> link to reveal some fields where you can enter or search for an ID number. Instead of an ID number, you can enter a URL and a title.');
- } else {
- $content .= i18n::translate('At this moment there are no selected Favorites. The admin can add Favorites to display at startup.');
- }
- } else {
- $content .= "<table width=\"{$tableWidth}\" style=\"border:none\" cellspacing=\"{$cellSpacing}\" class=\"center $TEXT_DIRECTION\">";
- foreach($userfavs as $key=>$favorite) {
- if (isset($favorite["id"])) $key=$favorite["id"];
- $removeFavourite = "<a class=\"font9\" href=\"".encode_url("index.php?ctype=$ctype&action=deletefav&fv_id={$key}")."\" onclick=\"return confirm('".i18n::translate('Are you sure you want to remove this item from your list of Favorites?')."');\">".i18n::translate('Remove')."</a><br />\n";
- $content .= "<tr><td>";
- if ($favorite["type"]=="URL") {
- $content .= "<div id=\"boxurl".$key.".0\" class=\"person_box\">\n";
- if ($ctype=="user" || WT_USER_GEDCOM_ADMIN) $content .= $removeFavourite;
- $content .= "<a href=\"".$favorite["url"]."\"><b>".PrintReady($favorite["title"])."</b></a>";
- $content .= "<br />".PrintReady($favorite["note"]);
- $content .= "</div>\n";
- } else {
- if (displayDetailsById($favorite["gid"], $favorite["type"])) {
- if ($favorite["type"]=="INDI") {
- $indirec = find_person_record($favorite["gid"], WT_GED_ID);
- $content .= "<div id=\"box".$favorite["gid"].".0\" class=\"person_box";
- if (strpos($indirec, "\n1 SEX F")!==false) $content .= "F";
- elseif (strpos($indirec, "\n1 SEX M")!==false) $content .= "";
- else $content .= "NN";
- $content .= "\">\n";
- if ($ctype=="user" || WT_USER_GEDCOM_ADMIN) $content .= $removeFavourite;
- ob_start();
- print_pedigree_person($favorite["gid"], $style, 1, $key);
- $content .= ob_get_clean();
- $content .= PrintReady($favorite["note"]);
- $content .= "</div>\n";
- } else {
- $record=GedcomRecord::getInstance($favorite['gid']);
- $content .= "<div id=\"box".$favorite["gid"].".0\" class=\"person_box\">";
- if ($ctype=="user" || WT_USER_GEDCOM_ADMIN) $content .= $removeFavourite;
- if ($record) {
- $content.=$record->format_list('span');
- } else {
- $content.=i18n::translate('No such ID exists in this GEDCOM file.');
- }
- $content .= "<br />".PrintReady($favorite["note"]);
- $content .= "</div>";
- }
- }
- }
- $content .= "</td></tr>\n";
- }
- $content .= "</table>\n";
- }
- if (WT_USER_GEDCOM_ADMIN) {
- $content .= '
- <script language="JavaScript" type="text/javascript">
- <!--
- var pastefield;
- function paste_id(value) {
- pastefield.value=value;
- }
- -->
- </script>
- <br />
- ';
- $uniqueID = floor(microtime() * 1000000);
- $content .= "<b><a href=\"javascript://".i18n::translate('Add a new favorite')." \" onclick=\"expand_layer('add_ged_fav'); return false;\"><img id=\"add_ged_fav_img\" src=\"".$WT_IMAGE_DIR."/".$WT_IMAGES["plus"]["other"]."\" border=\"0\" alt=\"\" />&nbsp;".i18n::translate('Add a new favorite')."</a></b>";
- $content .= help_link('index_add_favorites');
- $content .= "<br /><div id=\"add_ged_fav\" style=\"display: none;\">\n";
- $content .= "<form name=\"addgfavform\" method=\"post\" action=\"index.php\">\n";
- $content .= "<input type=\"hidden\" name=\"action\" value=\"addfav\" />\n";
- $content .= "<input type=\"hidden\" name=\"ctype\" value=\"$ctype\" />\n";
- $content .= "<input type=\"hidden\" name=\"favtype\" value=\"gedcom\" />\n";
- $content .= "<input type=\"hidden\" name=\"ged\" value=\"".WT_GEDCOM."\" />\n";
- $content .= "<table width=\"{$tableWidth}\" style=\"border:none\" cellspacing=\"{$cellSpacing}\" class=\"center {$TEXT_DIRECTION}\">";
- $content .= "<tr><td>".i18n::translate('Enter a Person, Family, or Source ID')." <br />";
- $content .= "<input class=\"pedigree_form\" type=\"text\" name=\"gid\" id=\"gid{$uniqueID}\" size=\"5\" value=\"\" />";
-
- $content .= print_findindi_link("gid{$uniqueID}",'',true)."\n";
- $content .= print_findfamily_link("gid{$uniqueID}",'',true)."\n";
- $content .= print_findsource_link("gid{$uniqueID}",'',true)."\n";
- $content .= print_findrepository_link("gid{$uniqueID}",'',true)."\n";
- $content .= print_findnote_link("gid{$uniqueID}",'',true)."\n";
- $content .= print_findmedia_link("gid{$uniqueID}",'1','',true)."\n";
-
- $content .= "\n<br />".i18n::translate('OR<br />Enter a URL and a title');
- $content .= "\n<table><tr><td>".i18n::translate('URL')."</td><td><input type=\"text\" name=\"url\" size=\"40\" value=\"\" /></td></tr>";
- $content .= "\n<tr><td>".i18n::translate('Title:')."</td><td><input type=\"text\" name=\"favtitle\" size=\"40\" value=\"\" /></td></tr></table>";
- if ($block) $content .= "\n</td></tr><tr><td><br />";
- else $content .= "\n</td><td>";
- $content .= "\n".i18n::translate('Enter an optional note about this favorite');
- $content .= "\n<br /><textarea name=\"favnote\" rows=\"6\" cols=\"50\"></textarea>";
- $content .= "</td></tr></table>\n";
- $content .= "\n<br /><input type=\"submit\" value=\"".i18n::translate('Add')."\" style=\"font-size: 8pt; \" />";
- $content .= "\n</form></div>\n";
- }
-
- global $THEME_DIR;
- if ($block) {
- require $THEME_DIR.'templates/block_small_temp.php';
- } else {
- require $THEME_DIR.'templates/block_main_temp.php';
- }
- // Restore GEDCOM configuration
- unset($show_full);
- if (isset($saveShowFull)) $show_full = $saveShowFull;
- $PEDIGREE_FULL_DETAILS = $savePedigreeFullDetails;
-}
-?>
diff --git a/blocks/gedcom_news.php b/blocks/gedcom_news.php
deleted file mode 100644
index 6b04748910..0000000000
--- a/blocks/gedcom_news.php
+++ /dev/null
@@ -1,189 +0,0 @@
-<?php
-/**
- * Gedcom News Block
- *
- * This block allows administrators to enter news items for the active gedcom
- *
- * webtrees: Web based Family History software
- * Copyright (C) 2010 webtrees development team.
- *
- * Derived from PhpGedView
- * Copyright (C) 2002 to 2009 PGV Development Team. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * @package webtrees
- * @subpackage Blocks
- * @version $Id$
- */
-
-if (!defined('WT_WEBTREES')) {
- header('HTTP/1.0 403 Forbidden');
- exit;
-}
-
-define('WT_GEDCOM_NEWS_PHP', '');
-
-$WT_BLOCKS['print_gedcom_news']=array(
- 'name'=>i18n::translate('GEDCOM News'),
- 'type'=>'gedcom',
- 'descr'=>i18n::translate('The GEDCOM News block shows the visitor news releases or articles posted by an admin user.<br /><br />The News block is a good place to announce a significant database update, a family reunion, or the birth of a child.'),
- 'canconfig'=>true,
- 'config'=>array(
- 'cache'=>7,
- 'limit'=>'nolimit',
- 'flag'=>0
- )
-);
-
-/**
- * Prints a gedcom news/journal
- *
- * @todo Add an allowed HTML translation
- */
-function print_gedcom_news($block = true, $config='', $side, $index)
-{
- global $WT_IMAGE_DIR, $WT_IMAGES, $TEXT_DIRECTION, $ctype, $WT_BLOCKS;
-
- if(empty($config)) {
- $config = $WT_BLOCKS['print_gedcom_news']['config'];
- }
- if ($config['flag'] == 0) {
- $config['limit'] = 'nolimit';
- }
- if (isset($_REQUEST['gedcom_news_archive'])) {
- $config['limit'] = 'nolimit';
- $config['flag'] = 0;
- }
-
- $usernews = getUserNews(WT_GEDCOM);
-
- $id = "gedcom_news";
- $title = "";
- if ($WT_BLOCKS['print_gedcom_news']['canconfig']) {
- if ($ctype=="gedcom" && WT_USER_GEDCOM_ADMIN || $ctype=="user" && WT_USER_ID) {
- if ($ctype=="gedcom") {
- $name = WT_GEDCOM;
- } else {
- $name = WT_USER_NAME;
- }
- $title .= "<a href=\"javascript: configure block\" onclick=\"window.open('index_edit.php?name={$name}&amp;ctype={$ctype}&amp;action=configure&amp;side={$side}&amp;index={$index}', '_blank', 'top=50,left=50,width=600,height=350,scrollbars=1,resizable=1'); return false;\">"
- ."<img class=\"adminicon\" src=\"{$WT_IMAGE_DIR}/{$WT_IMAGES['admin']['small']}\" width=\"15\" height=\"15\" border=\"0\" alt=\"".i18n::translate('Configure')."\" /></a>\n"
- ;
- }
- }
- $title .= i18n::translate('News');
- if(WT_USER_GEDCOM_ADMIN) {
- $title .= help_link('index_gedcom_news_adm');
- } else {
- $title .= help_link('index_gedcom_news');
- }
- $content = "";
- if(count($usernews) == 0)
- {
- $content .= i18n::translate('No News articles have been submitted.').'<br />';
- }
- $c = 0;
- $td = time();
- foreach($usernews as $news)
- {
- if ($config['limit'] == 'count') {
- if ($c >= $config['flag']) {
- break;
- }
- $c++;
- }
- if ($config['limit'] == 'date') {
- if (floor(($td - $news['date']) / 86400) > $config['flag']) {
- break;
- }
- }
- // print "<div class=\"person_box\" id=\"{$news['anchor']}\">\n";
- $content .= "<div class=\"news_box\" id=\"{$news['anchor']}\">\n";
-
- // Look for $GLOBALS substitutions in the News title
- $newsTitle = embed_globals($news['title']);
- $content .= "<span class=\"news_title\">".PrintReady($newsTitle)."</span><br />\n";
- $content .= "<span class=\"news_date\">".format_timestamp($news['date'])."</span><br /><br />\n";
-
- // Look for $GLOBALS substitutions in the News text
- $newsText = embed_globals($news['text']);
- $trans = get_html_translation_table(HTML_SPECIALCHARS);
- $trans = array_flip($trans);
- $newsText = strtr($newsText, $trans);
- $newsText = nl2br($newsText);
- $content .= PrintReady($newsText)."<br />\n";
-
- // Print Admin options for this News item
- if(WT_USER_GEDCOM_ADMIN) {
- $content .= "<hr size=\"1\" />"
- ."<a href=\"javascript:;\" onclick=\"editnews('".$news['id']."'); return false;\">".i18n::translate('Edit')."</a> | "
- ."<a href=\"".encode_url("index.php?action=deletenews&news_id=".$news['id']."&ctype={$ctype}")."\" onclick=\"return confirm('".i18n::translate('Are you sure you want to delete this News entry?')."');\">".i18n::translate('Delete')."</a><br />";
- }
- $content .= "</div>\n";
- }
- $printedAddLink = false;
- if (WT_USER_GEDCOM_ADMIN) {
- $content .= "<a href=\"javascript:;\" onclick=\"addnews('".urlencode(WT_GEDCOM)."'); return false;\">".i18n::translate('Add a News article')."</a>";
- $printedAddLink = true;
- }
- if ($config['limit'] == 'date' || $config['limit'] == 'count') {
- if ($printedAddLink) $content .= "&nbsp;&nbsp;|&nbsp;&nbsp;";
- $content .= "<a href=\"".encode_url("index.php?gedcom_news_archive=yes&ctype={$ctype}")."\">".i18n::translate('View archive')."</a>";
- $content .= help_link('gedcom_news_archive').'<br />';
- }
-
- global $THEME_DIR;
- if ($block) {
- require $THEME_DIR.'templates/block_small_temp.php';
- } else {
- require $THEME_DIR.'templates/block_main_temp.php';
- }
-}
-
-function print_gedcom_news_config($config)
-{
- global $ctype, $WT_BLOCKS;
- if (empty ($config)) $config = $WT_BLOCKS["print_gedcom_news"]["config"];
- if (!isset ($config["limit"])) $config["limit"] = "nolimit";
- if (!isset ($config["flag"])) $config["flag"] = 0;
- if (!isset($config["cache"])) $config["cache"] = $WT_BLOCKS["print_gedcom_news"]["config"]["cache"];
-
- // Limit Type
- echo
- '<tr><td class="descriptionbox wrap width33">',
- i18n::translate('Limit display by:'), help_link('gedcom_news_limit'),
- '</td><td class="optionbox"><select name="limit"><option value="nolimit"',
- ($config['limit'] == 'nolimit'?' selected="selected"':'').">",
- i18n::translate('No limit')."</option>",
- '<option value="date"'.($config['limit'] == 'date'?' selected="selected"':'').">".i18n::translate('Age of item')."</option>",
- '<option value="count"'.($config['limit'] == 'count'?' selected="selected"':'').">".i18n::translate('Number of items')."</option>",
- '</select></td></tr>';
-
- // Flag to look for
- echo '<tr><td class="descriptionbox wrap width33">';
- echo i18n::translate('Limit:'), help_link('gedcom_news_flag');
- echo '</td><td class="optionbox"><input type="text" name="flag" size="4" maxlength="4" value="'.$config['flag'].'" /></td></tr>';
-
- // Cache file life
- if ($ctype=="gedcom") {
- echo '<tr><td class="descriptionbox wrap width33">';
- echo i18n::translate('Cache file life'), help_link('cache_life');
- echo '</td><td class="optionbox">';
- echo '<input type="text" name="cache" size="2" value="', $config['cache'], '" />';
- echo "</td></tr>";
- }
-}
-?>
diff --git a/blocks/gedcom_stats.php b/blocks/gedcom_stats.php
deleted file mode 100644
index fc94f6b3eb..0000000000
--- a/blocks/gedcom_stats.php
+++ /dev/null
@@ -1,362 +0,0 @@
-<?php
-/**
- * Gedcom Statistics Block
- *
- * This block prints statistical information for the currently active gedcom
- *
- * webtrees: Web based Family History software
- * Copyright (C) 2010 webtrees development team.
- *
- * Derived from PhpGedView
- * Copyright (C) 2002 to 2009 PGV Development Team. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * @version $Id$
- * -- Slightly modified (rtl in table values) 2006/06/09 18:00:00 pfblair
- * @package webtrees
- * @subpackage Blocks
- */
-
-if (!defined('WT_WEBTREES')) {
- header('HTTP/1.0 403 Forbidden');
- exit;
-}
-
-define('WT_GEDCOM_STATS_PHP', '');
-
-require_once WT_ROOT.'includes/functions/functions_print_lists.php';
-require_once WT_ROOT.'includes/classes/class_stats.php';
-
-$WT_BLOCKS['print_gedcom_stats']=array(
- 'name'=>i18n::translate('GEDCOM Statistics'),
- 'type'=>'both',
- 'descr'=>i18n::translate('The GEDCOM Statistics block shows the visitor some basic information about the database, such as when it was created and how many people are in it.<br /><br />It also has a list of the most frequent surnames. You can configure this block to not show the Frequent Surnames list, and you can also configure the GEDCOM to remove or add names to this list. You can set the occurrence threshold for this list in the GEDCOM configuration.'),
- 'canconfig'=>true,
- 'config'=>array(
- 'cache' =>1,
- 'show_common_surnames'=>'yes',
- 'stat_indi' =>'yes',
- 'stat_fam' =>'yes',
- 'stat_sour' =>'yes',
- 'stat_other' =>'yes',
- 'stat_media' =>'yes',
- 'stat_surname' =>'yes',
- 'stat_events' =>'yes',
- 'stat_users' =>'yes',
- 'stat_first_birth' =>'yes',
- 'stat_last_birth' =>'yes',
- 'stat_first_death' =>'yes',
- 'stat_last_death' =>'yes',
- 'stat_long_life' =>'yes',
- 'stat_avg_life' =>'yes',
- 'stat_most_chil' =>'yes',
- 'stat_avg_chil' =>'yes',
- 'stat_link' =>'yes'
- )
-);
-
-//-- function to print the gedcom statistics block
-
-function print_gedcom_stats($block=true, $config='', $side, $index) {
- global $WT_BLOCKS, $ALLOW_CHANGE_GEDCOM, $ctype, $COMMON_NAMES_THRESHOLD, $WT_IMAGE_DIR, $WT_IMAGES, $MULTI_MEDIA;
- global $top10_block_present;
-
- if (empty($config)) $config = $WT_BLOCKS['print_gedcom_stats']['config'];
- if (!isset($config['stat_indi'])) $config = $WT_BLOCKS['print_gedcom_stats']['config'];
- if (!isset($config['stat_first_death'])) $config['stat_first_death'] = $WT_BLOCKS['print_gedcom_stats']['config']['stat_first_death'];
- if (!isset($config['stat_last_death'])) $config['stat_last_death'] = $WT_BLOCKS['print_gedcom_stats']['config']['stat_last_death'];
- if (!isset($config['stat_media'])) $config['stat_media'] = $WT_BLOCKS['print_gedcom_stats']['config']['stat_media'];
- if (!isset($config['stat_link'])) $config['stat_link'] = $WT_BLOCKS['print_gedcom_stats']['config']['stat_link'];
-
- $id = 'gedcom_stats';
- $title='';
- if ($WT_BLOCKS['print_gedcom_stats']['canconfig']) {
- if ($ctype=='gedcom' && WT_USER_GEDCOM_ADMIN || $ctype=='user' && WT_USER_ID) {
- if ($ctype=='gedcom') {
- $name = WT_GEDCOM;
- } else {
- $name = WT_USER_NAME;
- }
- $title .= "<a href=\"javascript: configure block\" onclick=\"window.open('".encode_url("index_edit.php?name={$name}&ctype={$ctype}&action=configure&side={$side}&index={$index}")."', '_blank', 'top=50,left=50,width=700,height=400,scrollbars=1,resizable=1'); return false;\">";
- $title .= "<img class=\"adminicon\" src=\"$WT_IMAGE_DIR/".$WT_IMAGES['admin']['small']."\" width=\"15\" height=\"15\" border=\"0\" alt=\"".i18n::translate('Configure')."\" /></a>";
- }
- }
- $title.=i18n::translate('GEDCOM Statistics').help_link('index_stats');
-
- $stats=new stats(WT_GEDCOM);
-
- $content = "<b><a href=\"index.php?ctype=gedcom\">".PrintReady(strip_tags(get_gedcom_setting(WT_GED_ID, 'title')))."</a></b><br />";
- $head = find_other_record('HEAD', WT_GED_ID);
- $ct=preg_match('/1 SOUR (.*)/', $head, $match);
- if ($ct>0) {
- $softrec = get_sub_record(1, '1 SOUR', $head);
- $tt= preg_match('/2 NAME (.*)/', $softrec, $tmatch);
- if ($tt>0) $software = printReady(trim($tmatch[1]));
- else $software = trim($match[1]);
- if (!empty($software)) {
- $tt = preg_match('/2 VERS (.*)/', $softrec, $tmatch);
- if ($tt>0) $version = printReady(trim($tmatch[1]));
- else $version='';
- $content .= i18n::translate('This GEDCOM was created using <b>%s %s</b>', $software, $version);
- }
- }
- if (preg_match('/1 DATE (.+)/', $head, $match)) {
- if (empty($software)) {
- $content.=i18n::translate('This GEDCOM was created on <b>%s</b>', $stats->gedcomDate());
- } else {
- $content.=i18n::translate(' on <b>%s</b>', $stats->gedcomDate());
- }
- }
-
- $content .= '<br /><table><tr><td valign="top" class="width20"><table cellspacing="1" cellpadding="0">';
- if ($config['stat_indi']=='yes') {
- $content.='<tr><td class="facts_label">'.i18n::translate('Individuals').'</td><td class="facts_value"><div dir="rtl"><a href="'.encode_url("indilist.php?surname_sublist=no&ged=".WT_GEDCOM).'">'.$stats->totalIndividuals().'</a></div></td></tr>';
- $content.='<tr><td class="facts_label">'.i18n::translate('Males').'</td><td class="facts_value"><div dir="rtl">'.$stats->totalSexMales().'<br />'.$stats->totalSexMalesPercentage().'%</div></td></tr>';
- $content.='<tr><td class="facts_label">'.i18n::translate('Females').'</td><td class="facts_value"><div dir="rtl">'.$stats->totalSexFemales().'<br />'.$stats->totalSexFemalesPercentage().'%</div></td></tr>';
- }
- if ($config['stat_surname']=='yes') {
- $content .= '<tr><td class="facts_label">'.i18n::translate('Total surnames').'</td><td class="facts_value"><div dir="rtl"><a href="'.encode_url("indilist.php?show_all=yes&surname_sublist=yes&ged=".WT_GEDCOM).'">'.$stats->totalSurnames().'</a></div></td></tr>';
- }
- if ($config['stat_fam']=='yes') {
- $content .= '<tr><td class="facts_label">'. i18n::translate('Families').'</td><td class="facts_value"><div dir="rtl"><a href="famlist.php">'.$stats->totalFamilies().'</a></div></td></tr>';
- }
- if ($config['stat_sour']=='yes') {
- $content .= '<tr><td class="facts_label">'. i18n::translate('Sources').'</td><td class="facts_value"><div dir="rtl"><a href="sourcelist.php">'.$stats->totalSources().'</a></div></td></tr>';
- }
- if ($config['stat_media']=='yes' && $MULTI_MEDIA==true) {
- $content .= '<tr><td class="facts_label">'. i18n::translate('Media objects').'</td><td class="facts_value"><div dir="rtl"><a href="medialist.php">'.$stats->totalMedia().'</a></div></td></tr>';
- }
- if ($config['stat_other']=='yes') {
- $content .= '<tr><td class="facts_label">'. i18n::translate('Other records').'</td><td class="facts_value"><div dir="rtl">'.$stats->totalOtherRecords().'</div></td></tr>';
- }
- if ($config['stat_events']=='yes') {
- $content .= '<tr><td class="facts_label">'. i18n::translate('Total events').'</td><td class="facts_value"><div dir="rtl">'.$stats->totalEvents().'</div></td></tr>';
- }
- if ($config['stat_users']=='yes') {
- $content .= '<tr><td class="facts_label">'. i18n::translate('Total users').'</td><td class="facts_value"><div dir="rtl">';
- if (WT_USER_GEDCOM_ADMIN){
- $content .= '<a href="useradmin.php">'.$stats->totalUsers().'</a>';
- } else {
- $content .= $stats->totalUsers();
- }
- $content .= '</div>
-</td>
-</tr>';
- }
- if (!$block) {
- $content .= '</table></td><td><br /></td><td valign="top"><table cellspacing="1" cellpadding="1" border="0">';
- }
- if ($config['stat_first_birth']=='yes') {
- $content .= '<tr><td class="facts_label">'. i18n::translate('Earliest birth year').'</td><td class="facts_value"><div dir="rtl">'.$stats->firstBirthYear().'</div></td>';
- if (!$block) {
- $content .= '<td class="facts_value">'.$stats->firstBirth().'</td>';
- }
- $content .= '</tr>';
- }
- if ($config['stat_last_birth']=='yes') {
- $content .= '<tr><td class="facts_label">'. i18n::translate('Latest birth year').'</td><td class="facts_value"><div dir="rtl">'.$stats->lastBirthYear().'</div></td>';
- if (!$block){
- $content .= '<td class="facts_value">'.$stats->lastBirth().'</td>';
- }
- $content .= '</tr>';
- }
- if ($config['stat_first_death']=='yes') {
- $content .= '<tr><td class="facts_label">'. i18n::translate('Earliest death year').'</td><td class="facts_value"><div dir="rtl">'.$stats->firstDeathYear().'</div></td>';
- if (!$block){
- $content .= '<td class="facts_value">'.$stats->firstDeath().'</td>';
- }
- $content .= '</tr>';
- }
- if ($config['stat_last_death']=='yes') {
- $content .= '<tr><td class="facts_label">'. i18n::translate('Latest death year') .'</td><td class="facts_value"><div dir="rtl">'.$stats->lastDeathYear().'</div>
-</td>';
- if (!$block){
- $content .= '<td class="facts_value">'.$stats->lastDeath().'</td>';
- }
- $content .='</tr>';
- }
- if ($config['stat_long_life']=='yes') {
- $content .= '<tr><td class="facts_label">'. i18n::translate('Person who lived the longest').'</td><td class="facts_value"><div dir="rtl">'.$stats->LongestLifeAge().'</div></td>';
- if (!$block){
- $content .= '<td class="facts_value">'.$stats->LongestLife().'</td>';
- }
- $content .= '</tr>';
- }
- if ($config['stat_avg_life']=='yes') {
- $content .= '<tr><td class="facts_label">'. i18n::translate('Average age at death').'</td><td class="facts_value"><div dir="rtl">'.$stats->averageLifespan().'</div></td>';
- if (!$block) {
- $content .= '<td class="facts_value">'.i18n::translate('Males').':&nbsp;'.$stats->averageLifespanMale();
- $content .= '&nbsp;&nbsp;&nbsp;'.i18n::translate('Females').':&nbsp;'.$stats->averageLifespanFemale().'</td>';
- }
- $content .= '</tr>';
- }
-
- if ($config['stat_most_chil']=='yes' && !$block) {
- $content .= '<tr><td class="facts_label">'. i18n::translate('Family with the most children').'</td><td class="facts_value"><div dir="rtl">'.$stats->largestFamilySize().'</div></td>';
- if (!$block) {
- $content .= '<td class="facts_value">'.$stats->largestFamily().'</td>';
- }
- $content .= '</tr>';
- }
- if ($config['stat_avg_chil']=='yes') {
- $content .= '<tr><td class="facts_label">'. i18n::translate('Average number of children per family').'</td><td class="facts_value"><div dir="rtl">'.$stats->averageChildren().'</div></td>';
- if (!$block) {
- $content .= '<td class="facts_value">&nbsp;</td>';
- }
- $content .= '</tr>';
- }
- $content .= '</table></td></tr></table>';
- if ($config['stat_link']=='yes') {
- $content .= '<a href="statistics.php"><b>'.i18n::translate('View statistics as graphs').'</b></a><br />';
- }
- // NOTE: Print the most common surnames
- if ($config['show_common_surnames']=='yes') {
- $surnames = get_common_surnames($COMMON_NAMES_THRESHOLD);
- if (count($surnames)>0) {
- $content .= '<br /><b>'.i18n::translate('Most Common Surnames').'</b>';
- $content .= help_link('index_common_names');
- $content .= '<br />';
- $i=0;
- foreach($surnames as $indexval => $surname) {
- if (stristr($surname['name'], '@N.N')===false) {
- if ($i>0) {
- $content .= ', ';
- }
- $content .= '<a href="'.encode_url("indilist.php?ged=".WT_GEDCOM."&surname=".$surname['name']).'">'.PrintReady($surname['name']).'</a>';
- $i++;
- }
- }
- }
- }
-
- global $THEME_DIR;
- if ($block) {
- require $THEME_DIR.'templates/block_small_temp.php';
- } else {
- require $THEME_DIR.'templates/block_main_temp.php';
- }
-}
-
-function print_gedcom_stats_config($config) {
- global $ctype, $WT_BLOCKS, $TEXT_DIRECTION;
- if (empty($config)) $config = $WT_BLOCKS['print_gedcom_stats']['config'];
- if (!isset($config['stat_indi'])) $config = $WT_BLOCKS['print_gedcom_stats']['config'];
- if (!isset($config['stat_first_death'])) $config['stat_first_death'] = $WT_BLOCKS['print_gedcom_stats']['config']['stat_first_death'];
- if (!isset($config['stat_last_death'])) $config['stat_last_death'] = $WT_BLOCKS['print_gedcom_stats']['config']['stat_last_death'];
- if (!isset($config['stat_media'])) $config['stat_media'] = $WT_BLOCKS['print_gedcom_stats']['config']['stat_media'];
- if (!isset($config['stat_link'])) $config['stat_link'] = $WT_BLOCKS['print_gedcom_stats']['config']['stat_link'];
- if (!isset($config['cache'])) $config['cache'] = $WT_BLOCKS['print_gedcom_stats']['config']['cache'];
-
- ?><tr><td class="descriptionbox wrap width33"> <?php echo i18n::translate('Show common surnames?'); ?></td>
-<td class="optionbox"><select name="show_common_surnames">
-<option value="yes"
-<?php if ($config['show_common_surnames']=='yes') echo ' selected="selected"'; ?>><?php echo i18n::translate('Yes'); ?></option>
-<option value="no"
-<?php if ($config['show_common_surnames']=='no') echo ' selected="selected"'; ?>><?php echo i18n::translate('No'); ?></option>
-</select></td>
-</tr>
-<tr>
-<td class="descriptionbox wrap width33"><?php echo i18n::translate('Select the stats to show in this block'); ?></td>
-<td class="optionbox">
-<table>
- <tr>
- <td><input type="checkbox" value="yes" name="stat_indi"
- <?php if ($config['stat_indi']=='yes') echo ' checked="checked"'; ?> />
- <?php echo i18n::translate('Individuals'); ?></td>
- <td><input type="checkbox" value="yes" name="stat_first_birth"
- <?php if ($config['stat_first_birth']=='yes') echo ' checked="checked"'; ?> />
- <?php echo i18n::translate('Earliest birth year'); ?></td>
- </tr>
- <tr>
- <td><input type="checkbox" value="yes" name="stat_surname"
- <?php if ($config['stat_surname']=='yes') echo ' checked="checked"'; ?> />
- <?php echo i18n::translate('Total surnames'); ?></td>
- <td><input type="checkbox" value="yes" name="stat_last_birth"
- <?php if ($config['stat_last_birth']=='yes') echo ' checked="checked"'; ?> />
- <?php echo i18n::translate('Latest birth year'); ?></td>
- </tr>
- <tr>
- <td><input type="checkbox" value="yes" name="stat_fam"
- <?php if ($config['stat_fam']=='yes') echo ' checked="checked"'; ?> />
- <?php echo i18n::translate('Families'); ?></td>
- <td><input type="checkbox" value="yes" name="stat_first_death"
- <?php if ($config['stat_first_death']=='yes') echo ' checked="checked"'; ?> />
- <?php echo i18n::translate('Earliest death year'); ?></td>
- </tr>
- <tr>
- <td><input type="checkbox" value="yes" name="stat_sour"
- <?php if ($config['stat_sour']=='yes') echo ' checked="checked"'; ?> />
- <?php echo i18n::translate('Sources'); ?></td>
- <td><input type="checkbox" value="yes" name="stat_last_death"
- <?php if ($config['stat_last_death']=='yes') echo ' checked="checked"'; ?> />
- <?php echo i18n::translate('Latest death year'); ?></td>
- </tr>
- <tr>
- <td><input type="checkbox" value="yes" name="stat_media"
- <?php if ($config['stat_media']=='yes') echo ' checked="checked"'; ?> />
- <?php echo i18n::translate('Media objects'); ?></td>
- <td><input type="checkbox" value="yes" name="stat_long_life"
- <?php if ($config['stat_long_life']=='yes') echo ' checked="checked"'; ?> />
- <?php echo i18n::translate('Person who lived the longest'); ?></td>
- </tr>
- <tr>
- <td><input type="checkbox" value="yes" name="stat_other"
- <?php if ($config['stat_other']=='yes') echo ' checked="checked"'; ?> />
- <?php echo i18n::translate('Other records'); ?></td>
- <td><input type="checkbox" value="yes" name="stat_avg_life"
- <?php if ($config['stat_avg_life']=='yes') echo ' checked="checked"'; ?> />
- <?php echo i18n::translate('Average age at death'); ?></td>
- </tr>
- <tr>
- <td><input type="checkbox" value="yes" name="stat_events"
- <?php if ($config['stat_events']=='yes') echo ' checked="checked"'; ?> />
- <?php echo i18n::translate('Total events'); ?></td>
- <td><input type="checkbox" value="yes" name="stat_most_chil"
- <?php if ($config['stat_most_chil']=='yes') echo ' checked="checked"'; ?> />
- <?php echo i18n::translate('Family with the most children'); ?></td>
- </tr>
- <tr>
- <td><input type="checkbox" value="yes" name="stat_users"
- <?php if ($config['stat_users']=='yes') echo ' checked="checked"'; ?> />
- <?php echo i18n::translate('Total users'); ?></td>
- <td><input type="checkbox" value="yes" name="stat_avg_chil"
- <?php if ($config['stat_avg_chil']=='yes') echo ' checked="checked"'; ?> />
- <?php echo i18n::translate('Average number of children per family'); ?></td>
- </tr>
-</table>
-</td>
-</tr>
-<tr>
- <td class="descriptionbox wrap width33"> <?php echo i18n::translate('Show link to Statistics charts?'); ?></td>
- <td class="optionbox">
- <select name="stat_link">
- <option value="yes" <?php if ($config['stat_link']=='yes') echo ' selected="selected"'; ?>><?php echo i18n::translate('Yes'); ?></option>
- <option value="no" <?php if ($config['stat_link']=='no') echo ' selected="selected"'; ?>><?php echo i18n::translate('No'); ?></option>
- </select>
- </td>
-</tr>
-<?php
-
- // Cache file life
- if ($ctype=='gedcom') {
- echo '<tr><td class="descriptionbox wrap width33">';
- echo i18n::translate('Cache file life'), help_link('cache_life');
- echo '</td><td class="optionbox">';
- echo '<input type="text" name="cache" size="2" value="', $config['cache'], '" />';
- echo '</td></tr>';
- }
-}
-?>
diff --git a/blocks/html_block.php b/blocks/html_block.php
deleted file mode 100644
index ad95fe6f16..0000000000
--- a/blocks/html_block.php
+++ /dev/null
@@ -1,116 +0,0 @@
-<?php
-/**
- * Simple HTML Block
- *
- * This block will print simple HTML text entered by an admin
- *
- * webtrees: Web based Family History software
- * Copyright (C) 2010 webtrees development team.
- *
- * Derived from PhpGedView
- * Copyright (C) 2002 to 2009 PGV Development Team. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * @package webtrees
- * @subpackage Blocks
- * @version $Id$
- */
-
-if (!defined('WT_WEBTREES')) {
- header('HTTP/1.0 403 Forbidden');
- exit;
-}
-
-define('WT_HTML_BLOCK_PHP', '');
-
-$WT_BLOCKS['print_html_block']=array(
- 'name'=>i18n::translate('HTML'),
- 'type'=>'both',
- 'descr'=>i18n::translate('This is a simple HTML block that you can place on your page to add any sort of message you may want.'),
- 'canconfig'=>true,
- 'config'=>array(
- 'cache'=>1,
- 'html'=>i18n::translate('<p class="blockhc"><b>Put your title here</b></p><br /><p>Click the configure button')." <img src=\"".$WT_IMAGE_DIR.'/'.$WT_IMAGES['admin']['small']."\" alt=\"".i18n::translate('Configure')."\" /> ".i18n::translate('to change what is printed here.</p>')
- )
-);
-
-function print_html_block($block=true, $config="", $side, $index) {
- global $WT_IMAGE_DIR, $TEXT_DIRECTION, $WT_IMAGES, $HTML_BLOCK_COUNT, $WT_BLOCKS, $ctype;
-
- if (empty($config)) $config = $WT_BLOCKS["print_html_block"]["config"];
- if (!isset($HTML_BLOCK_COUNT)) $HTML_BLOCK_COUNT = 0;
- $HTML_BLOCK_COUNT++;
-
- $id = "html_block$HTML_BLOCK_COUNT";
- $title = "";
- $content = embed_globals($config['html']);
-
- if ($WT_BLOCKS["print_html_block"]["canconfig"]) {
- if ($ctype=="gedcom" && WT_USER_GEDCOM_ADMIN || $ctype=="user" && WT_USER_ID) {
- if ($ctype=="gedcom") {
- $name = WT_GEDCOM;
- } else {
- $name = WT_USER_NAME;
- }
- $content .= "<br /><a href=\"javascript:;\" onclick=\"window.open('".encode_url("index_edit.php?name={$name}&ctype={$ctype}&action=configure&side={$side}&index={$index}")."', '_blank', 'top=50,left=50,width=600,height=350,scrollbars=1,resizable=1'); return false;\">";
- $content .= "<img class=\"adminicon\" src=\"$WT_IMAGE_DIR/".$WT_IMAGES["admin"]["small"]."\" width=\"15\" height=\"15\" border=\"0\" alt=\"".i18n::translate('Configure')."\" title=\"".i18n::translate('Configure')."\" /></a>\n";
- }
- }
-
- global $THEME_DIR;
- if ($block) {
- require $THEME_DIR.'templates/block_small_temp.php';
- } else {
- require $THEME_DIR.'templates/block_main_temp.php';
- }
-}
-
-function print_html_block_config($config) {
- global $ctype, $WT_BLOCKS, $TEXT_DIRECTION;
- $useFCK = file_exists(WT_ROOT.'modules/FCKeditor/fckeditor.php');
- if($useFCK){
- require WT_ROOT.'modules/FCKeditor/fckeditor.php';
- }
- if (empty($config)) $config = $WT_BLOCKS["print_html_block"]["config"];
- if (empty($config["cache"])) $config["cache"] = $WT_BLOCKS["print_html_block"]["config"]["cache"];
- ?>
- <tr>
- <td class="optionbox" colspan="2"><?php
- if ($useFCK) { // use FCKeditor module
- $oFCKeditor = new FCKeditor('html') ;
- $oFCKeditor->BasePath = './modules/FCKeditor/';
- $oFCKeditor->Value = $config["html"];
- $oFCKeditor->Width = 700;
- $oFCKeditor->Height = 250;
- $oFCKeditor->Config['AutoDetectLanguage'] = false ;
- $oFCKeditor->Config['DefaultLanguage'] = WT_LOCALE;
- $oFCKeditor->Create() ;
- } else { //use standard textarea
- print "<textarea name=\"html\" rows=\"10\" cols=\"80\">" . str_replace("<", "&lt;", $config["html"]) ."</textarea>";
- }
- ?></td>
- </tr>
- <?php
- // Cache file life
- if ($ctype=="gedcom") {
- echo "<tr><td class=\"descriptionbox wrap width33\">";
- echo i18n::translate('Cache file life'), help_link('cache_life');
- echo "</td><td class=\"optionbox\">";
- echo "<input type=\"text\" name=\"cache\" size=\"2\" value=\"".$config["cache"]."\" />";
- echo "</td></tr>";
- }
-}
-?>
diff --git a/blocks/logged_in.php b/blocks/logged_in.php
deleted file mode 100644
index 2d961d9cbc..0000000000
--- a/blocks/logged_in.php
+++ /dev/null
@@ -1,114 +0,0 @@
-<?php
-/**
- * Logged In Users Block
- *
- * This block will print a list of the users who are currently logged in
- *
- * webtrees: Web based Family History software
- * Copyright (C) 2010 webtrees development team.
- *
- * Derived from PhpGedView
- * Copyright (C) 2002 to 2009 PGV Development Team. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * @package webtrees
- * @subpackage Blocks
- * @version $Id$
- */
-
-if (!defined('WT_WEBTREES')) {
- header('HTTP/1.0 403 Forbidden');
- exit;
-}
-
-define('WT_LOGGED_IN_PHP', '');
-
-$WT_BLOCKS['print_logged_in_users']=array(
- 'name'=>i18n::translate('Logged In Users'),
- 'type'=>'both',
- 'descr'=>i18n::translate('The Logged In Users block shows a list of the users who are currently logged in.'),
- 'canconfig'=>false,
- 'config'=>array(
- 'cache'=>0
- )
-);
-
-/**
- * logged in users
- *
- * prints a list of other users who are logged in
- */
-/**
- * logged in users
- *
- * prints a list of other users who are logged in
- */
-function print_logged_in_users($block = true, $config = "", $side, $index) {
- global $WT_SESSION_TIME, $TEXT_DIRECTION;
-
- $block = true; // Always restrict this block's height
-
- // Log out inactive users
- foreach (get_idle_users(time()-$WT_SESSION_TIME) as $user_id=>$user_name) {
- if ($user_id!=WT_USER_ID) {
- userLogout($user_id);
- }
- }
-
- // List active users
- $NumAnonymous = 0;
- $loggedusers = array ();
- foreach (get_logged_in_users() as $user_id=>$user_name) {
- if (WT_USER_IS_ADMIN || get_user_setting($user_id, 'visibleonline')=='Y') {
- $loggedusers[$user_id]=$user_name;
- } else {
- $NumAnonymous++;
- }
- }
-
- $id = "logged_in_users";
- $title=i18n::translate('Users Logged In');
- $title.=help_link('index_loggedin');
- $content='<table width="90%">';
- $LoginUsers=count($loggedusers);
- if ($LoginUsers==0 && $NumAnonymous==0) {
- $content.='<tr><td><b>' . i18n::translate('No logged-in and no anonymous users') . '</b></td></tr>';
- }
- if ($NumAnonymous>0) {
- $content.='<tr><td><b>' . i18n::plural('%d anonymous logged-in user', '%d anonymous logged-in users', $NumAnonymous, $NumAnonymous) . '</b></td></tr>';
- }
- if ($LoginUsers>0) {
- $content.='<tr><td><b>' . i18n::plural('%d logged-in user', '%d logged-in users', $LoginUsers, $LoginUsers) . '</b></td></tr>';
- }
- if (WT_USER_ID) {
- foreach ($loggedusers as $user_id=>$user_name) {
- $content .= "<tr><td><br />".PrintReady(getUserFullName($user_id))." - ".$user_name;
- if (WT_USER_ID!=$user_id && get_user_setting($user_id, 'contactmethod')!="none") {
- $content .= "<br /><a href=\"javascript:;\" onclick=\"return message('" . $user_id . "');\">" . i18n::translate('Send Message') . "</a>";
- }
- $content .= "</td></tr>";
- }
- }
- $content .= "</table>";
-
- global $THEME_DIR;
- if ($block) {
- require $THEME_DIR.'templates/block_small_temp.php';
- } else {
- require $THEME_DIR.'templates/block_main_temp.php';
- }
-}
-?>
diff --git a/blocks/login_block.php b/blocks/login_block.php
deleted file mode 100644
index d0155b5613..0000000000
--- a/blocks/login_block.php
+++ /dev/null
@@ -1,166 +0,0 @@
-<?php
-/**
- * Login/Logout Block
- *
- * This block prints a form that will allow a user to login
- *
- * webtrees: Web based Family History software
- * Copyright (C) 2010 webtrees development team.
- *
- * Derived from PhpGedView
- * Copyright (C) 2002 to 2009 PGV Development Team. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * @package webtrees
- * @subpackage Blocks
- * @version $Id$
- */
-
-if (!defined('WT_WEBTREES')) {
- header('HTTP/1.0 403 Forbidden');
- exit;
-}
-
-define('WT_LOGIN_BLOCK_PHP', '');
-
-$WT_BLOCKS['print_login_block']=array(
- 'name'=>i18n::translate('Login'),
- 'type'=>'both', // On My Page, this becomes a Logout block
- 'descr'=>i18n::translate('The Login block accepts a user name and password for users to login.'),
- 'canconfig'=>false,
- 'config'=>array(
- 'cache'=>0
- )
-);
-
-/**
- * Print Login Block
- *
- * Prints a block allowing the user to login to the site directly from the portal
- */
-function print_login_block($block = true, $config="", $side, $index) {
- global $QUERY_STRING, $USE_REGISTRATION_MODULE, $TEXT_DIRECTION;
-
- if (WT_USER_ID) {
- $id="logout_block";
- $title = i18n::translate('Logout');
-
- $i = 0; // Initialize tab index
-
- $content = '<div class="center"><form method="post" action="index.php?logout=1" name="logoutform" onsubmit="return true;">';
- $content .= '<br /><a href="edituser.php" class="name2">'.i18n::translate('Logged in as ').' ('.WT_USER_NAME.')</a><br /><br />';
-
- $i++;
- $content .= "<input type=\"submit\" tabindex=\"{$i}\" value=\"".i18n::translate('Logout')."\" />";
-
- $content .= "<br /><br /></form></div>";
- } else {
- $id="login_block";
- $i = 0; // Initialize tab index
- $title = i18n::translate('Login');
- if ($USE_REGISTRATION_MODULE) {
- $title.=help_link('index_login_register');
- } else {
- $title.=help_link('index_login');
- }
- $LOGIN_URL=get_site_setting('LOGIN_URL');
- $content = "<div class=\"center\"><form method=\"post\" action=\"$LOGIN_URL\" name=\"loginform\" onsubmit=\"t = new Date(); document.loginform.usertime.value=t.getFullYear()+'-'+(t.getMonth()+1)+'-'+t.getDate()+' '+t.getHours()+':'+t.getMinutes()+':'+t.getSeconds(); return true;\">";
- $content .= "<input type=\"hidden\" name=\"url\" value=\"index.php\" />";
- $content .= "<input type=\"hidden\" name=\"ged\" value=\"";
- $content .= WT_GEDCOM;
- $content .= "\" />";
- $content .= "<input type=\"hidden\" name=\"pid\" value=\"";
- if (isset($pid)) $content .= $pid;
- $content .= "\" />";
- $content .= "<input type=\"hidden\" name=\"usertime\" value=\"\" />";
- $content .= "<input type=\"hidden\" name=\"action\" value=\"login\" />";
- $content .= "<table class=\"center tabs_table\">";
-
- // Row 1: Userid
- $i++;
- $content .= "<tr><td ";
- $content .= write_align_with_textdir_check("right", true);
- $content .= " class=\"{$TEXT_DIRECTION} wrap width50\">";
- $content .= i18n::translate('User name');
- $content .= help_link('username');
- $content .= "</td><td ";
- $content .= write_align_with_textdir_check("left", true);
- $content .= " class=\"{$TEXT_DIRECTION}\"><input type=\"text\" tabindex=\"{$i}\" name=\"username\" size=\"20\" class=\"formField\" />";
- $content .= "</td></tr>";
-
- // Row 2: Password
- $i++;
- $content .= "<tr><td ";
- $content .= write_align_with_textdir_check("right", true);
- $content .= " class=\"{$TEXT_DIRECTION} wrap width50\">";
- $content .= i18n::translate('Password');
- $content .= help_link('password');
- $content .= "</td><td ";
- $content .= write_align_with_textdir_check("left", true);
- $content .= " class=\"{$TEXT_DIRECTION}\"><input type=\"password\" tabindex=\"{$i}\" name=\"password\" size=\"20\" class=\"formField\" />";
- $content .= "</td></tr>";
-
- // Row 3: "Login" link
- $i++;
- $content .= "<tr><td colspan=\"2\" class=\"center\">";
- $content .= "<input type=\"submit\" tabindex=\"{$i}\" value=\"".i18n::translate('Login')."\" />&nbsp;";
- $content .= "</td></tr>";
-
- if ($USE_REGISTRATION_MODULE) {
-
- // Row 4: "Request Account" link
- $i++;
- $content .= "<tr><td ";
- $content .= write_align_with_textdir_check("right", true);
- $content .= " class=\"{$TEXT_DIRECTION} wrap width50\"><br />";
- $content .= i18n::translate('No account?');
- $content .= help_link('new_user');
- $content .= "</td><td ";
- $content .= write_align_with_textdir_check("left", true);
- $content .= " class=\"{$TEXT_DIRECTION}\"><br />";
- $content .= "<a href=\"login_register.php?action=register\" tabindex=\"{$i}\">";
- $content .= i18n::translate('Request new user account');
- $content .= "</a>";
- $content .= "</td></tr>";
-
- // Row 5: "Lost Password" link
- $i++;
- $content .= "<tr><td ";
- $content .= write_align_with_textdir_check("right", true);
- $content .= " class=\"{$TEXT_DIRECTION} wrap width50\">";
- $content .= i18n::translate('Lost your password?');
- $content .= help_link('new_password');
- $content .= "</td><td ";
- $content .= write_align_with_textdir_check("left", true);
- $content .= " class=\"{$TEXT_DIRECTION}\">";
- $content .= "<a href=\"login_register.php?action=pwlost\" tabindex=\"{$i}\">";
- $content .= i18n::translate('Request new password');
- $content .= "</a>";
- $content .= "</td></tr>";
- }
-
- $content .= "</table>";
- $content .= "</form></div>";
- }
-
- global $THEME_DIR;
- if ($block) {
- require $THEME_DIR.'templates/block_small_temp.php';
- } else {
- require $THEME_DIR.'templates/block_main_temp.php';
- }
-}
-?>
diff --git a/blocks/random_media.php b/blocks/random_media.php
deleted file mode 100644
index b11650a5f6..0000000000
--- a/blocks/random_media.php
+++ /dev/null
@@ -1,466 +0,0 @@
-<?php
-/**
- * Random Media Block
- *
- * This block will randomly choose media items and show them in a block
- *
- * webtrees: Web based Family History software
- * Copyright (C) 2010 webtrees development team.
- *
- * Derived from PhpGedView
- * Copyright (C) 2002 to 2009 PGV Development Team. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * @version $Id$
- * @package webtrees
- * @subpackage Blocks
- */
-
-if (!defined('WT_WEBTREES')) {
- header('HTTP/1.0 403 Forbidden');
- exit;
-}
-
-define('WT_RANDOM_MEDIA_PHP', '');
-
-//-- only enable this block if multi media has been enabled
-if ($MULTI_MEDIA) {
- $WT_BLOCKS['print_random_media']=array(
- 'name'=>i18n::translate('Random Media'),
- 'type'=>'both',
- 'descr'=>i18n::translate('The Random Media block randomly selects a photo or other media item from the currently active database and displays it to the user.<br /><br />The administrator determines whether this block can show media items associated with persons or events.'),
- 'canconfig'=>true,
- 'config'=>array(
- 'cache' =>0,
- 'filter' =>'all',
- 'controls'=>'yes',
- 'start' =>'no',
- 'filter_avi' =>'no',
- 'filter_bmp' =>'yes',
- 'filter_gif' =>'yes',
- 'filter_jpeg' =>'yes',
- 'filter_mp3' =>'no',
- 'filter_ole' =>'yes',
- 'filter_pcx' =>'yes',
- 'filter_pdf' =>'no',
- 'filter_png' =>'yes',
- 'filter_tiff' =>'yes',
- 'filter_wav' =>'no',
- 'filter_audio' =>'no',
- 'filter_book' =>'yes',
- 'filter_card' =>'yes',
- 'filter_certificate'=>'yes',
- 'filter_coat' =>'yes',
- 'filter_document' =>'yes',
- 'filter_electronic' =>'yes',
- 'filter_fiche' =>'yes',
- 'filter_film' =>'yes',
- 'filter_magazine' =>'yes',
- 'filter_manuscript' =>'yes',
- 'filter_map' =>'yes',
- 'filter_newspaper' =>'yes',
- 'filter_other' =>'yes',
- 'filter_painting' =>'yes',
- 'filter_photo' =>'yes',
- 'filter_tombstone' =>'yes',
- 'filter_video' =>'no'
- )
- );
-
- require_once WT_ROOT.'includes/functions/functions_print_facts.php';
-
- //-- function to display a random picture from the gedcom
- function print_random_media($block = true, $config="", $side, $index) {
- global $foundlist, $MULTI_MEDIA, $TEXT_DIRECTION, $WT_IMAGE_DIR, $WT_IMAGES;
- global $MEDIA_EXTERNAL, $MEDIA_DIRECTORY, $SHOW_SOURCES;
- global $MEDIATYPE, $THUMBNAIL_WIDTH, $USE_MEDIA_VIEWER;
- global $WT_BLOCKS, $ctype, $action;
- global $WT_IMAGE_DIR, $WT_IMAGES;
-
- if (!$MULTI_MEDIA) return;
-
- if (empty($config)) $config = $WT_BLOCKS["print_random_media"]["config"];
- if (isset($config["filter"])) $filter = $config["filter"]; // indi, event, or all
- else $filter = "all";
- if (!isset($config['controls'])) $config['controls'] ="yes";
- if (!isset($config['start'])) $config['start'] ="no";
-
- $medialist = array();
- $foundlist = array();
-
- $medialist = get_medialist(false, '', true, true);
- $ct = count($medialist);
- if ($ct>0) {
- $i=0;
- $disp = false;
- //-- try up to 40 times to get a media to display
- while($i<40) {
- $error = false;
- $value = array_rand($medialist);
- if (WT_DEBUG) {
- print "<br />";print_r($medialist[$value]);print "<br />";
- print "Trying ".$medialist[$value]["XREF"]."<br />";
- }
- $links = $medialist[$value]["LINKS"];
- $disp = ($medialist[$value]["EXISTS"]>0) && $medialist[$value]["LINKED"] && $medialist[$value]["CHANGE"]!="delete" ;
- if (WT_DEBUG && !$disp && !$error) {$error = true; print "<span class=\"error\">".$medialist[$value]["XREF"]." File does not exist, or is not linked to anyone, or is marked for deletion.</span><br />";}
-
- $disp &= displayDetailsById($medialist[$value]["XREF"], "OBJE");
- $disp &= !FactViewRestricted($medialist[$value]["XREF"], $medialist[$value]["GEDCOM"]);
-
- if (WT_DEBUG && !$disp && !$error) {$error = true; print "<span class=\"error\">".$medialist[$value]["XREF"]." Failed to pass privacy</span><br />";}
-
- $isExternal = isFileExternal($medialist[$value]["FILE"]);
-
- if ($block && !$isExternal) $disp &= ($medialist[$value]["THUMBEXISTS"]>0);
- if (WT_DEBUG && !$disp && !$error) {$error = true; print "<span class=\"error\">".$medialist[$value]["XREF"]." thumbnail file could not be found</span><br />";}
-
- // Filter according to format and type (Default: unless configured otherwise, don't filter)
- if (!empty($medialist[$value]["FORM"]) && isset($config["filter_".$medialist[$value]["FORM"]]) && $config["filter_".$medialist[$value]["FORM"]]!="yes") $disp = false;
- if (!empty($medialist[$value]["TYPE"]) && isset($config["filter_".$medialist[$value]["TYPE"]]) && $config["filter_".$medialist[$value]["TYPE"]]!="yes") $disp = false;
- if (WT_DEBUG && !$disp && !$error) {$error = true; print "<span class=\"error\">".$medialist[$value]["XREF"]." failed Format or Type filters</span><br />";}
-
- if ($disp && count($links) != 0){
- /** link privacy allready checked in displayDetailsById
- foreach($links as $key=>$type) {
- $gedrec = find_gedcom_record($key, WT_GED_ID);
- $disp &= !empty($gedrec);
- //-- source privacy is now available through the display details by id method
- // $disp &= $type!="SOUR";
- $disp &= displayDetailsById($key, $type);
- }
- if (WT_DEBUG && !$disp && !$error) {$error = true; print "<span class=\"error\">".$medialist[$value]["XREF"]." failed link privacy</span><br />";}
- */
- if ($disp && $filter!="all") {
- // Apply filter criteria
- $ct = preg_match("/0\s(@.*@)\sOBJE/", $medialist[$value]["GEDCOM"], $match);
- $objectID = $match[1];
- //-- we could probably use the database for this filter
- foreach($links as $key=>$type) {
- $gedrec = find_gedcom_record($key, WT_GED_ID);
- $ct2 = preg_match("/(\d)\sOBJE\s{$objectID}/", $gedrec, $match2);
- if ($ct2>0) {
- $objectRefLevel = $match2[1];
- if ($filter=="indi" && $objectRefLevel!="1") $disp = false;
- if ($filter=="event" && $objectRefLevel=="1") $disp = false;
- if (WT_DEBUG && !$disp && !$error) {$error = true; print "<span class=\"error\">".$medialist[$value]["XREF"]." failed to pass config filter</span><br />";}
- }
- else $disp = false;
- }
- }
- }
- //-- leave the loop if we find an image that works
- if ($disp) {
- break;
- }
- //-- otherwise remove the private media item from the list
- else {
- if (WT_DEBUG) print "<span class=\"error\">".$medialist[$value]["XREF"]." Will not be shown</span><br />";
- unset($medialist[$value]);
- }
- //-- if there are no more media items, then try to get some more
- if (count($medialist)==0) $medialist = get_medialist(false, '', true, true);
- $i++;
- }
- if (!$disp) return false;
-
- $content = "";
- $id = "";
- $id = "random_picture$index";
- $title='';
- if ($WT_BLOCKS["print_random_media"]["canconfig"]) {
- if ($ctype=="gedcom" && WT_USER_GEDCOM_ADMIN || $ctype=="user" && WT_USER_ID) {
- if ($ctype=="gedcom") {
- $name = WT_GEDCOM;
- } else {
- $name = WT_USER_NAME;
- }
- $title .= "<a href=\"javascript: configure block\" onclick=\"window.open('".encode_url("index_edit.php?name={$name}&ctype={$ctype}&action=configure&side={$side}&index={$index}")."', '_blank', 'top=50,left=50,width=600,height=350,scrollbars=1,resizable=1'); return false;\">";
- $title .= "<img class=\"adminicon\" src=\"{$WT_IMAGE_DIR}/{$WT_IMAGES['admin']['small']}\" width=\"15\" height=\"15\" border=\"0\" alt=\"".i18n::translate('Configure')."\" /></a>";
- }
- }
- $title .= i18n::translate('Random Picture');
- $title .= help_link('index_media');
- $content = "<div id=\"random_picture_container$index\">";
- if ($config['controls']=='yes') {
- if ($config['start']=='yes' || (isset($_COOKIE['rmblockplay'])&&$_COOKIE['rmblockplay']=='true')) $image = "stop";
- else $image = "rarrow";
- $linkNextImage = "<a href=\"javascript: ".i18n::translate('Next image')."\" onclick=\"return ajaxBlock('random_picture$index', 'print_random_media', '$side', $index, '$ctype', true);\"><img src=\"{$WT_IMAGE_DIR}/{$WT_IMAGES['rdarrow']['other']}\" border=\"0\" alt=\"".i18n::translate('Next image')."\" title=\"".i18n::translate('Next image')."\" /></a>";
-
- $content .= "<div class=\"center\" id=\"random_picture_controls$index\"><br />";
- if ($TEXT_DIRECTION=="rtl") $content .= $linkNextImage;
- $content .= "<a href=\"javascript: ".i18n::translate('Play')."/".i18n::translate('Stop')."\" onclick=\"togglePlay(); return false;\">";
- if (isset($WT_IMAGES[$image]['other'])) $content .= "<img id=\"play_stop\" src=\"{$WT_IMAGE_DIR}/{$WT_IMAGES[$image]['other']}\" border=\"0\" alt=\"".i18n::translate('Play')."/".i18n::translate('Stop')."\" title=\"".i18n::translate('Play')."/".i18n::translate('Stop')."\" />";
- else $content .= i18n::translate('Play')."/".i18n::translate('Stop');
- $content .= "</a>";
- if ($TEXT_DIRECTION=="ltr") $content .= $linkNextImage;
- $content .= '
- </div>
- <script language="JavaScript" type="text/javascript">
- <!--
- var play = false;
- function togglePlay() {
- if (play) {
- play = false;
- imgid = document.getElementById("play_stop");
- imgid.src = \''.$WT_IMAGE_DIR."/".$WT_IMAGES["rarrow"]['other'].'\';
- }
- else {
- play = true;
- playSlideShow();
- imgid = document.getElementById("play_stop");
- imgid.src = \''.$WT_IMAGE_DIR."/".$WT_IMAGES["stop"]['other'].'\';
- }
- }
-
- function playSlideShow() {
- if (play) {
- ajaxBlock(\'random_picture'.$index.'\', \'print_random_media\', \''.$side.'\', '.$index.', \''.$ctype.'\', false);
- window.setTimeout(\'playSlideShow()\', 6000);
- }
- }
- //-->
- </script>';
- }
- if ($config['start']=='yes') {
- $content .= '
- <script language="JavaScript" type="text/javascript">
- <!--
- play = true;
- imgid = document.getElementById("play_stop");
- imgid.src = \''.$WT_IMAGE_DIR."/".$WT_IMAGES["stop"]['other'].'\';
- window.setTimeout("playSlideShow()", 6000);
- //-->
- </script>';
- }
- $content .= "<div class=\"center\" id=\"random_picture_content$index\">";
- $imgsize = findImageSize($medialist[$value]["FILE"]);
- $imgwidth = $imgsize[0]+40;
- $imgheight = $imgsize[1]+150;
- $content .= "<table id=\"random_picture_box\" width=\"100%\"><tr><td valign=\"top\"";
-
- if ($block) $content .= " align=\"center\" class=\"details1\"";
- else $content .= " class=\"details2\"";
- $mediaid = $medialist[$value]["XREF"];
-
-//LBox -------- change for Lightbox Album --------------------------------------------
-?>
-<script language="JavaScript" type="text/javascript">
-<!--
-function openPic(filename, width, height) {
- height=height+50;
- screenW = screen.width;
- screenH = screen.height;
- if (width>screenW-100) width=screenW-100;
- if (height>screenH-110) height=screenH-120;
- if ((filename.search(/\.je?pg$/gi)!=-1)||(filename.search(/\.gif$/gi)!=-1)||(filename.search(/\.png$/gi)!=-1)||(filename.search(/\.bmp$/gi)!=-1))
- win02 = window.open('imageview.php?filename='+filename,'win02','top=50,left=150,height='+height+',width='+width+',scrollbars=1,resizable=1');
- // win03.resizeTo(winWidth 2,winHeight 30);
- else window.open(unescape(filename),'win02','top=50,left=150,height='+height+',width='+width+',scrollbars=1,resizable=1');
- win02.focus();
- }
--->
-</script><?php
-
- if (WT_USE_LIGHTBOX) {
- // $content .= " ><a href=\"javascript:;\" onclick=\"return openPic('".$medialist[$value]["FILE"]."', $imgwidth, $imgheight);\">";
- // $content .= " ><a href=\"javascript:;\" onclick=\"return openImage('".$medialist[$value]["FILE"]."', $imgwidth, $imgheight);\">";
- // $content .= "><a href=\"" . $medialist[$value]["FILE"] . "\" rel=\"clearbox[general_4]\" title=\"" . $mediaid . "\">" . "\n";
- $content .= " ><a href=\"mediaviewer.php?mid=".$mediaid."\">";
- }else
-// ---------------------------------------------------------------------------------------------
-
-
- if ($USE_MEDIA_VIEWER) {
- $content .= " ><a href=\"mediaviewer.php?mid=".$mediaid."\">";
- }
- else {
- $content .= " ><a href=\"javascript:;\" onclick=\"return openImage('".$medialist[$value]["FILE"]."', $imgwidth, $imgheight);\">";
- }
- $mediaTitle = "";
- if (!empty($medialist[$value]["TITL"])) {
- $mediaTitle = PrintReady($medialist[$value]["TITL"]);
- }
- else $mediaTitle = basename($medialist[$value]["FILE"]);
- if ($block) {
- $content .= "<img src=\"".$medialist[$value]["THUMB"]."\" border=\"0\" class=\"thumbnail\"";
- if ($isExternal) $content .= " width=\"".$THUMBNAIL_WIDTH."\"";
- } else {
- $content .= "<img src=\"".$medialist[$value]["FILE"]."\" border=\"0\" class=\"thumbnail\" ";
- $imgsize = findImageSize($medialist[$value]["FILE"]);
- if ($imgsize[0] > 175) $content .= "width=\"175\" ";
- }
- $content .= " alt=\"{$mediaTitle}\" title=\"{$mediaTitle}\" />";
- $content .= "</a>";
- if ($block) $content .= "<br />";
- else $content .= "</td><td class=\"details2\">";
- $content .= "<a href=\"mediaviewer.php?mid=".$mediaid."\">";
- $content .= "<b>". $mediaTitle ."</b>";
- $content .= "</a><br />";
-
- ob_start();
- PrintMediaLinks($medialist[$value]["LINKS"], "normal");
- $content .= ob_get_clean();
- $content .= "<br /><div class=\"indent" . ($TEXT_DIRECTION=="rtl"?"_rtl":"") . "\">";
- $content .= print_fact_notes($medialist[$value]["GEDCOM"], "1", false, true);
- $content .= "</div>";
- $content .= "</td></tr></table>";
- $content .= "</div>"; // random_picture_content
- $content .= "</div>"; // random_picture_container
- global $THEME_DIR;
- require $THEME_DIR.'templates/block_main_temp.php';
- }
- }
-
-
- function print_random_media_config($config) {
- global $WT_BLOCKS, $TEXT_DIRECTION;
-
- $defaultConfig = $WT_BLOCKS['print_random_media']['config'];
- if (empty($config)) $config = $defaultConfig;
-
- // Add options missing from old block configurations
- foreach ($defaultConfig as $option => $setting) {
- if (!isset($config[$option])) $config[$option] = $setting;
- }
-
- print "<tr><td class=\"descriptionbox wrap width33\">";
- print i18n::translate('Show only persons, events, or all?');
- print help_link('random_media_persons_or_all');
- print "</td>";
- ?>
- <td class="optionbox"><select name="filter">
- <option value="indi"
- <?php if ($config["filter"]=="indi") print " selected=\"selected\"";?>><?php print i18n::translate('Persons'); ?></option>
- <option value="event"
- <?php if ($config["filter"]=="event") print " selected=\"selected\"";?>><?php print i18n::translate('Events'); ?></option>
- <option value="all"
- <?php if ($config["filter"]=="all") print " selected=\"selected\"";?>><?php print i18n::translate('ALL'); ?></option>
- </select></td>
- </tr>
-
- <tr>
- <td class="descriptionbox wrap width33">
-<?php
- echo i18n::translate('Filter'), help_link('random_media_filter');
-?>
- </td>
- <td class="optionbox">
- <center><b><?php echo i18n::translate('FORM'); ?></b></center>
- <table class="width100">
- <tr>
- <td class="width33"><input type="checkbox" value="yes"
- name="filter_avi"
- <?php if ($config['filter_avi']=="yes") print " checked=\"checked\""; ?> />&nbsp;&nbsp;avi&nbsp;&nbsp;</td>
- <td class="width33"><input type="checkbox" value="yes"
- name="filter_bmp"
- <?php if ($config['filter_bmp']=="yes") print " checked=\"checked\""; ?> />&nbsp;&nbsp;bmp&nbsp;&nbsp;</td>
- <td class="width33"><input type="checkbox" value="yes"
- name="filter_gif"
- <?php if ($config['filter_gif']=="yes") print " checked=\"checked\""; ?> />&nbsp;&nbsp;gif&nbsp;&nbsp;</td>
- </tr>
- <tr>
- <td class="width33"><input type="checkbox" value="yes"
- name="filter_jpeg"
- <?php if ($config['filter_jpeg']=="yes") print " checked=\"checked\""; ?> />&nbsp;&nbsp;jpeg&nbsp;&nbsp;</td>
- <td class="width33"><input type="checkbox" value="yes"
- name="filter_mp3"
- <?php if ($config['filter_mp3']=="yes") print " checked=\"checked\""; ?> />&nbsp;&nbsp;mp3&nbsp;&nbsp;</td>
- <td class="width33"><input type="checkbox" value="yes"
- name="filter_ole"
- <?php if ($config['filter_ole']=="yes") print " checked=\"checked\""; ?> />&nbsp;&nbsp;ole&nbsp;&nbsp;</td>
- </tr>
- <tr>
- <td class="width33"><input type="checkbox" value="yes"
- name="filter_pcx"
- <?php if ($config['filter_pcx']=="yes") print " checked=\"checked\""; ?> />&nbsp;&nbsp;pcx&nbsp;&nbsp;</td>
- <td class="width33"><input type="checkbox" value="yes"
- name="filter_pdf"
- <?php if ($config['filter_pdf']=="yes") print " checked=\"checked\""; ?> />&nbsp;&nbsp;pdf&nbsp;&nbsp;</td>
- <td class="width33"><input type="checkbox" value="yes"
- name="filter_png"
- <?php if ($config['filter_png']=="yes") print " checked=\"checked\""; ?> />&nbsp;&nbsp;png&nbsp;&nbsp;</td>
- </tr>
- <tr>
- <td class="width33"><input type="checkbox" value="yes"
- name="filter_tiff"
- <?php if ($config['filter_tiff']=="yes") print " checked=\"checked\""; ?> />&nbsp;&nbsp;tiff&nbsp;&nbsp;</td>
- <td class="width33"><input type="checkbox" value="yes"
- name="filter_wav"
- <?php if ($config['filter_wav']=="yes") print " checked=\"checked\""; ?> />&nbsp;&nbsp;wav&nbsp;&nbsp;</td>
- <td class="width33">&nbsp;</td>
- <td class="width33">&nbsp;</td>
- </tr>
- </table>
- <br />
- <center><b><?php echo i18n::translate('TYPE'); ?></b></center>
- <table class="width100">
- <tr>
- <?php
- //-- Build the list of checkboxes
- $i = 0;
- global $MEDIA_TYPES;
- foreach ($MEDIA_TYPES as $typeName => $typeValue) {
- $i++;
- if ($i > 3) {
- $i = 1;
- print "</tr><tr>";
- }
- print "<td class=\"width33\"><input type=\"checkbox\" value=\"yes\" name=\"filter_".$typeName."\"";
- if ($config['filter_'.$typeName]=="yes") print " checked=\"checked\"";
- print " />&nbsp;&nbsp;".$typeValue."&nbsp;&nbsp;</td>";
- }
- ?>
- </tr>
- </table>
- </td>
- </tr>
-
- <tr>
- <td class="descriptionbox wrap width33">
- <?php
- print i18n::translate('Show slideshow controls?');
- print help_link('random_media_ajax_controls');
- ?>
- </td>
- <td class="optionbox"><select name="controls">
- <option value="yes"
- <?php if ($config["controls"]=="yes") print " selected=\"selected\""; ?>><?php print i18n::translate('Yes'); ?></option>
- <option value="no"
- <?php if ($config["controls"]=="no") print " selected=\"selected\""; ?>><?php print i18n::translate('No'); ?></option>
- </select></td>
- </tr>
- <tr>
- <td class="descriptionbox wrap width33">
- <?php
- print i18n::translate('Start slideshow on page load?');
- print help_link('random_media_start_slide');
- ?>
- </td>
- <td class="optionbox"><select name="start">
- <option value="yes"
- <?php if ($config["start"]=="yes") print " selected=\"selected\""; ?>><?php print i18n::translate('Yes'); ?></option>
- <option value="no"
- <?php if ($config["start"]=="no") print " selected=\"selected\""; ?>><?php print i18n::translate('No'); ?></option>
- </select>
- <input type="hidden" name="cache" value="0" />
- </td></tr>
-
- <?php
- }
-
-} // if ($MULTI_MEDIA)
-?>
diff --git a/blocks/recent_changes.php b/blocks/recent_changes.php
deleted file mode 100644
index c350a28438..0000000000
--- a/blocks/recent_changes.php
+++ /dev/null
@@ -1,137 +0,0 @@
-<?php
-/**
- * Recent Changes Block
- *
- * This block will print a list of recent changes
- *
- * webtrees: Web based Family History software
- * Copyright (C) 2010 webtrees development team.
- *
- * Derived from PhpGedView
- * Copyright (C) 2002 to 2009 PGV Development Team. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * @package webtrees
- * @subpackage Blocks
- * @version $Id$
- */
-
-if (!defined('WT_WEBTREES')) {
- header('HTTP/1.0 403 Forbidden');
- exit;
-}
-
-define('WT_RECENT_CHANGES_PHP', '');
-
-$WT_BLOCKS['print_recent_changes']=array(
- 'name'=>i18n::translate('Recent Changes'),
- 'type'=>'both',
- 'descr'=>i18n::translate('The Recent Changes block will list all of the changes that have been made to the database in the last month. This block can help you stay current with the changes that have been made. Changes are detected automatically, using the CHAN tag defined in the GEDCOM Standard.'),
- 'canconfig'=>true,
- 'config'=>array(
- 'cache'=>1,
- 'days'=>30,
- 'hide_empty'=>'no'
- )
-);
-
-//-- Recent Changes block
-//-- this block prints a list of changes that have occurred recently in your gedcom
-function print_recent_changes($block=true, $config="", $side, $index) {
- global $ctype;
- global $WT_IMAGE_DIR, $WT_IMAGES, $WT_BLOCKS;
-
- $block = true; // Always restrict this block's height
-
- if (empty($config)) $config = $WT_BLOCKS["print_recent_changes"]["config"];
- if ($config["days"]<1) $config["days"] = 30;
- if (isset($config["hide_empty"])) $HideEmpty = $config["hide_empty"];
- else $HideEmpty = "no";
-
- $found_facts=get_recent_changes(client_jd()-$config['days']);
-
-// Start output
- if (count($found_facts)==0 and $HideEmpty=="yes") return false;
-// Print block header
- $id="recent_changes";
- $title='';
- if ($WT_BLOCKS["print_recent_changes"]["canconfig"]) {
- if ($ctype=="gedcom" && WT_USER_GEDCOM_ADMIN || $ctype=="user" && WT_USER_ID) {
- if ($ctype=="gedcom") {
- $name = WT_GEDCOM;
- } else {
- $name = WT_USER_NAME;
- }
- $title .= "<a href=\"javascript: configure block\" onclick=\"window.open('".encode_url("index_edit.php?name={$name}&ctype={$ctype}&action=configure&side={$side}&index={$index}")."', '_blank', 'top=50,left=50,width=600,height=350,scrollbars=1,resizable=1'); return false;\">";
- $title .= "<img class=\"adminicon\" src=\"$WT_IMAGE_DIR/".$WT_IMAGES["admin"]["small"]."\" width=\"15\" height=\"15\" border=\"0\" alt=\"".i18n::translate('Configure')."\" /></a>";
- }
- }
- $title.=i18n::translate('Recent Changes').help_link('recent_changes');
-
- $content = "";
-// Print block content
- if (count($found_facts)==0) {
- $content .= i18n::translate('There have been no changes within the last %s days.', $config["days"]);
- } else {
- $content .= i18n::translate('Changes made within the last %s days', $config["days"]);
- // sortable table
- require_once WT_ROOT.'includes/functions/functions_print_lists.php';
- ob_start();
- print_changes_table($found_facts);
- $content .= ob_get_clean();
- }
-
- global $THEME_DIR;
- if ($block) {
- require $THEME_DIR.'templates/block_small_temp.php';
- } else {
- require $THEME_DIR.'templates/block_main_temp.php';
- }
-}
-
-function print_recent_changes_config($config) {
- global $ctype, $WT_BLOCKS;
- if (empty($config)) $config = $WT_BLOCKS["print_recent_changes"]["config"];
- if (!isset($config["cache"])) $config["cache"] = $WT_BLOCKS["print_recent_changes"]["config"]["cache"];
-
- print "<tr><td class=\"descriptionbox wrap width33\">".i18n::translate('Number of days to show')."</td>";?>
- <td class="optionbox">
- <input type="text" name="days" size="2" value="<?php print $config["days"]; ?>" />
- </td></tr>
-
- <?php
- print "<tr><td class=\"descriptionbox wrap width33\">".i18n::translate('Should this block be hidden when it is empty?')."</td>";?>
- <td class="optionbox">
- <select name="hide_empty">
- <option value="no"<?php if ($config["hide_empty"]=="no") print " selected=\"selected\"";?>><?php print i18n::translate('No'); ?></option>
- <option value="yes"<?php if ($config["hide_empty"]=="yes") print " selected=\"selected\"";?>><?php print i18n::translate('Yes'); ?></option>
- </select>
- </td></tr>
- <tr><td colspan="2" class="optionbox wrap">
- <span class="error"><?php print i18n::translate('If you hide an empty block, you will not be able to change its configuration until it becomes visible by no longer being empty.'); ?></span>
- </td></tr>
- <?php
-
- // Cache file life
- if ($ctype=="gedcom") {
- echo "<tr><td class=\"descriptionbox wrap width33\">";
- echo i18n::translate('Cache file life'), help_link('cache_life');
- echo "</td><td class=\"optionbox\">";
- echo "<input type=\"text\" name=\"cache\" size=\"2\" value=\"".$config["cache"]."\" />";
- echo "</td></tr>";
- }
-}
-?>
diff --git a/blocks/review_changes.php b/blocks/review_changes.php
deleted file mode 100644
index f47b78bd26..0000000000
--- a/blocks/review_changes.php
+++ /dev/null
@@ -1,187 +0,0 @@
-<?php
-/**
- * Review Changes Block
- *
- * This block prints the changes that still need to be reviewed and accepted by an administrator
- *
- * webtrees: Web based Family History software
- * Copyright (C) 2010 webtrees development team.
- *
- * Derived from PhpGedView
- * Copyright (C) 2002 to 2009 PGV Development Team. All rights reserved.
- *
- * Modifications Copyright (c) 2010 Greg Roach
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * @ersion $Id$
- * @package webtrees
- * @subpackage Blocks
- * @todo add a time configuration option
- */
-
-if (!defined('WT_WEBTREES')) {
- header('HTTP/1.0 403 Forbidden');
- exit;
-}
-
-define('WT_REVIEW_CHANGES_PHP', '');
-
-$WT_BLOCKS['review_changes_block']=array(
- 'name'=>i18n::translate('Pending Changes'),
- 'type'=>'both',
- 'descr'=>i18n::translate('The Pending Changes block will give users with Edit rights a list of the records that have been changed online and that still need to be reviewed and accepted. These changes are pending acceptance or rejection.<br /><br />If this block is enabled, users with Accept rights will receive an email once a day notifying them that changes need to be reviewed.'),
- 'canconfig'=>false,
- 'config'=>array(
- 'cache'=>0,
- 'days'=>1,
- 'sendmail'=>'yes'
- )
-);
-
-/**
- * Print Review Changes Block
- *
- * Prints a block allowing the user review all changes pending approval
- */
-function review_changes_block($block = true, $config="", $side, $index) {
- global $ctype, $QUERY_STRING, $WT_IMAGE_DIR, $WT_IMAGES;
- global $TEXT_DIRECTION, $SHOW_SOURCES, $WT_BLOCKS;
- global $WEBTREES_EMAIL;
- global $TBLPREFIX;
-
- if (empty($config)) $config = $WT_BLOCKS["review_changes_block"]["config"];
-
- $changes=WT_DB::prepare(
- "SELECT 1".
- " FROM {$TBLPREFIX}change".
- " WHERE status='pending'".
- " LIMIT 1"
- )->fetchOne();
-
- if ($changes) {
- //-- if the time difference from the last email is greater than 24 hours then send out another email
- $LAST_CHANGE_EMAIL=get_site_setting('LAST_CHANGE_EMAIL');
- if (time()-$LAST_CHANGE_EMAIL > (60*60*24*$config["days"])) {
- $LAST_CHANGE_EMAIL = time();
- set_site_setting('LAST_CHANGE_EMAIL', $LAST_CHANGE_EMAIL);
- if ($config["sendmail"]=="yes") {
- // Which users have pending changes?
- $users_with_changes=array();
- foreach (get_all_users() as $user_id=>$user_name) {
- foreach (get_all_gedcoms() as $ged_id=>$ged_name) {
- if (exists_pending_change($user_id, $ged_id)) {
- $users_with_changes[$user_id]=$user_name;
- break;
- }
- }
- }
- foreach ($users_with_changes as $user_id=>$user_name) {
- //-- send message
- $message = array();
- $message["to"]=$user_name;
- $message["from"] = $WEBTREES_EMAIL;
- $message["subject"] = i18n::translate('webtrees - Review changes');
- $message["body"] = i18n::translate('Online changes have been made to a genealogical database. These changes need to be reviewed and accepted before they will appear to all users. Please use the URL below to enter that webtrees site and login to review the changes.');
- $message["method"] = get_user_setting($user_id, 'contactmethod');
- $message["url"] = WT_SERVER_NAME.WT_SCRIPT_PATH;
- $message["no_from"] = true;
- addMessage($message);
- }
- }
- }
- if (WT_USER_CAN_EDIT) {
- $id="review_changes_block";
- $title='';
- if ($WT_BLOCKS["review_changes_block"]["canconfig"]) {
- if ($ctype=="gedcom" && WT_USER_GEDCOM_ADMIN || $ctype=="user" && WT_USER_ID) {
- if ($ctype=="gedcom") {
- $name = WT_GEDCOM;
- } else {
- $name = WT_USER_NAME;
- }
- $title .= "<a href=\"javascript: configure block\" onclick=\"window.open('".encode_url("index_edit.php?name={$name}&ctype={$ctype}&action=configure&side={$side}&index={$index}")."', '_blank', 'top=50,left=50,width=600,height=350,scrollbars=1,resizable=1'); return false;\">";
- $title .= "<img class=\"adminicon\" src=\"$WT_IMAGE_DIR/".$WT_IMAGES["admin"]["small"]."\" width=\"15\" height=\"15\" border=\"0\" alt=\"".i18n::translate('Configure')."\" /></a>";
- }
- }
- $title.=i18n::translate('Review GEDCOM Changes').help_link('review_changes');
- $content = "";
- if (WT_USER_CAN_ACCEPT) {
- $content .= "<a href=\"javascript:;\" onclick=\"window.open('edit_changes.php','_blank','width=600,height=500,resizable=1,scrollbars=1'); return false;\">".i18n::translate('Accept / Reject Changes')."</a><br />";
- }
- if ($config["sendmail"]=="yes") {
- $content .= i18n::translate('Last email reminder was sent ').format_timestamp($LAST_CHANGE_EMAIL)."<br />";
- $content .= i18n::translate('Next email reminder will be sent after ').format_timestamp($LAST_CHANGE_EMAIL+(60*60*24*$config["days"]))."<br /><br />";
- }
- $changes=WT_DB::prepare(
- "SELECT xref".
- " FROM {$TBLPREFIX}change".
- " WHERE status='pending'".
- " AND gedcom_id=?".
- " GROUP BY xref"
- )->execute(array(WT_GED_ID))->fetchAll();
- foreach ($changes as $change) {
- $record=GedcomRecord::getInstance($change->xref);
- if ($record->getType()!='SOUR' || $SHOW_SOURCES>=WT_USER_ACCESS_LEVEL) {
- $content.='<b>'.PrintReady($record->getFullName()).'</b> '.getLRM().'('.$record->getXref().')'.getLRM();
- switch ($record->getType()) {
- case 'INDI':
- case 'FAM':
- case 'SOUR':
- case 'OBJE':
- $content.=$block ? '<br />' : ' ';
- $content.='<a href="'.encode_url($record->getLinkUrl().'&show_changes=yes').'">'.i18n::translate('View Change Diff').'</a>';
- break;
- }
- $content.='<br />';
- }
- }
-
- global $THEME_DIR;
- if ($block) {
- require $THEME_DIR.'templates/block_small_temp.php';
- } else {
- require $THEME_DIR.'templates/block_main_temp.php';
- }
- }
- }
-}
-
-function review_changes_block_config($config) {
- global $WT_BLOCKS;
- if (empty($config)) $config = $WT_BLOCKS["review_changes_block"]["config"];
- print i18n::translate('Send out reminder emails?');
- print "&nbsp;<select name='sendmail'>";
- print "<option value='yes'";
- if ($config["sendmail"]=="yes") print " selected='selected'";
- print ">".i18n::translate('Yes')."</option>";
- print "<option value='no'";
- if ($config["sendmail"]=="no") print " selected='selected'";
- print ">".i18n::translate('No')."</option>";
- print "</select><br /><br />";
- print i18n::translate('Reminder email frequency (days)')."&nbsp;<input type='text' name='days' value='".$config["days"]."' size='2' />";
- // Cache file life
- if ($ctype=="gedcom") {
- echo "<tr><td class=\"descriptionbox wrap width33\">";
- echo i18n::translate('Cache file life'), help_link('cache_life');
- echo "</td><td class=\"optionbox\">";
- echo "<input type=\"text\" name=\"cache\" size=\"2\" value=\"".$config["cache"]."\" />";
- echo "</td></tr>";
- }
- // Cache file life is not configurable by user: anything other than "no cache" doesn't make sense
- print "<input type=\"hidden\" name=\"cache\" value=\"0\" />";
-}
-
-?>
diff --git a/blocks/rss_block.php b/blocks/rss_block.php
deleted file mode 100644
index 032c7e5e83..0000000000
--- a/blocks/rss_block.php
+++ /dev/null
@@ -1,94 +0,0 @@
-<?php
-/**
- * RSS Block
- *
- * This is the RSS block
- *
- * webtrees: Web based Family History software
- * Copyright (C) 2010 webtrees development team.
- *
- * Derived from PhpGedView
- * Copyright (C) 2002 to 2009 PGV Development Team. All rights reserved.
- *
- * Modifications Copyright (c) 2010 Greg Roach
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * @package webtrees
- * @subpackage Blocks
- * @version $Id$
- */
-
-if (!defined('WT_WEBTREES')) {
- header('HTTP/1.0 403 Forbidden');
- exit;
-}
-
-define('WT_RSS_BLOCK_PHP', '');
-
-global $GEDCOM_TITLE;
-
-$WT_BLOCKS['print_RSS_block']=array(
- 'name'=>i18n::translate('RSS Feeds'),
- 'type'=>'gedcom',
- 'descr'=>i18n::translate('News and links from the %s site', $GEDCOM_TITLE),
- 'canconfig'=>false,
- 'config'=>array(
- 'cache'=>0
- )
-);
-/**
- * Print RSS Block
- *
- * Prints a block allowing the user to login to the site directly from the portal
- */
-function print_RSS_block($block = true, $config="", $side, $index) {
- $id="rss_block";
- $title=i18n::translate('RSS Feeds').help_link('rss_feed');
- $content = "<div class=\"center\">";
- $content .= "<form method=\"post\" action=\"\" name=\"rssform\">";
- $content .= "<br />";
- $content .= "<select name=\"rssStyle\" class=\"header_select\" onchange=\"javascript:document.getElementById('rss_button').href = '".encode_url("rss.php?ged=".WT_GEDCOM."&lang=".WT_LOCALE) . "' + (document.rssform.module.value==''? '' : '&module=' + document.rssform.module.value) + (document.rssform.rssStyle.value==''? '' : '&rssStyle=' + document.rssform.rssStyle.value);\">";
- $content .= "<option value=\"ATOM\" selected=\"selected\">ATOM 1.0</option>";
- $content .= "<option value=\"RSS2.0\">RSS 2.0</option>";
- $content .= "<option value=\"RSS1.0\">RSS 1.0</option>";
- $content .= "<option value=\"ATOM0.3\">ATOM 0.3</option>";
- $content .= "<option value=\"RSS0.91\">RSS 0.91</option>";
- $content .= "<option value=\"HTML\">HTML</option>";
- $content .= "<option value=\"JS\">JavaScript</option>";
- $content .= "</select>";
- $content .= "<select name=\"module\" class=\"header_select\" onchange=\"javascript:document.getElementById('rss_button').href = '".encode_url("rss.php?ged=".WT_GEDCOM."&lang=".WT_LOCALE) . "' + (document.rssform.module.value==''? '' : '&module=' + document.rssform.module.value) + (document.rssform.rssStyle.value==''? '' : '&rssStyle=' + document.rssform.rssStyle.value);\">";
- $content .= "<option value=\"\">" . i18n::translate('ALL') . "</option>";
- $content .= "<option value=\"today\">" . i18n::translate('On This Day ...') . " </option>";
- $content .= "<option value=\"upcoming\">" . i18n::translate('Upcoming Events') . "</option>";
- $content .= "<option value=\"gedcomStats\">" . i18n::translate('GEDCOM Statistics') . "</option>";
- $content .= "<option value=\"gedcomNews\">" . i18n::translate('News') . "</option>";
- $content .= "<option value=\"top10Surnames\">" . i18n::translate('Top 10 Surnames') . "</option>";
- $content .= "<option value=\"recentChanges\">" . i18n::translate('Recent Changes') . "</option>";
- $content .= "<option value=\"randomMedia\">" . i18n::translate('Random Picture') . "</option>";
- $content .= "</select>";
- $content .= " <a id=\"rss_button\" href=\"".encode_url("rss.php?ged=".WT_GEDCOM."&lang=".WT_LOCALE) . "\"><img class=\"icon\" src=\"images/feed-icon16x16.png\" alt=\"RSS\" title=\"RSS\" /></a>";
- $content .= "</form></div>";
- $content .= "<div class=\"center\">";
- $content .= "</div>";
-
- global $THEME_DIR;
- if ($block) {
- require $THEME_DIR.'templates/block_small_temp.php';
- } else {
- require $THEME_DIR.'templates/block_main_temp.php';
- }
-}
-?>
diff --git a/blocks/theme_select.php b/blocks/theme_select.php
deleted file mode 100644
index 904ed1d1f3..0000000000
--- a/blocks/theme_select.php
+++ /dev/null
@@ -1,65 +0,0 @@
-<?php
-/**
- * Theme Select Block
- *
- * This block will print a form that allows the visitor to change the theme
- *
- * webtrees: Web based Family History software
- * Copyright (C) 2010 webtrees development team.
- *
- * Derived from PhpGedView
- * Copyright (C) 2002 to 2009 PGV Development Team. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * @package webtrees
- * @subpackage Blocks
- * @version $Id$
- */
-
-if (!defined('WT_WEBTREES')) {
- header('HTTP/1.0 403 Forbidden');
- exit;
-}
-
-define('WT_THEME_SELECT_PHP', '');
-
-$WT_BLOCKS['print_block_theme_select']=array(
- 'name'=>i18n::translate('Theme Select'),
- 'type'=>'gedcom',
- 'descr'=>i18n::translate('The Theme Select block displays the Theme selector even when the Change Theme feature is disabled.'),
- 'canconfig'=>false,
- 'config'=>array(
- 'cache'=>-1
- )
-);
-
-function print_block_theme_select($style=0, $config="", $side, $index) {
- global $ALLOW_THEME_DROPDOWN, $ALLOW_USER_THEMES, $THEME_DIR, $themeformcount;
-
- $id="theme_select";
- $title=i18n::translate('Change Theme').help_link('change_theme');
-
- $theme_menu=MenuBar::getThemeMenu();
- $content='<div class="center theme_form"><br />'.$theme_menu->getMenuAsDropdown().'<br /<br /></div>';
-
- global $THEME_DIR;
- if ($style) {
- require $THEME_DIR.'templates/block_small_temp.php';
- } else {
- require $THEME_DIR.'templates/block_main_temp.php';
- }
-}
-?>
diff --git a/blocks/todays_events.php b/blocks/todays_events.php
deleted file mode 100644
index 09e36dedfe..0000000000
--- a/blocks/todays_events.php
+++ /dev/null
@@ -1,191 +0,0 @@
-<?php
-/**
- * On This Day Events Block
- *
- * This block will print a list of today's events
- *
- * webtrees: Web based Family History software
- * Copyright (C) 2010 webtrees development team.
- *
- * Derived from PhpGedView
- * Copyright (C) 2002 to 2009 PGV Development Team. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * @package webtrees
- * @subpackage Blocks
- * @version $Id$
- */
-
-if (!defined('WT_WEBTREES')) {
- header('HTTP/1.0 403 Forbidden');
- exit;
-}
-
-define('WT_TODAYS_EVENTS_PHP', '');
-
-require_once WT_ROOT.'includes/functions/functions_print_lists.php';
-
-$WT_BLOCKS['print_todays_events']=array(
- 'name'=>i18n::translate('On This Day'),
- 'type'=>'both',
- 'descr'=>i18n::translate('The On This Day, in Your History... block shows anniversaries of events for today. You can configure the amount of detail shown.'),
- 'canconfig'=>true,
- 'config'=>array(
- 'cache'=>1,
- 'filter'=>'all',
- 'onlyBDM'=>'no',
- 'infoStyle'=>'style2',
- 'sortStyle'=>'alpha',
- 'allowDownload'=>'yes'
- )
-);
-
-//-- today's events block
-//-- this block prints a list of today's upcoming events of living people in your gedcom
-function print_todays_events($block=true, $config="", $side, $index) {
- global $SHOW_ID_NUMBERS, $ctype, $TEXT_DIRECTION;
- global $WT_IMAGE_DIR, $WT_IMAGES, $WT_BLOCKS;
-
- $block = true; // Always restrict this block's height
-
- $todayjd=client_jd();
-
- if (empty($config)) $config = $WT_BLOCKS["print_todays_events"]["config"];
- if (isset($config["filter"])) $filter = $config["filter"]; // "living" or "all"
- else $filter = "all";
- if (isset($config["onlyBDM"])) $onlyBDM = $config["onlyBDM"]; // "yes" or "no"
- else $onlyBDM = "no";
- if (isset($config["infoStyle"])) $infoStyle = $config["infoStyle"]; // "style1" or "style2"
- else $infoStyle = "style2";
- if (isset($config["sortStyle"])) $sortStyle = $config["sortStyle"]; // "alpha" or "anniv"
- else $sortStyle = "alpha";
- if (isset($config["allowDownload"])) $allowDownload = $config["allowDownload"]; // "yes" or "no"
- else $allowDownload = "yes";
-
- // Don't permit calendar download if not logged in
- if (!WT_USER_ID) $allowDownload = "no";
-
- //-- Start output
- $id ="on_this_day_events";
- $title='';
- if ($WT_BLOCKS["print_todays_events"]["canconfig"]) {
- if ($ctype=="gedcom" && WT_USER_GEDCOM_ADMIN || $ctype=="user" && WT_USER_ID) {
- if ($ctype=="gedcom") {
- $name = WT_GEDCOM;
- } else {
- $name = WT_USER_NAME;
- }
- $title .= "<a href=\"javascript: configure block\" onclick=\"window.open('".encode_url("index_edit.php?name={$name}&ctype={$ctype}&action=configure&side={$side}&index={$index}")."', '_blank', 'top=50,left=50,width=600,height=350,scrollbars=1,resizable=1'); return false;\">";
- $title .= "<img class=\"adminicon\" src=\"$WT_IMAGE_DIR/".$WT_IMAGES["admin"]["small"]."\" width=\"15\" height=\"15\" border=\"0\" alt=\"".i18n::translate('Configure')."\" /></a>";
- }
- }
- $title .= i18n::translate('On This Day ...');
- $title .= help_link('index_onthisday');
-
- $content = "";
- switch ($infoStyle) {
- case "style1":
- // Output style 1: Old format, no visible tables, much smaller text. Better suited to right side of page.
- $content .= print_events_list($todayjd, $todayjd, $onlyBDM=='yes'?'BIRT MARR DEAT':'', $filter=='living', $sortStyle);
- break;
- case "style2":
- // Style 2: New format, tables, big text, etc. Not too good on right side of page
- ob_start();
- $content .= print_events_table($todayjd, $todayjd, $onlyBDM=='yes'?'BIRT MARR DEAT':'', $filter=='living', $allowDownload=='yes', $sortStyle);
- $content .= ob_get_clean();
- break;
- }
-
- global $THEME_DIR;
- if ($block) {
- require $THEME_DIR.'templates/block_small_temp.php';
- } else {
- require $THEME_DIR.'templates/block_main_temp.php';
- }
-}
-
-function print_todays_events_config($config) {
- global $WT_BLOCKS;
- if (empty($config)) $config = $WT_BLOCKS["print_todays_events"]["config"];
- if (!isset($config["filter"])) $config["filter"] = "all";
- if (!isset($config["onlyBDM"])) $config["onlyBDM"] = "no";
- if (!isset($config["infoStyle"])) $config["infoStyle"] = "style2";
- if (!isset($config["sortStyle"])) $config["sortStyle"] = "alpha";
- if (!isset($config["allowDownload"])) $config["allowDownload"] = "yes";
-
- ?>
- <tr><td class="descriptionbox wrap width33">
- <?php
- print i18n::translate('Show only events of living people?');
- ?>
- </td><td class="optionbox">
- <select name="filter">
- <option value="all"<?php if ($config["filter"]=="all") print " selected=\"selected\"";?>><?php print i18n::translate('No'); ?></option>
- <option value="living"<?php if ($config["filter"]=="living") print " selected=\"selected\"";?>><?php print i18n::translate('Yes'); ?></option>
- </select>
- </td></tr>
-
- <tr><td class="descriptionbox wrap width33">
- <?php
- print i18n::translate('Show only Births, Deaths, and Marriages?');
- print help_link('basic_or_all');
- ?>
- </td><td class="optionbox">
- <select name="onlyBDM">
- <option value="no"<?php if ($config["onlyBDM"]=="no") print " selected=\"selected\"";?>><?php print i18n::translate('No'); ?></option>
- <option value="yes"<?php if ($config["onlyBDM"]=="yes") print " selected=\"selected\"";?>><?php print i18n::translate('Yes'); ?></option>
- </select>
- </td></tr>
-
- <tr><td class="descriptionbox wrap width33">
- <?php
- print i18n::translate('Presentation Style');
- print help_link('style');
- ?>
- </td><td class="optionbox">
- <select name="infoStyle">
- <option value="style1"<?php if ($config["infoStyle"]=="style1") print " selected=\"selected\"";?>><?php print i18n::translate('List'); ?></option>
- <option value="style2"<?php if ($config["infoStyle"]=="style2") print " selected=\"selected\"";?>><?php print i18n::translate('Table'); ?></option>
- </select>
- </td></tr>
-
- <tr><td class="descriptionbox wrap width33">
- <?php
- print i18n::translate('Sort Style');
- print help_link('sort_style');
- ?>
- </td><td class="optionbox">
- <select name="sortStyle">
- <option value="alpha"<?php if ($config["sortStyle"]=="alpha") print " selected=\"selected\"";?>><?php print i18n::translate('Alphabetically'); ?></option>
- <option value="anniv"<?php if ($config["sortStyle"]=="anniv") print " selected=\"selected\"";?>><?php print i18n::translate('By Anniversary'); ?></option>
- </select>
- </td></tr>
-
- <tr><td class="descriptionbox wrap width33">
- <?php
- print i18n::translate('Allow calendar events download?');
- print help_link('cal_dowload');
- ?>
- </td><td class="optionbox">
- <select name="allowDownload">
- <option value="yes"<?php if ($config["allowDownload"]=="yes") print " selected=\"selected\"";?>><?php print i18n::translate('Yes'); ?></option>
- <option value="no"<?php if ($config["allowDownload"]=="no") print " selected=\"selected\"";?>><?php print i18n::translate('No'); ?></option>
- </select>
- <input type="hidden" name="cache" value="1" />
- </td></tr>
- <?php
-}
-?>
diff --git a/blocks/todo.php b/blocks/todo.php
deleted file mode 100644
index ecd1746c95..0000000000
--- a/blocks/todo.php
+++ /dev/null
@@ -1,159 +0,0 @@
-<?php
-/**
- * TODO Block
- *
- * This block will print a list of things to do, based on _TODO records
- *
- * webtrees: Web based Family History software
- * Copyright (C) 2010 webtrees development team.
- *
- * Derived from PhpGedView
- * Copyright (C) 2008 PGV Development Team. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * @package webtrees
- * @subpackage Blocks
- * @author Greg Roach, fisharebest@users.sourceforge.net
- * @version $Id$
- */
-
-if (!defined('WT_WEBTREES')) {
- header('HTTP/1.0 403 Forbidden');
- exit;
-}
-
-define('WT_TODO_PHP', '');
-
-require_once WT_ROOT.'includes/functions/functions_print_lists.php';
-require_once WT_ROOT.'includes/functions/functions_edit.php';
-
-$WT_BLOCKS['print_todo']=array(
- 'name'=>i18n::translate('&quot;To Do&quot; tasks'),
- 'type'=>'both',
- 'descr'=>i18n::translate('The To Do block lists all outstanding _TODO facts in the database.'),
- 'canconfig'=>true,
- 'config'=>array(
- 'cache' =>0,
- 'show_unassigned'=>true, // show unassigned items
- 'show_other' =>false, // show items assigned to other users
- 'show_future' =>false // show items with a future date
- )
-);
-
-// this block prints a list of _TODO events in your gedcom
-function print_todo($block=true, $config='', $side, $index) {
- global $ctype, $WT_IMAGE_DIR, $WT_IMAGES, $WT_BLOCKS;
-
- $block=true; // Always restrict this block's height
-
- if (empty($config)) {
- $config=$WT_BLOCKS['print_todo']['config'];
- }
-
- $id='todo';
- $title='';
- if ($WT_BLOCKS['print_todo']['canconfig']) {
- if ($ctype=='gedcom' && WT_USER_GEDCOM_ADMIN || $ctype=='user' && WT_USER_ID) {
- if ($ctype=='gedcom') {
- $name = WT_GEDCOM;
- } else {
- $name = WT_USER_NAME;
- }
- $title .= "<a href=\"javascript: configure block\" onclick=\"window.open('".encode_url("index_edit.php?name={$name}&ctype={$ctype}&action=configure&side={$side}&index={$index}")."', '_blank', 'top=50,left=50,width=600,height=350,scrollbars=1,resizable=1'); return false;\">";
- $title .= "<img class=\"adminicon\" src=\"{$WT_IMAGE_DIR}/{$WT_IMAGES['admin']['small']}\" width=\"15\" height=\"15\" border=\"0\" alt=\"".i18n::translate('Configure')."\" /></a>";
- }
- }
- $title.=i18n::translate('&quot;To Do&quot; tasks').help_link('todo');
- $content='';
-
- require_once WT_ROOT.'js/sorttable.js.htm';
- require_once WT_ROOT.'includes/classes/class_gedcomrecord.php';
-
- $table_id = 'ID'.floor(microtime()*1000000); // sorttable requires a unique ID
- $content .= '<table id="'.$table_id.'" class="sortable list_table center">';
- $content .= '<tr>';
- $content .= '<th class="list_label">'.i18n::translate('DATE').'</th>';
- $content .= '<th class="list_label">'.i18n::translate('Record').'</th>';
- if ($config['show_unassigned']=='yes' || $config['show_other']=='yes') {
- $content .= '<th class="list_label">'.i18n::translate('User name').'</th>';
- }
- $content .= '<th class="list_label">'.i18n::translate('TEXT').'</th>';
- $content .= '</tr>';
-
- $found=false;
- $end_jd=$config['show_future']=='yes' ? 99999999 : client_jd();
- foreach (get_calendar_events(0, $end_jd, '_TODO', WT_GED_ID) as $todo) {
- $record=GedcomRecord::getInstance($todo['id']);
- if ($record && $record->canDisplayDetails()) {
- $pgvu=get_gedcom_value('_WT_USER', 2, $todo['factrec']);
- if ($pgvu==WT_USER_NAME || !$pgvu && $config['show_unassigned']=='yes' || $pgvu && $config['show_other']=='yes') {
- $content.='<tr valign="top">';
- $content.='<td class="list_value_wrap">'.str_replace('<a', '<a name="'.$todo['date']->MinJD().'"', $todo['date']->Display(false)).'</td>';
- $name=$record->getListName();
- $content.='<td class="list_value_wrap" align="'.get_align(WT_GEDCOM).'"><a href="'.encode_url($record->getLinkUrl()).'">'.PrintReady($name).'</a></td>';
- if ($config['show_unassigned']=='yes' || $config['show_other']=='yes') {
- $content.='<td class="list_value_wrap">'.$pgvu.'</td>';
- }
- $text=get_gedcom_value('_TODO', 1, $todo['factrec']);
- $content.='<td class="list_value_wrap" align="'.get_align($text).'">'.PrintReady($text).'</td>';
- $content.='</tr>';
- $found=true;
- }
- }
- }
-
- $content .= '</table>';
- if (!$found) {
- $content.='<p>'.i18n::translate('There are no &quot;To Do&quot; tasks.').'</p>';
- }
-
- global $THEME_DIR;
- if ($block) {
- require $THEME_DIR.'templates/block_small_temp.php';
- } else {
- require $THEME_DIR.'templates/block_main_temp.php';
- }
-}
-
-function print_todo_config($config) {
- global $WT_BLOCKS, $DAYS_TO_SHOW_LIMIT;
-
- if (empty($config)) {
- $config=$WT_BLOCKS['print_todo']['config'];
- }
-
- echo '<tr><td class="descriptionbox wrap width33">';
- echo i18n::translate('Show other users\' tasks'), help_link('todo_show_other');
- echo '</td><td class="optionbox">';
- echo edit_field_yes_no('show_other', $config['show_other']);
- echo '</td></tr>';
-
- echo '<tr><td class="descriptionbox wrap width33">';
- echo i18n::translate('Show unassigned tasks'), help_link('todo_show_unassigned');
- echo '</td><td class="optionbox">';
- echo edit_field_yes_no('show_other', $config['show_unassigned']);
- echo '</td></tr>';
-
- echo '<tr><td class="descriptionbox wrap width33">';
- echo i18n::translate('Show future tasks'), help_link('todo_show_future');
- echo '</td><td class="optionbox">';
- echo edit_field_yes_no('show_other', $config['show_future']);
- echo '</td></tr>';
-
- // Cache file life is not configurable by user
- echo '<input type="hidden" name="cache" value="0" />';
-}
-?>
diff --git a/blocks/top10_givnnames.php b/blocks/top10_givnnames.php
deleted file mode 100644
index 6215ec1084..0000000000
--- a/blocks/top10_givnnames.php
+++ /dev/null
@@ -1,168 +0,0 @@
-<?php
-/**
- * Top 10 Given Names Block
- *
- * This block will show the top 10 given names that occur most frequently in the active gedcom
- *
- * webtrees: Web based Family History software
- * Copyright (C) 2010 webtrees development team.
- *
- * Derived from PhpGedView
- * Copyright (C) 2008 PGV Development Team. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License or,
- * at your discretion, any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * @version $Id$
- * @author kiwi_pgv
- * @package webtrees
- * @subpackage Blocks
- */
-
-if (!defined('WT_WEBTREES')) {
- header('HTTP/1.0 403 Forbidden');
- exit;
-}
-
-define('WT_TOP10_GIVNNAMES_PHP', '');
-
-$WT_BLOCKS['print_block_givn_top10']=array(
- 'name'=>i18n::translate('Top 10 Given Names'),
- 'type'=>'both',
- 'descr'=>i18n::translate('This block shows a table of the 10 most frequently occurring given names in the database. The actual number of given names shown in this block is configurable.'),
- 'canconfig'=>true,
- 'config'=>array(
- 'cache'=>7,
- 'num'=>10,
- 'infoStyle'=>'style2',
- 'showUnknown'=>true
- )
-);
-
-/**
- * Print First Names Block
- */
-function print_block_givn_top10($block=true, $config="", $side, $index) {
- global $TEXT_DIRECTION, $WT_BLOCKS, $ctype, $WT_IMAGES, $WT_IMAGE_DIR;
-
- if (empty($config)) $config = $WT_BLOCKS["print_block_givn_top10"]["config"];
- if (isset($config["infoStyle"])) $infoStyle = $config["infoStyle"]; // "style1" or "style2"
- else $infoStyle = "style2";
- if (isset($config["showUnknown"])) $showUnknown = $config["showUnknown"];
- else $showUnknown = true;
-
- $stats=new Stats(WT_GEDCOM);
-
- //Print block header
-
- $id="top10givennames";
- $title='';
- if ($WT_BLOCKS["print_block_givn_top10"]["canconfig"]) {
- if ($ctype=="gedcom" && WT_USER_GEDCOM_ADMIN || $ctype=="user" && WT_USER_ID) {
- if ($ctype=="gedcom") {
- $name = WT_GEDCOM;
- } else {
- $name = WT_USER_NAME;
- }
- $title .= "<a href=\"javascript: configure block\" onclick=\"window.open('".encode_url("index_edit.php?name={$name}&ctype={$ctype}&action=configure&side={$side}&index={$index}")."', '_blank', 'top=50,left=50,width=600,height=350,scrollbars=1,resizable=1'); return false;\">";
- $title .= "<img class=\"adminicon\" src=\"$WT_IMAGE_DIR/".$WT_IMAGES["admin"]["small"]."\" width=\"15\" height=\"15\" border=\"0\" alt=\"".i18n::translate('Configure')."\" /></a>";
- }
- }
- // I18N: There are separate lists of male/female names, containing %d names each
- $title .= i18n::plural('Top Given Name', 'Top %d Given Names', $config['num'], $config['num']);
- $title .= help_link('index_common_given_names');
-
- $content = '<div class="normal_inner_block">';
- //Select List or Table
- switch ($infoStyle) {
- case "style1": // Output style 1: Simple list style. Better suited to left side of page.
- if ($TEXT_DIRECTION=='ltr') $padding = 'padding-left: 15px';
- else $padding = 'padding-right: 15px';
- $params=array(1,$config['num'],'rcount');
- //List Female names
- $totals=$stats->commonGivenFemaleTotals($params);
- if ($totals) {
- $content.='<b>'.i18n::translate('Female').'</b><div class="wrap" style="'.$padding.'">'.$totals.'</div><br />';
- }
- //List Male names
- $totals=$stats->commonGivenMaleTotals($params);
- if ($totals) {
- $content.='<b>'.i18n::translate('Male').'</b><div class="wrap" style="'.$padding.'">'.$totals.'</div><br />';
- }
- //List Unknown names
- $totals=$stats->commonGivenUnknownTotals($params);
- if ($totals && $showUnknown) {
- $content.='<b>'.i18n::translate('unknown').'</b><div class="wrap" style="'.$padding.'">'.$totals.'</div><br />';
- }
- break;
- case "style2": // Style 2: Tabular format. Narrow, 2 or 3 column table, good on right side of page
- $params=array(1,$config['num'],'rcount');
- $content.='<table class="center"><tr valign="top"><td>'.$stats->commonGivenFemaleTable($params).'</td>';
- $content.='<td>'.$stats->commonGivenMaleTable($params).'</td>';
- if ($showUnknown) {
- $content.='<td>'.$stats->commonGivenUnknownTable($params).'</td>';
- }
- $content.='</tr></table>';
- break;
- }
- $content .= "</div>";
-
- global $THEME_DIR;
- if ($block) {
- require $THEME_DIR.'templates/block_small_temp.php';
- } else {
- require $THEME_DIR.'templates/block_main_temp.php';
- }
-}
-
-function print_block_givn_top10_config($config) {
- global $ctype, $WT_BLOCKS, $TEXT_DIRECTION;
- if (empty($config)) $config = $WT_BLOCKS["print_block_givn_top10"]["config"];
- if (!isset($config["cache"])) $config["cache"] = $WT_BLOCKS["print_block_givn_top10"]["config"]["cache"];
- if (!isset($config["infoStyle"])) $config["infoStyle"] = "style2";
- if (!isset($config["showUnknown"])) $config["showUnknown"] = true;
-
- print "<tr><td class=\"descriptionbox wrap width33\">".i18n::translate('Number of items to show')."</td>";?>
- <td class="optionbox">
- <input type="text" name="num" size="2" value="<?php print $config["num"]; ?>" />
- </td></tr>
-
- <tr><td class="descriptionbox wrap width33">
- <?php
- print i18n::translate('Presentation Style');
- print help_link('style');
- ?>
- </td><td class="optionbox">
- <select name="infoStyle">
- <option value="style1"<?php if ($config["infoStyle"]=="style1") print " selected=\"selected\"";?>><?php print i18n::translate('List'); ?></option>
- <option value="style2"<?php if ($config["infoStyle"]=="style2") print " selected=\"selected\"";?>><?php print i18n::translate('Table'); ?></option>
- </select>
- </td></tr>
-
- <tr><td class="descriptionbox wrap width33">
- <?php
- echo i18n::translate('Show unknown gender'), help_link('showUnknown');
- echo '</td><td class="optionbox">';
- echo edit_field_yes_no('showUnknown', $config['showUnknown']);
- echo '</td></tr>';
- // Cache file life
- if ($ctype=="gedcom") {
- echo '<tr><td class="descriptionbox wrap width33">';
- echo i18n::translate('Cache file life'), help_link('cache_life');
- echo '</td><td class="optionbox">';
- echo '<input type="text" name="cache" size="2" value="', $config['cache'], '" />';
- echo '</td></tr>';
- }
-}
-?>
diff --git a/blocks/top10_pageviews.php b/blocks/top10_pageviews.php
deleted file mode 100644
index 8ec35de56e..0000000000
--- a/blocks/top10_pageviews.php
+++ /dev/null
@@ -1,167 +0,0 @@
-<?php
-/**
- * Top 10 Pageviews Block
- *
- * This block will show the top 10 records from the Gedcom that have been viewed the most
- *
- * webtrees: Web based Family History software
- * Copyright (C) 2010 webtrees development team.
- *
- * Derived from PhpGedView
- * Copyright (C) 2002 to 2009 PGV Development Team. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * @package webtrees
- * @subpackage Blocks
- * @version $Id$
- */
-
-if (!defined('WT_WEBTREES')) {
- header('HTTP/1.0 403 Forbidden');
- exit;
-}
-
-define('WT_TOP10_PAGEVIEWS_PHP', '');
-
-$WT_BLOCKS['top10_pageviews']=array(
- 'name'=>i18n::translate('Most Viewed Items'),
- 'type'=>'both',
- 'descr'=>i18n::translate('This block will show the 10 records that have been viewed the most. This block requires that Hit Counters be enabled in the GEDCOM configuration settings.'),
- 'canconfig'=>true,
- 'config'=>array(
- 'cache'=>1,
- 'num'=>10,
- 'count_placement'=>'left'
- )
-);
-
-function top10_pageviews($block=true, $config="", $side, $index) {
- global $TBLPREFIX, $INDEX_DIRECTORY, $WT_BLOCKS, $ctype, $WT_IMAGES, $WT_IMAGE_DIR, $SHOW_COUNTER, $SHOW_SOURCES, $TEXT_DIRECTION;
-
- if (empty($config)) {
- $config = $WT_BLOCKS["top10_pageviews"]["config"];
- }
-
- if (isset($config["count_placement"])) {
- $CountSide = $config["count_placement"];
- } else {
- $CountSide = "left";
- }
-
- $id = "top10hits";
- $title='';
- if ($WT_BLOCKS["top10_pageviews"]["canconfig"]) {
- if ($ctype=="gedcom" && WT_USER_GEDCOM_ADMIN || $ctype=="user" && WT_USER_ID) {
- if ($ctype=="gedcom") {
- $name = WT_GEDCOM;
- } else {
- $name = WT_USER_NAME;
- }
- $title .= "<a href=\"javascript: configure block\" onclick=\"window.open('".encode_url("index_edit.php?name={$name}&ctype={$ctype}&action=configure&side={$side}&index={$index}")."', '_blank', 'top=50,left=50,width=600,height=350,scrollbars=1,resizable=1'); return false;\">";
- $title .= "<img class=\"adminicon\" src=\"$WT_IMAGE_DIR/".$WT_IMAGES["admin"]["small"]."\" width=\"15\" height=\"15\" border=\"0\" alt=\"".i18n::translate('Configure')."\" /></a>";
- }
- }
- $title .= i18n::translate('Most Viewed Items');
- $title .= help_link('index_top10_pageviews');
- $content = "";
-
- // if the counter file does not exist then don't do anything
- if (!$SHOW_COUNTER) {
- if (WT_USER_IS_ADMIN) {
- $content .= "<span class=\"error\">".i18n::translate('Hit counters must be enabled in the GEDCOM configuration, Display and Layout section, Hide and Show group.')."</span>";
- }
- } else {
- // load the lines from the file
- $top10=WT_DB::prepareLimit(
- "SELECT page_parameter, page_count".
- " FROM {$TBLPREFIX}hit_counter".
- " WHERE gedcom_id=? AND page_name IN ('individual.php','family.php','source.php','repo.php','note.php','mediaviewer.php')".
- " ORDER BY page_count DESC",
- $config['num']
- )->execute(array(WT_GED_ID))->FetchAssoc();
-
-
- if ($top10) {
- if ($block) {
- $content .= "<table width=\"90%\">";
- } else {
- $content .= "<table>";
- }
- foreach ($top10 as $id=>$count) {
- $record=GedcomRecord::getInstance($id);
- if ($record && $record->canDisplayDetails()) {
- $content .= '<tr valign="top">';
- if ($CountSide=='left') {
- $content .= '<td dir="ltr" align="right">['.$count.']</td>';
- }
- $content .= '<td class="name2" ><a href="'.encode_url($record->getLinkUrl()).'">'.PrintReady($record->getFullName()).'</a></td>';
- if ($CountSide=='right') {
- $content .= '<td dir="ltr" align="right">['.$count.']</td>';
- }
- $content .= '</tr>';
- }
- }
- $content .= "</table>";
- } else {
- $content .= "<b>".i18n::translate('There are currently no hits to show.')."</b>";
- }
- }
-
- global $THEME_DIR;
- if ($block) {
- require $THEME_DIR.'templates/block_small_temp.php';
- } else {
- require $THEME_DIR.'templates/block_main_temp.php';
- }
-}
-
-function top10_pageviews_config($config) {
- global $ctype, $WT_BLOCKS;
- if (empty($config)) $config = $WT_BLOCKS["top10_pageviews"]["config"];
- if (!isset($config["cache"])) $config["cache"] = $WT_BLOCKS["top10_pageviews"]["config"]["cache"];
-
- // Number of items to show
- print "<tr><td class=\"descriptionbox wrap width33\">";
- print i18n::translate('Number of items to show');
- print "</td><td class=\"optionbox\">";
- print "<input type=\"text\" name=\"num\" size=\"2\" value=\"".$config["num"]."\" />";
- print "</td></tr>";
-
- // Count position
- print "<tr><td class=\"descriptionbox wrap width33\">";
- print i18n::translate('Place counts before or after name?');
- print "</td><td class=\"optionbox\">";
- print "<select name=\"count_placement\">";
- print "<option value=\"left\"";
- if ($config["count_placement"]=="left") print " selected=\"selected\"";
- print ">".i18n::translate('before')."</option>";
- print "<option value=\"right\"";
- if ($config["count_placement"]=="right") print " selected=\"selected\"";
- print ">".i18n::translate('after')."</option>";
- print "</select>";
- print "</td></tr>";
-
- // Cache file life
- if ($ctype=="gedcom") {
- print "<tr><td class=\"descriptionbox wrap width33\">";
- print i18n::translate('Cache file life');
- print help_link('cache_life');
- print "</td><td class=\"optionbox\">";
- print "<input type=\"text\" name=\"cache\" size=\"2\" value=\"".$config["cache"]."\" />";
- print "</td></tr>";
- }
-}
-?>
diff --git a/blocks/top10_surnames.php b/blocks/top10_surnames.php
deleted file mode 100644
index 97423cb8e0..0000000000
--- a/blocks/top10_surnames.php
+++ /dev/null
@@ -1,168 +0,0 @@
-<?php
-/**
- * Top 10 Surnames Block
- *
- * This block will show the top 10 surnames that occur most frequently in the active gedcom
- *
- * webtrees: Web based Family History software
- * Copyright (C) 2010 webtrees development team.
- *
- * Derived from PhpGedView
- * Copyright (C) 2002 to 2009 PGV Development Team. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * @version $Id$
- * @package webtrees
- * @subpackage Blocks
- */
-
-if (!defined('WT_WEBTREES')) {
- header('HTTP/1.0 403 Forbidden');
- exit;
-}
-
-define('WT_TOP10SURNAMES_PHP', '');
-
-$WT_BLOCKS['print_block_name_top10']=array(
- 'name'=>i18n::translate('Top 10 Surnames'),
- 'type'=>'both',
- 'descr'=>i18n::translate('This block shows a table of the 10 most frequently occurring surnames in the database. The actual number of surnames shown in this block is configurable. You can configure the GEDCOM to remove names from this list.'),
- 'canconfig'=>true,
- 'config'=>array(
- 'cache'=>7,
- 'num'=>10,
- )
-);
-
-function top_surname_sort($a, $b) {
- $counta=0;
- foreach ($a as $x) {
- $counta+=count($x);
- }
- $countb=0;
- foreach ($b as $x) {
- $countb+=count($x);
- }
- return $countb - $counta;
-}
-
-function print_block_name_top10($block=true, $config="", $side, $index) {
- global $COMMON_NAMES_ADD, $COMMON_NAMES_REMOVE, $COMMON_NAMES_THRESHOLD, $WT_BLOCKS, $ctype, $WT_IMAGES, $WT_IMAGE_DIR, $SURNAME_LIST_STYLE;
-
- if (empty($config)) {
- $config=$WT_BLOCKS["print_block_name_top10"]["config"];
- }
-
- // This next function is a bit out of date, and doesn't cope well with surname variants
- $top_surnames=get_top_surnames(WT_GED_ID, 1, $config["num"]);
-
- $all_surnames=array();
- foreach (array_keys($top_surnames) as $top_surname) {
- $all_surnames=array_merge($all_surnames, get_indilist_surns($top_surname, '', false, false, WT_GED_ID));
- }
-
- // Insert from the "Add Names" list if not already in there
- if ($COMMON_NAMES_ADD) {
- foreach (preg_split('/[,; ]+/', $COMMON_NAMES_ADD) as $addname) {
- $ADDNAME=utf8_strtoupper($addname);
- if (isset($all_surnames[$ADDNAME])) {
- $SURNAME=$ADDNAME;
- foreach (array_keys($all_surnames[$ADDNAME]) as $surname) {
- if ($SURNAME!=$surname && $SURNAME==utf8_strtoupper($surname)) {
- $all_surnames[$ADDNAME][$SURNAME]=$all_surnames[$ADDNAME][$surname];
- unset ($all_surnames[$ADDNAME][$surname]);
- }
- }
- if (isset($all_surnames[$ADDNAME][$SURNAME])) {
- $n=count($all_surnames[$ADDNAME][$SURNAME]);
- $all_surnames[$ADDNAME][$SURNAME]=array_fill(0, max($n, $COMMON_NAMES_THRESHOLD), true);
- } else {
- $all_surnames[$ADDNAME][$SURNAME]=array_fill(0, $COMMON_NAMES_THRESHOLD, true);
- }
- } else {
- $all_surnames[$ADDNAME][$ADDNAME]=array_fill(0, $COMMON_NAMES_THRESHOLD, true);
- }
- }
- }
-
- // Remove names found in the "Remove Names" list
- if ($COMMON_NAMES_REMOVE) {
- foreach (preg_split("/[,; ]+/", $COMMON_NAMES_REMOVE) as $delname) {
- unset($all_surnames[utf8_strtoupper($delname)]);
- }
- }
-
- $id="top10surnames";
- $title='';
- if ($WT_BLOCKS["print_block_name_top10"]["canconfig"]) {
- if ($ctype=="gedcom" && WT_USER_GEDCOM_ADMIN || $ctype=="user" && WT_USER_ID) {
- if ($ctype=="gedcom") {
- $name = WT_GEDCOM;
- } else {
- $name = WT_USER_NAME;
- }
- $title .= "<a href=\"javascript: configure block\" onclick=\"window.open('".encode_url("index_edit.php?name={$name}&ctype={$ctype}&action=configure&side={$side}&index={$index}")."', '_blank', 'top=50,left=50,width=600,height=350,scrollbars=1,resizable=1'); return false;\">";
- $title .= "<img class=\"adminicon\" src=\"$WT_IMAGE_DIR/".$WT_IMAGES["admin"]["small"]."\" width=\"15\" height=\"15\" border=\"0\" alt=\"".i18n::translate('Configure')."\" /></a>";
- }
- }
- // I18N: There are separate lists of male/female names, containing %d names each
- $title .= i18n::plural('Top surname', 'Top %d surnames', $config['num'], $config['num']);
- $title .= help_link('index_common_names');
-
- switch ($SURNAME_LIST_STYLE) {
- case 'style3':
- uksort($all_surnames,'utf8_strcasecmp');
- $content=format_surname_tagcloud($all_surnames, 'indilist', true);
- break;
- case 'style2':
- default:
- uasort($all_surnames, "top_surname_sort");
- $content=format_surname_table($all_surnames, 'indilist');
- break;
- }
-
- global $THEME_DIR;
- if ($block) {
- require $THEME_DIR.'templates/block_small_temp.php';
- } else {
- require $THEME_DIR.'templates/block_main_temp.php';
- }
-}
-
-function print_block_name_top10_config($config) {
- global $ctype, $WT_BLOCKS;
- if (empty($config)) $config = $WT_BLOCKS["print_block_name_top10"]["config"];
- if (!isset($config["cache"])) $config["cache"] = $WT_BLOCKS["print_block_name_top10"]["config"]["cache"];
-?>
- <tr>
- <td class="descriptionbox wrap width33"><?php print i18n::translate('Number of items to show') ?></td>
- <td class="optionbox">
- <input type="text" name="num" size="2" value="<?php print $config["num"]; ?>" />
- </td></tr>
-
- <?php
-
- // Cache file life
- if ($ctype=="gedcom") {
- print "<tr><td class=\"descriptionbox wrap width33\">";
- print i18n::translate('Cache file life');
- print help_link('cache_life');
- print "</td><td class=\"optionbox\">";
- print "<input type=\"text\" name=\"cache\" size=\"2\" value=\"".$config["cache"]."\" />";
- print "</td></tr>";
- }
-}
-?>
diff --git a/blocks/upcoming_events.php b/blocks/upcoming_events.php
deleted file mode 100644
index 77800313a1..0000000000
--- a/blocks/upcoming_events.php
+++ /dev/null
@@ -1,216 +0,0 @@
-<?php
-/**
- * On Upcoming Events Block
- *
- * This block will print a list of upcoming events
- *
- * webtrees: Web based Family History software
- * Copyright (C) 2010 webtrees development team.
- *
- * Derived from PhpGedView
- * Copyright (C) 2002 to 2009 PGV Development Team. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * @package webtrees
- * @subpackage Blocks
- * @version $Id$
- */
-
-if (!defined('WT_WEBTREES')) {
- header('HTTP/1.0 403 Forbidden');
- exit;
-}
-
-define('WT_UPCOMING_EVENTS_PHP', '');
-
-require_once WT_ROOT.'includes/functions/functions_print_lists.php';
-
-$WT_BLOCKS['print_upcoming_events']=array(
- 'name'=>i18n::translate('Upcoming Events'),
- 'type'=>'both',
- 'descr'=>i18n::translate('The Upcoming Events block shows anniversaries of events that will occur in the near future. You can configure the amount of detail shown, and the administrator can configure how far into the future this block will look.'),
- 'canconfig'=>true,
- 'config'=>array(
- 'cache'=>1,
- 'days'=>30,
- 'filter'=>'all',
- 'onlyBDM'=>'no',
- 'infoStyle'=>'style2',
- 'sortStyle'=>'alpha',
- 'allowDownload'=>'yes'
- )
-);
-
-//-- upcoming events block
-//-- this block prints a list of upcoming events of people in your gedcom
-function print_upcoming_events($block=true, $config="", $side, $index) {
- global $SHOW_ID_NUMBERS, $ctype, $TEXT_DIRECTION;
- global $WT_IMAGE_DIR, $WT_IMAGES, $WT_BLOCKS;
- global $DAYS_TO_SHOW_LIMIT;
-
- $block = true; // Always restrict this block's height
-
- if (empty($config)) $config = $WT_BLOCKS["print_upcoming_events"]["config"];
- if (!isset($DAYS_TO_SHOW_LIMIT)) $DAYS_TO_SHOW_LIMIT = 30;
- if (isset($config["days"])) $daysprint = $config["days"];
- else $daysprint = 30;
- if (isset($config["filter"])) $filter = $config["filter"]; // "living" or "all"
- else $filter = "all";
- if (isset($config["onlyBDM"])) $onlyBDM = $config["onlyBDM"]; // "yes" or "no"
- else $onlyBDM = "no";
- if (isset($config["infoStyle"])) $infoStyle = $config["infoStyle"]; // "style1" or "style2"
- else $infoStyle = "style2";
- if (isset($config["sortStyle"])) $sortStyle = $config["sortStyle"]; // "alpha" or "anniv"
- else $sortStyle = "alpha";
- if (isset($config["allowDownload"])) $allowDownload = $config["allowDownload"]; // "yes" or "no"
- else $allowDownload = "yes";
-
- // Don't permit calendar download if not logged in
- if (!WT_USER_ID) {
- $allowDownload = "no";
- }
-
-
- if ($daysprint < 1) $daysprint = 1;
- if ($daysprint > $DAYS_TO_SHOW_LIMIT) $daysprint = $DAYS_TO_SHOW_LIMIT; // valid: 1 to limit
- $startjd=client_jd()+1;
- $endjd=client_jd()+$daysprint;
-
- // Output starts here
- $id="upcoming_events";
- $title='';
- if ($WT_BLOCKS["print_upcoming_events"]["canconfig"]) {
- if ($ctype=="gedcom" && WT_USER_GEDCOM_ADMIN || $ctype=="user" && WT_USER_ID) {
- if ($ctype=="gedcom") {
- $name = WT_GEDCOM;
- } else {
- $name = WT_USER_NAME;
- }
- $title .= "<a href=\"javascript: configure block\" onclick=\"window.open('".encode_url("index_edit.php?name={$name}&ctype={$ctype}&action=configure&side={$side}&index={$index}")."', '_blank', 'top=50,left=50,width=600,height=350,scrollbars=1,resizable=1'); return false;\">";
- $title .= "<img class=\"adminicon\" src=\"$WT_IMAGE_DIR/".$WT_IMAGES["admin"]["small"]."\" width=\"15\" height=\"15\" border=\"0\" alt=\"".i18n::translate('Configure')."\" /></a>";
- }
- }
- $title .= i18n::translate('Upcoming Events');
- $title .= help_link('index_events');
-
- $content = "";
- switch ($infoStyle) {
- case "style1":
- // Output style 1: Old format, no visible tables, much smaller text. Better suited to right side of page.
- $content .= print_events_list($startjd, $endjd, $onlyBDM=='yes'?'BIRT MARR DEAT':'', $filter=='living', $sortStyle);
- break;
- case "style2":
- // Style 2: New format, tables, big text, etc. Not too good on right side of page
- ob_start();
- $content .= print_events_table($startjd, $endjd, $onlyBDM=='yes'?'BIRT MARR DEAT':'', $filter=='living', $allowDownload=='yes', $sortStyle);
- $content .= ob_get_clean();
- break;
- }
-
- global $THEME_DIR;
- if ($block) {
- require $THEME_DIR.'templates/block_small_temp.php';
- } else {
- require $THEME_DIR.'templates/block_main_temp.php';
- }
-}
-
-function print_upcoming_events_config($config) {
- global $WT_BLOCKS, $DAYS_TO_SHOW_LIMIT;
- if (empty($config)) $config = $WT_BLOCKS["print_upcoming_events"]["config"];
- if (!isset($DAYS_TO_SHOW_LIMIT)) $DAYS_TO_SHOW_LIMIT = 30;
- if (!isset($config["days"])) $config["days"] = 30;
- if (!isset($config["filter"])) $config["filter"] = "all";
- if (!isset($config["onlyBDM"])) $config["onlyBDM"] = "no";
- if (!isset($config["infoStyle"])) $config["infoStyle"] = "style2";
- if (!isset($config["sortStyle"])) $config["sortStyle"] = "alpha";
- if (!isset($config["allowDownload"])) $config["allowDownload"] = "yes";
-
- if ($config["days"] < 1) $config["days"] = 1;
- if ($config["days"] > $DAYS_TO_SHOW_LIMIT) $config["days"] = $DAYS_TO_SHOW_LIMIT; // valid: 1 to limit
-
- ?>
- <tr><td class="descriptionbox wrap width33">
- <?php
- print i18n::translate('Number of days to show');
- print help_link('days_to_show');
- ?>
- </td><td class="optionbox">
- <input type="text" name="days" size="2" value="<?php print $config["days"]; ?>" />
- </td></tr>
-
- <tr><td class="descriptionbox wrap width33">
- <?php
- print i18n::translate('Show only events of living people?');
- ?>
- </td><td class="optionbox">
- <select name="filter">
- <option value="all"<?php if ($config["filter"]=="all") print " selected=\"selected\"";?>><?php print i18n::translate('No'); ?></option>
- <option value="living"<?php if ($config["filter"]=="living") print " selected=\"selected\"";?>><?php print i18n::translate('Yes'); ?></option>
- </select>
- </td></tr>
-
- <tr><td class="descriptionbox wrap width33">
- <?php
- print i18n::translate('Show only Births, Deaths, and Marriages?');
- print help_link('basic_or_all');
- ?>
- </td><td class="optionbox">
- <select name="onlyBDM">
- <option value="no"<?php if ($config["onlyBDM"]=="no") print " selected=\"selected\"";?>><?php print i18n::translate('No'); ?></option>
- <option value="yes"<?php if ($config["onlyBDM"]=="yes") print " selected=\"selected\"";?>><?php print i18n::translate('Yes'); ?></option>
- </select>
- </td></tr>
-
- <tr><td class="descriptionbox wrap width33">
- <?php
- print i18n::translate('Presentation Style');
- print help_link('style');
- ?>
- </td><td class="optionbox">
- <select name="infoStyle">
- <option value="style1"<?php if ($config["infoStyle"]=="style1") print " selected=\"selected\"";?>><?php print i18n::translate('List'); ?></option>
- <option value="style2"<?php if ($config["infoStyle"]=="style2") print " selected=\"selected\"";?>><?php print i18n::translate('Table'); ?></option>
- </select>
- </td></tr>
-
- <tr><td class="descriptionbox wrap width33">
- <?php
- print i18n::translate('Sort Style');
- print help_link('sort_style');
- ?>
- </td><td class="optionbox">
- <select name="sortStyle">
- <option value="alpha"<?php if ($config["sortStyle"]=="alpha") print " selected=\"selected\"";?>><?php print i18n::translate('Alphabetically'); ?></option>
- <option value="anniv"<?php if ($config["sortStyle"]=="anniv") print " selected=\"selected\"";?>><?php print i18n::translate('By Anniversary'); ?></option>
- </select>
- </td></tr>
-
- <tr><td class="descriptionbox wrap width33">
- <?php
- print i18n::translate('Allow calendar events download?');
- print help_link('cal_download');
- ?>
- </td><td class="optionbox">
- <select name="allowDownload">
- <option value="yes"<?php if ($config["allowDownload"]=="yes") print " selected=\"selected\"";?>><?php print i18n::translate('Yes'); ?></option>
- <option value="no"<?php if ($config["allowDownload"]=="no") print " selected=\"selected\"";?>><?php print i18n::translate('No'); ?></option>
- </select>
- <input type="hidden" name="cache" value="1" />
- </td></tr>
- <?php
-}
-?>
diff --git a/blocks/user_blog.php b/blocks/user_blog.php
deleted file mode 100644
index f488ce8ebb..0000000000
--- a/blocks/user_blog.php
+++ /dev/null
@@ -1,92 +0,0 @@
-<?php
-/**
- * User Blog Block
- *
- * This block allows users to have their own blog
- *
- * webtrees: Web based Family History software
- * Copyright (C) 2010 webtrees development team.
- *
- * Derived from PhpGedView
- * Copyright (C) 2002 to 2009 PGV Development Team. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * @package webtrees
- * @subpackage Blocks
- * @version $Id$
- */
-
-if (!defined('WT_WEBTREES')) {
- header('HTTP/1.0 403 Forbidden');
- exit;
-}
-
-define('WT_USER_BLOG_PHP', '');
-
-$WT_BLOCKS['print_user_news']=array(
- 'name'=>i18n::translate('User Journal'),
- 'type'=>'user',
- 'descr'=>i18n::translate('The User Journal block lets the user keep notes or a journal online.'),
- 'canconfig'=>false,
- 'config'=>array(
- 'cache'=>0
- )
-);
-
-/**
- * Prints a user news/journal
- *
- */
-function print_user_news($block=true, $config="", $side, $index) {
- global $WT_IMAGE_DIR, $WT_IMAGES, $TEXT_DIRECTION, $ctype;
-
- $usernews = getUserNews(WT_USER_ID);
-
- $id="user_news";
- $title = i18n::translate('My Journal');
- $title .= help_link('mygedview_myjournal');
- $content = "";
- if (count($usernews)==0) {
- $content .= i18n::translate('You have not created any Journal items.').' ';
- }
- foreach($usernews as $key=>$news) {
- $day = date("j", $news["date"]);
- $mon = date("M", $news["date"]);
- $year = date("Y", $news["date"]);
- $content .= "<div class=\"person_box\">";
- $content .= "<span class=\"news_title\">".embed_globals($news["title"])."</span><br />";
- $content .= "<span class=\"news_date\">".format_timestamp($news["date"])."</span><br /><br />";
- $trans = get_html_translation_table(HTML_SPECIALCHARS);
- $trans = array_flip($trans);
- $news["text"] = strtr($news["text"], embed_globals($news["text"]));
- $news["text"] = nl2br($news["text"]);
- $content .= PrintReady($news["text"])."<br /><br />";
- $content .= "<a href=\"javascript:;\" onclick=\"editnews('$key'); return false;\">".i18n::translate('Edit')."</a> | ";
- $content .= "<a href=\"".encode_url("index.php?action=deletenews&news_id={$key}&ctype={$ctype}")."\" onclick=\"return confirm('".i18n::translate('Are you sure you want to delete this Journal entry?')."');\">".i18n::translate('Delete')."</a><br />";
- $content .= "</div><br />";
- }
- if (WT_USER_ID) {
- $content .= "<br /><a href=\"javascript:;\" onclick=\"addnews('".WT_USER_ID."'); return false;\">".i18n::translate('Add a new Journal entry')."</a>";
- }
-
- global $THEME_DIR;
- if ($block) {
- require $THEME_DIR.'templates/block_small_temp.php';
- } else {
- require $THEME_DIR.'templates/block_main_temp.php';
- }
-}
-?>
diff --git a/blocks/user_favorites.php b/blocks/user_favorites.php
deleted file mode 100644
index 5698f2dd3a..0000000000
--- a/blocks/user_favorites.php
+++ /dev/null
@@ -1,204 +0,0 @@
-<?php
-/**
- * User Favorites Block
- *
- * This block will print a users favorites
- *
- * webtrees: Web based Family History software
- * Copyright (C) 2010 webtrees development team.
- *
- * Derived from PhpGedView
- * Copyright (C) 2002 to 2009 PGV Development Team. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * $Id$
- * @package webtrees
- * @subpackage Blocks
- */
-
-if (!defined('WT_WEBTREES')) {
- header('HTTP/1.0 403 Forbidden');
- exit;
-}
-
-define('WT_USER_FAVORITES_PHP', '');
-
-require_once WT_ROOT.'includes/functions/functions_print_lists.php';
-
-$WT_BLOCKS['print_user_favorites']=array(
- 'name'=>i18n::translate('User Favorites'),
- 'type'=>'user',
- 'descr'=>i18n::translate('The User Favorites block shows the user a list of his favorite people in the database so that he can easily link to them.'),
- 'canconfig'=>false,
- 'config'=>array(
- 'cache'=>0
- )
-);
-
-//-- print user favorites
-function print_user_favorites($block=true, $config="", $side, $index) {
- global $WT_IMAGE_DIR, $WT_IMAGES, $GEDCOM, $TEXT_DIRECTION, $INDEX_DIRECTORY, $MEDIA_DIRECTORY, $MULTI_MEDIA, $MEDIA_DIRECTORY_LEVELS, $ctype;
- global $show_full, $PEDIGREE_FULL_DETAILS, $BROWSERTYPE, $ENABLE_AUTOCOMPLETE;
-
- // Override GEDCOM configuration temporarily
- if (isset($show_full)) $saveShowFull = $show_full;
- $savePedigreeFullDetails = $PEDIGREE_FULL_DETAILS;
- $show_full = 1;
- $PEDIGREE_FULL_DETAILS = 1;
-
- $userfavs = getUserFavorites(WT_USER_NAME);
- if (!is_array($userfavs)) $userfavs = array();
-
- $id="user_favorites";
- $title = i18n::translate('My Favorites');
- $title .= help_link('mygedview_favorites');
- if ($TEXT_DIRECTION=="rtl") $title .= getRLM();
- $title .= "(".count($userfavs).")";
- if ($TEXT_DIRECTION=="rtl") $title .= getRLM();
-
- if ($ENABLE_AUTOCOMPLETE) {
- $content = '<script type="text/javascript" src="js/jquery/jquery.min.js"></script>
- <script type="text/javascript" src="js/jquery/jquery.autocomplete.js"></script>
- <script type="text/javascript" src="js/jquery/jquery.ajaxQueue.js"></script>
- <script type="text/javascript">
- jQuery.noConflict(); // @see http://docs.jquery.com/Using_jQuery_with_Other_Libraries/
- jQuery(document).ready(function($){
- $("input[name^=gid]").autocomplete("autocomplete.php", {
- extraParams: {field:"IFSRO"},
- formatItem: function(row, i) {
- return row[0] + " (" + row[1] + ")";
- },
- formatResult: function(row) {
- return row[1];
- },
- width: 400,
- minChars: 2
- });
- });
- </script>';
- } else $content = '';
-
- if ($block) {
- $style = 2; // 1 means "regular box", 2 means "wide box"
- $tableWidth = ($BROWSERTYPE=="msie") ? "95%" : "99%"; // IE needs to have room for vertical scroll bar inside the box
- $cellSpacing = "1px";
- } else {
- $style = 2;
- $tableWidth = "99%";
- $cellSpacing = "3px";
- }
- if (count($userfavs)==0) {
- $content .= i18n::translate('You have not selected any favorites.<br /><br />To add an individual, a family, or a source to your favorites, click on the <b>Add a new favorite</b> link to reveal some fields where you can enter or search for an ID number. Instead of an ID number, you can enter a URL and a title.');
- } else {
- $mygedcom = $GEDCOM;
- $current_gedcom = $GEDCOM;
- $content .= "<table width=\"{$tableWidth}\" style=\"border:none\" cellspacing=\"{$cellSpacing}\" class=\"center $TEXT_DIRECTION\">";
- foreach($userfavs as $key=>$favorite) {
- if (isset($favorite["id"])) $key=$favorite["id"];
- $removeFavourite = "<a class=\"font9\" href=\"".encode_url("index.php?ctype={$ctype}&action=deletefav&fv_id={$key}")."\" onclick=\"return confirm('".i18n::translate('Are you sure you want to remove this item from your list of Favorites?')."');\">".i18n::translate('Remove')."</a><br />";
- $current_gedcom = $GEDCOM;
- $GEDCOM = $favorite["file"];
- $content .= "<tr><td>";
- if ($favorite["type"]=="URL") {
- $content .= "<div id=\"boxurl".$key.".0\" class=\"person_box\">";
- if ($ctype=="user" || WT_USER_IS_ADMIN) $content .= $removeFavourite;
- $content .= "<a href=\"".$favorite["url"]."\">".PrintReady($favorite["title"])."</a>";
- $content .= "<br />".PrintReady($favorite["note"]);
- } else {
- require $INDEX_DIRECTORY.$GEDCOM.'_conf.php';
- $indirec = find_gedcom_record($favorite["gid"], WT_GED_ID);
- if ($favorite["type"]=="INDI") {
- $content .= "<div id=\"box".$favorite["gid"].".0\" class=\"person_box";
- if (strpos($indirec, "\n1 SEX F")!==false) $content .= "F";
- elseif (strpos($indirec, "\n1 SEX M")!==false) $content .= "";
- else $content .= "NN";
- $content .= "\">";
- if ($ctype=="user" || WT_USER_IS_ADMIN) $content .= $removeFavourite;
- ob_start();
- print_pedigree_person($favorite["gid"], $style, 1, $key);
- $content .= ob_get_clean();
- $content .= PrintReady($favorite["note"]);
- } else {
- $record=GedcomRecord::getInstance($favorite['gid']);
- $content .= "<div id=\"box".$favorite["gid"].".0\" class=\"person_box\">";
- if ($ctype=="user" || WT_USER_IS_ADMIN) $content .= $removeFavourite;
- if ($record) {
- $content.=$record->format_list('span');
- } else {
- $content.=i18n::translate('No such ID exists in this GEDCOM file.');
- }
- $content .= "<br />".PrintReady($favorite["note"]);
- }
- }
- $content .= "</div>";
- $content .= "</td></tr>";
- $GEDCOM = $mygedcom;
- require $INDEX_DIRECTORY.$GEDCOM.'_conf.php';
- }
- $content .= "</table>";
- }
- $content .= '
- <script language="JavaScript" type="text/javascript">
- var pastefield;
- function paste_id(value) {
- pastefield.value=value;
- }
- </script>
- <br />
- ';
- $uniqueID = floor(microtime() * 1000000);
- $content .= "<b><a href=\"javascript: ".i18n::translate('Add a new favorite')." \" onclick=\"expand_layer('add_user_fav'); return false;\"><img id=\"add_user_fav_img\" src=\"".$WT_IMAGE_DIR."/".$WT_IMAGES["plus"]["other"]."\" border=\"0\" alt=\"\" />&nbsp;".i18n::translate('Add a new favorite')."</a></b>";
- $content .= help_link('index_add_favorites');
- $content .= "<br /><div id=\"add_user_fav\" style=\"display: none;\">";
- $content .= "<form name=\"addufavform\" method=\"post\" action=\"index.php\">";
- $content .= "<input type=\"hidden\" name=\"action\" value=\"addfav\" />";
- $content .= "<input type=\"hidden\" name=\"ctype\" value=\"$ctype\" />";
- $content .= "<input type=\"hidden\" name=\"favtype\" value=\"user\" />";
- $content .= "<input type=\"hidden\" name=\"ged\" value=\"$GEDCOM\" />";
- $content .= "<table width=\"{$tableWidth}\" style=\"border:none\" cellspacing=\"{$cellSpacing}\" class=\"center $TEXT_DIRECTION\">";
- $content .= "<tr><td>".i18n::translate('Enter a Person, Family, or Source ID')." <br />";
- $content .= "<input class=\"pedigree_form\" type=\"text\" name=\"gid\" id=\"gid{$uniqueID}\" size=\"5\" value=\"\" />";
-
- $content .= print_findindi_link("gid{$uniqueID}",'',true)."\n";
- $content .= print_findfamily_link("gid{$uniqueID}",'',true)."\n";
- $content .= print_findsource_link("gid{$uniqueID}",'',true)."\n";
- $content .= print_findrepository_link("gid{$uniqueID}",'',true)."\n";
- $content .= print_findnote_link("gid{$uniqueID}",'',true)."\n";
- $content .= print_findmedia_link("gid{$uniqueID}",'1','',true)."\n";
-
- $content .= "<br />".i18n::translate('OR<br />Enter a URL and a title');
- $content .= "<table><tr><td>".i18n::translate('URL')."</td><td><input type=\"text\" name=\"url\" size=\"40\" value=\"\" /></td></tr>";
- $content .= "<tr><td>".i18n::translate('Title:')."</td><td><input type=\"text\" name=\"favtitle\" size=\"40\" value=\"\" /></td></tr></table>";
- if ($block) $content .= "\n</td></tr><tr><td><br />";
- else $content .= "\n</td><td>";
- $content .= i18n::translate('Enter an optional note about this favorite');
- $content .= "<br /><textarea name=\"favnote\" rows=\"6\" cols=\"50\"></textarea>";
- $content .= "</td></tr></table>";
- $content .= "<br /><input type=\"submit\" value=\"".i18n::translate('Add')."\" style=\"font-size: 8pt; \" />";
- $content .= "</form></div>";
-
- global $THEME_DIR;
- if ($block) {
- require $THEME_DIR.'templates/block_small_temp.php';
- } else {
- require $THEME_DIR.'templates/block_main_temp.php';
- }
- // Restore GEDCOM configuration
- unset($show_full);
- if (isset($saveShowFull)) $show_full = $saveShowFull;
- $PEDIGREE_FULL_DETAILS = $savePedigreeFullDetails;
-}
-?>
diff --git a/blocks/user_messages.php b/blocks/user_messages.php
deleted file mode 100644
index 505dc20ad1..0000000000
--- a/blocks/user_messages.php
+++ /dev/null
@@ -1,169 +0,0 @@
-<?php
-/**
- * User Messages Block
- *
- * This block will print a users messages
- *
- * webtrees: Web based Family History software
- * Copyright (C) 2010 webtrees development team.
- *
- * Derived from PhpGedView
- * Copyright (C) 2002 to 2009 PGV Development Team. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * @version $Id$
- * @package webtrees
- * @subpackage Blocks
- */
-
-if (!defined('WT_WEBTREES')) {
- header('HTTP/1.0 403 Forbidden');
- exit;
-}
-
-define('WT_USER_MESSAGES_PHP', '');
-
-require_once WT_ROOT.'includes/functions/functions_print_facts.php';
-
-$WT_BLOCKS['print_user_messages']=array(
- 'name'=>i18n::translate('User Messages'),
- 'type'=>'user',
- 'descr'=>i18n::translate('The User Messages block shows a list of the messages that have been sent to the active user.'),
- 'canconfig'=>false,
- 'config'=>array(
- 'cache'=>0
- )
-);
-
-//-- print user messages
-function print_user_messages($block=true, $config="", $side, $index) {
- global $WT_IMAGE_DIR, $TEXT_DIRECTION, $WT_STORE_MESSAGES, $WT_IMAGES;
-
- $usermessages = getUserMessages(WT_USER_NAME);
-
- $id="user_messages";
- $title = i18n::translate('My Messages');
- $title .= help_link('mygedview_message');
- if ($TEXT_DIRECTION=="rtl") $title .= getRLM();
- $title .= "(".count($usermessages).")";
- if ($TEXT_DIRECTION=="rtl") $title .= getRLM();
-
- $content = "";
- $content .= "<form name=\"messageform\" action=\"\" onsubmit=\"return confirm('".i18n::translate('Are you sure you want to delete this message? It cannot be retrieved later.')."');\">";
- if (count($usermessages)==0) {
- $content .= i18n::translate('You have no pending messages.')."<br />";
- } else {
- $content .= '
- <script language="JavaScript" type="text/javascript">
- <!--
- function select_all() {
- ';
- foreach($usermessages as $key=>$message) {
- if (isset($message["id"])) $key = $message["id"];
- $content .= '
- var cb = document.getElementById("cb_message'.$key.'");
- if (cb) {
- if (!cb.checked) cb.checked = true;
- else cb.checked = false;
- }
- ';
- }
- $content .= '
- return false;
- }
- //-->
- </script>
- ';
- $content .= "<input type=\"hidden\" name=\"action\" value=\"deletemessage\" />";
- $content .= "<table class=\"list_table\"><tr>";
- $content .= "<td class=\"list_label\">".i18n::translate('Delete')."<br /><a href=\"javascript:;\" onclick=\"return select_all();\">".i18n::translate('ALL')."</a></td>";
- $content .= "<td class=\"list_label\">".i18n::translate('Subject:')."</td>";
- $content .= "<td class=\"list_label\">".i18n::translate('Date Sent:')."</td>";
- $content .= "<td class=\"list_label\">".i18n::translate('Email Address:')."</td>";
- $content .= "</tr>";
- foreach($usermessages as $key=>$message) {
- if (isset($message["id"])) $key = $message["id"];
- $content .= "<tr>";
- $content .= "<td class=\"list_value_wrap\"><input type=\"checkbox\" id=\"cb_message$key\" name=\"message_id[]\" value=\"$key\" /></td>";
- $showmsg=preg_replace("/(\w)\/(\w)/","\$1/<span style=\"font-size:1px;\"> </span>\$2",PrintReady($message["subject"]));
- $showmsg=str_replace("@","@<span style=\"font-size:1px;\"> </span>",$showmsg);
- $content .= "<td class=\"list_value_wrap\"><a href=\"javascript:;\" onclick=\"expand_layer('message{$key}'); return false;\"><img id=\"message{$key}_img\" src=\"".$WT_IMAGE_DIR."/".$WT_IMAGES["plus"]["other"]."\" border=\"0\" alt=\"".i18n::translate('Show Details')."\" title=\"".i18n::translate('Show Details')."\" /> <b>".$showmsg."</b></a></td>";
- if (!empty($message["created"])) {
- $time = strtotime($message["created"]);
- } else {
- $time = time();
- }
- $content .= "<td class=\"list_value_wrap\">".format_timestamp($time)."</td>";
- $content .= "<td class=\"list_value_wrap\">";
- $user_id=get_user_id($message["from"]);
- if ($user_id) {
- $content .= PrintReady(getUserFullName($user_id));
- if ($TEXT_DIRECTION=="ltr") {
- $content .= " " . getLRM() . " - ".htmlspecialchars($user_id,ENT_COMPAT,'UTF-8') . getLRM();
- } else {
- $content .= " " . getRLM() . " - ".htmlspecialchars($user_id,ENT_COMPAT,'UTF-8') . getRLM();
- }
- } else {
- $content .= "<a href=\"mailto:".$message["from"]."\">".str_replace("@","@<span style=\"font-size:1px;\"> </span>",$message["from"])."</a>";
- }
- $content .= "</td>";
- $content .= "</tr>";
- $content .= "<tr><td class=\"list_value_wrap\" colspan=\"5\"><div id=\"message$key\" style=\"display: none;\">";
- $message["body"] = nl2br(htmlspecialchars($message["body"],ENT_COMPAT,'UTF-8'));
- $message["body"] = expand_urls($message["body"]);
-
- $content .= PrintReady($message["body"])."<br /><br />";
- if (strpos($message["subject"], "RE:")===false) {
- $message["subject"]="RE:".$message["subject"];
- }
- if ($user_id) {
- $content .= "<a href=\"javascript:;\" onclick=\"reply('".$user_id."', '".$message["subject"]."'); return false;\">".i18n::translate('Reply')."</a> | ";
- }
- $content .= "<a href=\"".encode_url("index.php?action=deletemessage&message_id={$key}")."\" onclick=\"return confirm('".i18n::translate('Are you sure you want to delete this message? It cannot be retrieved later.')."');\">".i18n::translate('Delete')."</a></div></td></tr>";
- }
- $content .= "</table>";
- $content .= "<input type=\"submit\" value=\"".i18n::translate('Delete Selected Messages')."\" /><br /><br />";
- }
- if (get_user_count()>1) {
- $content .= i18n::translate('Send Message')." <select name=\"touser\">";
- if (WT_USER_IS_ADMIN) {
- $content .= "<option value=\"all\">".i18n::translate('Broadcast to all users')."</option>";
- $content .= "<option value=\"never_logged\">".i18n::translate('Send message to users who have never logged in')."</option>";
- $content .= "<option value=\"last_6mo\">".i18n::translate('Send message to users who have not logged in for 6 months')."</option>";
- }
- foreach (get_all_users() as $user_id=>$user_name) {
- if ($user_id!=WT_USER_ID && get_user_setting($user_id, 'verified_by_admin')=='yes' && get_user_setting($user_id, 'contactmethod')!='none') {
- $content .= "<option value=\"".$user_name."\">".PrintReady(getUserFullName($user_id))." ";
- if ($TEXT_DIRECTION=="ltr") {
- $content .= stripLRMRLM(getLRM()." - ".$user_name.getLRM());
- } else {
- $content .= stripLRMRLM(getRLM()." - ".$user_name.getRLM());
- }
- $content .= "</option>";
- }
- }
- $content .= "</select><input type=\"button\" value=\"".i18n::translate('Send')."\" onclick=\"message(document.messageform.touser.options[document.messageform.touser.selectedIndex].value, 'messaging2', ''); return false;\" />";
- }
- $content .= "</form>";
-
- global $THEME_DIR;
- if ($block) {
- require $THEME_DIR.'templates/block_small_temp.php';
- } else {
- require $THEME_DIR.'templates/block_main_temp.php';
- }
-}
-?>
diff --git a/blocks/user_welcome.php b/blocks/user_welcome.php
deleted file mode 100644
index 68f0f21b22..0000000000
--- a/blocks/user_welcome.php
+++ /dev/null
@@ -1,79 +0,0 @@
-<?php
-/**
- * User Welcome Block
- *
- * This block will print basic information and links for the user.
- *
- * webtrees: Web based Family History software
- * Copyright (C) 2010 webtrees development team.
- *
- * Derived from PhpGedView
- * Copyright (C) 2002 to 2009 PGV Development Team. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * @package webtrees
- * @subpackage Blocks
- * @version $Id$
- */
-
-if (!defined('WT_WEBTREES')) {
- header('HTTP/1.0 403 Forbidden');
- exit;
-}
-
-define('WT_USER_WELCOME_PHP', '');
-
-$WT_BLOCKS['print_welcome_block']=array(
- 'name'=>i18n::translate('User Welcome'),
- 'descr'=>i18n::translate('The User Welcome block shows the user the current date and time, quick links to modify his account or go to his own Pedigree chart, and a link to customize his My Page.'),
- 'type'=>'user',
- 'canconfig'=>false,
- 'config'=>array(
- 'cache'=>0
- )
-);
-
-//-- function to print the welcome block
-function print_welcome_block($block=true, $config="", $side, $index) {
- global $WT_IMAGE_DIR, $WT_IMAGES;
-
- $id="user_welcome";
- $title = i18n::translate('Welcome')." ".getUserFullName(WT_USER_ID);
-
- $content = "<table class=\"blockcontent\" cellspacing=\"0\" cellpadding=\"0\" style=\" width: 100%; direction:ltr;\"><tr>";
- $content .= "<td class=\"tab_active_bottom\" colspan=\"3\" ></td></tr><tr>";
- if (get_user_setting(WT_USER_ID, 'editaccount')=='Y') {
- $content .= "<td class=\"center details2\" style=\" width: 33%; clear: none; vertical-align: top; margin-top: 2px;\"><a href=\"edituser.php\"><img src=\"".$WT_IMAGE_DIR."/".$WT_IMAGES["mygedview"]["small"]."\" border=\"0\" alt=\"".i18n::translate('My Account')."\" title=\"".i18n::translate('My Account')."\" /><br />".i18n::translate('My Account')."</a></td>";
- }
- if (WT_USER_GEDCOM_ID) {
- $content .= "<td class=\"center details2\" style=\" width: 34%; clear: none; vertical-align: top; margin-top: 2px;\"><a href=\"".encode_url("pedigree.php?rootid=".WT_USER_GEDCOM_ID)."\"><img src=\"".$WT_IMAGE_DIR."/".$WT_IMAGES["pedigree"]["small"]."\" border=\"0\" alt=\"".i18n::translate('My Pedigree')."\" title=\"".i18n::translate('My Pedigree')."\" /><br />".i18n::translate('My Pedigree')."</a></td>";
- $content .= "<td class=\"center details2\" style=\" width: 33%; clear: none; vertical-align: top; margin-top: 2px;\"><a href=\"".encode_url("individual.php?pid=".WT_USER_GEDCOM_ID)."\"><img src=\"".$WT_IMAGE_DIR."/".$WT_IMAGES["indis"]["small"]."\" border=\"0\" alt=\"".i18n::translate('My Individual Record')."\" title=\"".i18n::translate('My Individual Record')."\" /><br />".i18n::translate('My Individual Record')."</a></td>";
- }
- $content .= "</tr><tr><td class=\"center\" colspan=\"3\">";
- $content .= "<a href=\"javascript:;\" onclick=\"window.open('".encode_url("index_edit.php?name=".WT_USER_NAME."&ctype=user")."', '_blank', 'top=50,left=10,width=705,height=355,scrollbars=1,resizable=1');\">".i18n::translate('Customize My Page')."</a>";
- $content .= help_link('mygedview_customize');
- $content .= "<br />".format_timestamp(client_time());
- $content .= "</td>";
- $content .= "</tr></table>";
-
- global $THEME_DIR;
- if ($block) {
- require $THEME_DIR.'templates/block_small_temp.php';
- } else {
- require $THEME_DIR.'templates/block_main_temp.php';
- }
-}
-?>
diff --git a/blocks/yahrzeit.php b/blocks/yahrzeit.php
deleted file mode 100644
index 1882e14eeb..0000000000
--- a/blocks/yahrzeit.php
+++ /dev/null
@@ -1,302 +0,0 @@
-<?php
-/**
- * Yahrzeit Block
- *
- * This block will print a list of upcoming yahrzeit (hebrew death anniversaries)
- *
- * webtrees: Web based Family History software
- * Copyright (C) 2010 webtrees development team.
- *
- * Derived from PhpGedView
- * Copyright (C) 2008 PGV Development Team. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * @package webtrees
- * @subpackage Blocks
- * @author Greg Roach, fisharebest@users.sourceforge.net
- * @version $Id$
- */
-
-if (!defined('WT_WEBTREES')) {
- header('HTTP/1.0 403 Forbidden');
- exit;
-}
-
-define('WT_YAHRZEIT_PHP', '');
-
-$WT_BLOCKS['print_yahrzeit']=array(
- 'name'=>i18n::translate('Upcoming Yahrzeiten'),
- 'type'=>'both',
- 'descr'=>i18n::translate('The Upcoming Yahrzeiten block shows anniversaries of death dates that will occur in the near future. You can configure the period shown, and the Administrator can configure how far into the future this block will look.'),
- 'canconfig'=>true,
- 'config'=>array(
- 'cache' =>1,
- 'days' =>30,
- 'infoStyle' =>'style2',
- 'allowDownload'=>'yes'
- )
-);
-
-// this block prints a list of upcoming yahrzeit events of people in your gedcom
-function print_yahrzeit($block=true, $config='', $side, $index) {
- global $SHOW_ID_NUMBERS, $ctype, $TEXT_DIRECTION;
- global $WT_IMAGE_DIR, $WT_IMAGES, $WT_BLOCKS;
- global $DAYS_TO_SHOW_LIMIT, $SHOW_MARRIED_NAMES, $SERVER_URL;
-
- $block=true; // Always restrict this block's height
-
- if (empty($config))
- $config=$WT_BLOCKS['print_yahrzeit']['config'];
-
- if (empty($config['infoStyle' ])) $config['infoStyle' ]='style2';
- if (empty($config['allowDownload'])) $config['allowDownload']='yes';
- if (empty($config['days' ])) $config['days' ]=$DAYS_TO_SHOW_LIMIT;
-
- if ($config['days']<1 ) $config['days']=1;
- if ($config['days']>$DAYS_TO_SHOW_LIMIT) $config['days']=$DAYS_TO_SHOW_LIMIT;
-
- $startjd=server_jd();
- $endjd =$startjd+max(min($config['days'], 1), $DAYS_TO_SHOW_LIMIT)-1;
-
- if (!WT_USER_ID) {
- $allowDownload = "no";
- }
-
- $id="yahrzeit";
- $title='';
- if ($WT_BLOCKS['print_yahrzeit']['canconfig']) {
- if ($ctype=="gedcom" && WT_USER_GEDCOM_ADMIN || $ctype=="user" && WT_USER_ID) {
- if ($ctype=="gedcom") {
- $name = WT_GEDCOM;
- } else {
- $name = WT_USER_NAME;
- }
- $title .= "<a href=\"javascript: configure block\" onclick=\"window.open('".encode_url("index_edit.php?name={$name}&ctype={$ctype}&action=configure&side={$side}&index={$index}")."', '_blank', 'top=50,left=50,width=600,height=350,scrollbars=1,resizable=1'); return false;\">";
- $title .= "<img class=\"adminicon\" src=\"{$WT_IMAGE_DIR}/{$WT_IMAGES['admin']['small']}\" width=\"15\" height=\"15\" border=\"0\" alt=\"".i18n::translate('Configure')."\" /></a>";
- }
- }
- $title .= i18n::translate('Upcoming Yahrzeiten');
- $title .= help_link('yahrzeit');
- $content = "";
-
- // The standard anniversary rules cover most of the Yahrzeit rules, we just
- // need to handle a few special cases.
- // Fetch normal anniversaries...
- $yahrzeits=array();
- $hidden=0;
- for ($jd=$startjd-1; $jd<=$endjd+30;++$jd) {
- foreach (get_anniversary_events($jd, 'DEAT _YART') as $fact) {
- // Extract hebrew dates only
- if ($fact['date']->date1->CALENDAR_ESCAPE()=='@#DHEBREW@' && $fact['date']->MinJD()==$fact['date']->MaxJD()) {
- // Apply privacy
- if (displayDetailsById($fact['id']) && showFactDetails($fact['fact'], $fact['id']) && !FactViewRestricted($fact['id'], $fact['factrec'])) {
- $yahrzeits[]=$fact;
- } else {
- ++$hidden;
- }
- }
- }
- }
-
- // ...then adjust dates
- foreach ($yahrzeits as $key=>$yahrzeit) {
- if (strpos('1 DEAT', $yahrzeit['factrec'])!==false) { // Just DEAT, not _YART
- $today=new JewishDate($yahrzeit['jd']);
- $hd=$yahrzeit['date']->MinDate();
- $hd1=new JewishDate($hd);
- $hd1->y+=1;
- $hd1->SetJDFromYMD();
- // Special rules. See http://www.hebcal.com/help/anniv.html
- // Everything else is taken care of by our standard anniversary rules.
- if ($hd->d==30 && $hd->m==2 && $hd->y!=0 && $hd1->DaysInMonth()<30) { // 30 CSH
- // Last day in CSH
- $yahrzeit[$key]['jd']=JewishDate::YMDtoJD($today->y, 3, 1)-1;
- }
- if ($hd->d==30 && $hd->m==3 && $hd->y!=0 && $hd1->DaysInMonth()<30) { // 30 KSL
- // Last day in KSL
- $yahrzeit[$key]['jd']=JewishDate::YMDtoJD($today->y, 4, 1)-1;
- }
- if ($hd->d==30 && $hd->m==6 && $hd->y!=0 && $today->DaysInMonth()<30 && !$today->IsLeapYear()) { // 30 ADR
- // Last day in SHV
- $yahrzeit[$key]['jd']=JewishDate::YMDtoJD($today->y, 6, 1)-1;
- }
- }
- }
-
- switch ($config['infoStyle']) {
- case "style1": // List style
- foreach ($yahrzeits as $yahrzeit)
- if ($yahrzeit['jd']>=$startjd && $yahrzeit['jd']<$startjd+$config['days']) {
- $ind=person::GetInstance($yahrzeit['id']);
-//@@ $content .= "<a href=\"".encode_url($ind->getLinkUrl())."\" class=\"list_item name2\">".$ind->getFullName()."</a>".$ind->getSexImage();
- $content .= "<a href=\"".encode_url($ind->getLinkUrl())."\" class=\"list_item name2\">".PrintReady($ind->getFullName())."</a>".$ind->getSexImage();
- $content .= "<div class=\"indent\">";
- $content .= $yahrzeit['date']->Display(true);
- $content .= ', '.i18n::translate('%s year anniversary', $yahrzeit['anniv']);
- $content .= "</div>";
- }
- break;
- case "style2": // Table style
- require_once WT_ROOT.'js/sorttable.js.htm';
- require_once WT_ROOT.'includes/classes/class_gedcomrecord.php';
- $table_id = "ID".floor(microtime()*1000000); // sorttable requires a unique ID
- $content .= "<table id=\"{$table_id}\" class=\"sortable list_table center\">";
- $content .= "<tr>";
- $content .= "<th class=\"list_label\">".i18n::translate('NAME')."</th>";
- $content .= "<th style=\"display:none\">GIVN</th>";
- $content .= "<th class=\"list_label\">".i18n::translate('DATE')."</th>";
- $content .= "<th class=\"list_label\"><img src=\"./images/reminder.gif\" alt=\"".i18n::translate('Anniversary')."\" title=\"".i18n::translate('Anniversary')."\" border=\"0\" /></th>";
- $content .= "<th class=\"list_label\">".i18n::translate('_YART')."</th>";
- $content .= "</tr>";
-
- $count=0;
- foreach ($yahrzeits as $yahrzeit) {
- if ($yahrzeit['jd']>=$startjd && $yahrzeit['jd']<$startjd+$config['days']) {
- ++$count;
- $ind=person::GetInstance($yahrzeit['id']);
- $content .= "<tr class=\"vevent\">"; // hCalendar:vevent
- // Record name(s)
- $name=$ind->getFullName();
- $url=$ind->getLinkUrl();
- $content .= "<td class=\"list_value_wrap\" align=\"".get_align($name)."\">";
- $content .= "<a href=\"".encode_url($ind->getLinkUrl())."\" class=\"list_item name2\" dir=\"".$TEXT_DIRECTION."\">".PrintReady($name)."</a>";
- $content .= $ind->getSexImage();
- $addname=$ind->getAddName();
- if ($addname) {
- $content .= "<br /><a href=\"".encode_url($url)."\" class=\"list_item\">".PrintReady($addname)."</a>";
- }
- $content .= "</td>";
-
- // GIVN for sorting
- $content .= "<td style=\"display:none\">";
- $exp = explode(",", str_replace('<', ',', $name).",");
- $content .= $exp[1];
- $content .= "</td>";
-
- $today=new JewishDate($yahrzeit['jd']);
- $td=new GedcomDate($today->Format('%@ %A %O %E'));
-
- // death/yahrzeit event date
- $content .= "<td class=\"list_value_wrap\">";
- $content .= "<a name='{$yahrzeit['jd']}'>".$yahrzeit['date']->Display(true, NULL, array())."</a>";
- $content .= "</td>";
-
- // Anniversary
- $content .= "<td class=\"list_value_wrap rela\">";
- $anniv = $yahrzeit['anniv'];
- if ($anniv==0) {
- $content .= '<a name="0">&nbsp;</a>';
- } else {
- $content .= "<a name=\"{$anniv}\">{$anniv}</a>";
- }
- if ($config['allowDownload']=='yes') {
- // hCalendar:dtstart and hCalendar:summary
- //TODO does this work??
- $content .= "<abbr class=\"dtstart\" title=\"".strip_tags($yahrzeit['date']->Display(false,'Ymd',array()))."\"></abbr>";
- $content .= "<abbr class=\"summary\" title=\"".i18n::translate('Anniversary')." #$anniv ".i18n::translate($yahrzeit['fact'])." : ".PrintReady(strip_tags($ind->getFullName()))."\"></abbr>";
- }
-
- // upcomming yahrzeit dates
- $content .= "<td class=\"list_value_wrap\">";
- $content .= "<a href=\"".$url."\" class=\"list_item url\">".$td->Display(true, NULL, array('gregorian'))."</a>"; // hCalendar:url
- $content .= "&nbsp;</td>";
-
- $content .= "</tr>";
- }
- }
-
- // table footer
- $content .= "<tr class=\"sortbottom\">";
- $content .= "<td class=\"list_label\">";
- $content .= '<a href="javascript:;" onclick="sortByOtherCol(this,1)"><img src="images/topdown.gif" alt="" border="0" /> '.i18n::translate('GIVN').'</a><br />';
- $content .= i18n::translate('Total Names').": ".$count;
- if ($hidden) {
- $content .= "<br /><span class=\"warning\">".i18n::translate('Hidden')." : {$hidden}</span>";
- }
- $content .= "</td>";
- $content .= "<td style=\"display:none\">GIVN</td>";
- $content .= "<td>";
- if ($config['allowDownload']=='yes') {
- $uri = $SERVER_URL.basename($_SERVER['REQUEST_URI']);
- $alt = i18n::translate('Download file %s', 'hCal-events.ics');
- if (count($yahrzeits)) {
- $content .= "<a href=\"http://feeds.technorati.com/events/{$uri}\"><img src=\"images/hcal.png\" border=\"0\" alt=\"{$alt}\" title=\"{$alt}\" /></a>";
- }
- }
- $content .= '</td><td>&nbsp;</td><td>&nbsp;</td></tr>';
- $content .= '</table>';
- break;
- }
-
- global $THEME_DIR;
- if ($block) {
- require $THEME_DIR.'templates/block_small_temp.php';
- } else {
- require $THEME_DIR.'templates/block_main_temp.php';
- }
-}
-
-function print_yahrzeit_config($config) {
- global $WT_BLOCKS, $DAYS_TO_SHOW_LIMIT;
-
- if (empty($config)) $config=$WT_BLOCKS["print_yahrzeit"]["config"];
-
- if (empty($config['infoStyle' ])) $config['infoStyle' ]='style2';
- if (empty($config['allowDownload'])) $config['allowDownload']='yes';
- if (empty($config['days' ])) $config['days' ]=$DAYS_TO_SHOW_LIMIT;
-
- if ($config['days']<1 ) $config['days']=1;
- if ($config['days']>$DAYS_TO_SHOW_LIMIT) $config['days']=$DAYS_TO_SHOW_LIMIT;
-
- print '<tr><td class="descriptionbox wrap width33">';
- print i18n::translate('Number of days to show');
- print help_link('days_to_show');
- print '</td><td class="optionbox">';
- print '<input type="text" name="days" size="2" value="'.$config['days'].'" />';
- print '</td></tr>';
-
- print '<tr><td class="descriptionbox wrap width33">';
- print i18n::translate('Presentation Style');
- print help_link('style');
- print '</td><td class="optionbox">';
- print '<select name="infoStyle">';
- foreach (array('style1'=>i18n::translate('List'), 'style2'=>i18n::translate('Table')) as $style=>$desc) {
- print "<option value=\"{$style}\"";
- if ($config['infoStyle']==$style)
- print " selected=\"selected\"";
- print ">{$desc}</option>";
- }
- print '</select></td></tr>';
-
- print '<tr><td class="descriptionbox wrap width33">';
- print i18n::translate('Allow calendar events download?');
- print help_link('cal_dowload');
- print '</td><td class="optionbox">';
- print '<select name="allowDownload">';
- foreach (array('yes'=>i18n::translate('Yes'), 'no'=>i18n::translate('No')) as $value=>$desc) {
- print "<option value=\"{$value}\"";
- if ($config['allowDownload']==$value)
- print " selected=\"selected\"";
- print ">{$desc}</option>";
- }
- print '</select>';
-
- // Cache file life is not configurable by user: anything other than 1 day doesn't make sense
- print '<input type="hidden" name="cache" value="1" />';
-
- print '</td></tr>';
-}
-?>
diff --git a/includes/authentication.php b/includes/authentication.php
index 2c7e73b5e8..8ab4b10f22 100644
--- a/includes/authentication.php
+++ b/includes/authentication.php
@@ -581,57 +581,6 @@ function getUserFavorites($username) {
}
/**
- * get blocks for the given username
- *
- * retrieve the block configuration for the given user
- * if no blocks have been set yet, and the username is a valid user (not a gedcom) then try and load
- * the defaultuser blocks.
- * @param string $username the username or gedcom name for the blocks
- * @return array an array of the blocks. The two main indexes in the array are "main" and "right"
- */
-function getBlocks($username) {
- global $TBLPREFIX;
-
- $blocks = array();
- $blocks["main"] = array();
- $blocks["right"] = array();
-
- $rows=
- WT_DB::prepare("SELECT * FROM {$TBLPREFIX}blocks WHERE b_username=? ORDER BY b_location, b_order")
- ->execute(array($username))
- ->fetchAll();
-
- if ($rows) {
- foreach ($rows as $row) {
- if (!isset($row->b_config))
- $row->b_config="";
- if ($row->b_location=="main")
- $blocks["main"][$row->b_order] = array($row->b_name, @unserialize($row->b_config));
- if ($row->b_location=="right")
- $blocks["right"][$row->b_order] = array($row->b_name, @unserialize($row->b_config));
- }
- } else {
- if (get_user_id($username)) {
- //-- if no blocks found, check for a default block setting
- //$rows=
- WT_DB::prepare("SELECT * FROM {$TBLPREFIX}blocks WHERE b_username=? ORDER BY b_location, b_order")
- ->execute(array('defaultuser'))
- ->fetchAll();
-
- foreach ($rows as $row) {
- if (!isset($row->b_config))
- $row->b_config="";
- if ($row->b_location=="main")
- $blocks["main"][$row->b_order] = array($row->b_name, @unserialize($row->b_config));
- if ($row->b_location=="right")
- $blocks["right"][$row->b_order] = array($row->b_name, @unserialize($row->b_config));
- }
- }
- }
- return $blocks;
-}
-
-/**
* Set Blocks
*
* Sets the blocks for a gedcom or user portal
diff --git a/includes/classes/class_module.php b/includes/classes/class_module.php
index 1d19ea2d04..6cffda9b39 100644
--- a/includes/classes/class_module.php
+++ b/includes/classes/class_module.php
@@ -33,8 +33,11 @@ define('WT_CLASS_MODULE_PHP', '');
// Modules can optionally implement the following interfaces.
interface WT_Module_Block {
- public function getBlock($block, $config, $side, $index);
- public function configureBlock();
+ public function getBlock($block_id);
+ public function canLoadAjax();
+ public function isUserBlock();
+ public function isGedcomBlock();
+ public function configureBlock($block_id);
}
interface WT_Module_Chart {
@@ -222,7 +225,7 @@ abstract class WT_Module {
if ($modules===null) {
$dir=opendir(WT_ROOT.'modules');
while (($file=readdir($dir))!==false) {
- if (preg_match('/^[a-zA-Z_]+$/', $file) && file_exists(WT_ROOT.'modules/'.$file.'/module.php')) {
+ if (preg_match('/^[a-zA-Z0-9_]+$/', $file) && file_exists(WT_ROOT.'modules/'.$file.'/module.php')) {
require_once WT_ROOT.'modules/'.$file.'/module.php';
$class=$file.'_WT_Module';
$modules[$file]=new $class();
diff --git a/includes/functions/functions_db.php b/includes/functions/functions_db.php
index dd67736457..c516adadb8 100644
--- a/includes/functions/functions_db.php
+++ b/includes/functions/functions_db.php
@@ -1779,7 +1779,8 @@ function delete_gedcom($ged_id) {
// Don't delete the logs.
WT_DB::prepare("UPDATE {$TBLPREFIX}log SET gedcom_id=NULL WHERE gedcom_id =?")->execute(array($ged_id));
- WT_DB::prepare("DELETE FROM {$TBLPREFIX}blocks WHERE b_username=?")->execute(array($ged ));
+ WT_DB::prepare("DELETE {$TBLPREFIX}block_setting FROM {$TBLPREFIX}block_setting JOIN {$TBLPREFIX}block USING (block_id) WHERE gedcom_id=?")->execute(array($ged_id));
+ WT_DB::prepare("DELETE FROM {$TBLPREFIX}block WHERE gedcom_id =?")->execute(array($ged_id));
WT_DB::prepare("DELETE FROM {$TBLPREFIX}news WHERE n_username=?")->execute(array($ged ));
WT_DB::prepare("DELETE FROM {$TBLPREFIX}dates WHERE d_file =?")->execute(array($ged_id));
WT_DB::prepare("DELETE FROM {$TBLPREFIX}families WHERE f_file =?")->execute(array($ged_id));
@@ -2281,7 +2282,7 @@ function get_site_setting($setting_name, $default=null) {
function set_site_setting($setting_name, $setting_value) {
global $TBLPREFIX;
- if (empty($setting_value)) {
+ if (is_null($setting_value)) {
WT_DB::prepare("DELETE FROM {$TBLPREFIX}site_setting WHERE setting_name=?")
->execute(array($setting_name));
} else {
@@ -2375,7 +2376,7 @@ function get_gedcom_setting($ged_id, $setting_name) {
function set_gedcom_setting($ged_id, $setting_name, $setting_value) {
global $TBLPREFIX;
- if (empty($setting_value)) {
+ if (is_null($setting_value)) {
WT_DB::prepare("DELETE FROM {$TBLPREFIX}gedcom_setting WHERE gedcom_id=? AND setting_name=?")
->execute(array($ged_id, $setting_name));
} else {
@@ -2406,7 +2407,6 @@ function rename_user($old_username, $new_username) {
global $TBLPREFIX;
WT_DB::prepare("UPDATE {$TBLPREFIX}user SET user_name=? WHERE user_name =?")->execute(array($new_username, $old_username));
- WT_DB::prepare("UPDATE {$TBLPREFIX}blocks SET b_username =? WHERE b_username =?")->execute(array($new_username, $old_username));
WT_DB::prepare("UPDATE {$TBLPREFIX}favorites SET fv_username=? WHERE fv_username=?")->execute(array($new_username, $old_username));
WT_DB::prepare("UPDATE {$TBLPREFIX}messages SET m_from =? WHERE m_from =?")->execute(array($new_username, $old_username));
WT_DB::prepare("UPDATE {$TBLPREFIX}messages SET m_to =? WHERE m_to =?")->execute(array($new_username, $old_username));
@@ -2417,11 +2417,11 @@ function delete_user($user_id) {
global $TBLPREFIX;
$user_name=get_user_name($user_id);
-
+ WT_DB::prepare("DELETE {$TBLPREFIX}block_setting FROM {$TBLPREFIX}block_setting JOIN {$TBLPREFIX}block USING (block_id) WHERE user_id=?")->execute(array($user_id));
+ WT_DB::prepare("DELETE FROM {$TBLPREFIX}block WHERE user_id =?" )->execute(array($user_id));
WT_DB::prepare("DELETE FROM {$TBLPREFIX}user_gedcom_setting WHERE user_id =?" )->execute(array($user_id));
WT_DB::prepare("DELETE FROM {$TBLPREFIX}user_setting WHERE user_id =?" )->execute(array($user_id));
WT_DB::prepare("DELETE FROM {$TBLPREFIX}user WHERE user_id =?" )->execute(array($user_id));
- WT_DB::prepare("DELETE FROM {$TBLPREFIX}blocks WHERE b_username =?" )->execute(array($user_name));
WT_DB::prepare("DELETE FROM {$TBLPREFIX}favorites WHERE fv_username=?" )->execute(array($user_name));
WT_DB::prepare("DELETE FROM {$TBLPREFIX}messages WHERE m_from=? OR m_to=?")->execute(array($user_name, $user_name));
WT_DB::prepare("DELETE FROM {$TBLPREFIX}news WHERE n_username =?" )->execute(array($user_name));
@@ -2580,7 +2580,7 @@ function get_user_setting($user_id, $setting_name) {
function set_user_setting($user_id, $setting_name, $setting_value) {
global $TBLPREFIX;
- if (empty($setting_value)) {
+ if (is_null($setting_value)) {
WT_DB::prepare("DELETE FROM {$TBLPREFIX}user_setting WHERE user_id=? AND setting_name=?")
->execute(array($user_id, $setting_name));
} else {
@@ -2609,7 +2609,7 @@ function get_user_gedcom_setting($user_id, $ged_id, $setting_name) {
function set_user_gedcom_setting($user_id, $ged_id, $setting_name, $setting_value) {
global $TBLPREFIX;
- if (empty($setting_value)) {
+ if (is_null($setting_value)) {
WT_DB::prepare("DELETE FROM {$TBLPREFIX}user_gedcom_setting WHERE user_id=? AND gedcom_id=? AND setting_name=?")
->execute(array($user_id, $ged_id, $setting_name));
} else {
@@ -2628,6 +2628,99 @@ function get_user_from_gedcom_xref($ged_id, $xref) {
)->execute(array($ged_id, 'gedcomid', $xref))->fetchOne();
}
+////////////////////////////////////////////////////////////////////////////////
+// Functions to access the WT_BLOCK table
+////////////////////////////////////////////////////////////////////////////////
+
+function get_user_blocks($user_id) {
+ global $TBLPREFIX;
+
+ $blocks=array('main'=>array(), 'side'=>array());
+ $rows=WT_DB::prepare(
+ "SELECT location, block_id, module_name".
+ " FROM {$TBLPREFIX}block".
+ " WHERE user_id=?".
+ " ORDER BY location, block_order"
+ )->execute(array($user_id))->fetchAll();
+ foreach ($rows as $row) {
+ $blocks[$row->location][$row->block_id]=$row->module_name;
+ }
+ if ($rows) {
+ return $blocks;
+ } else {
+ WT_DB::prepare(
+ "REPLACE INTO {$TBLPREFIX}block (user_id, location, block_order, module_name) VALUES ".
+ "(?, 'main', 0, 'todays_events'),".
+ "(?, 'main', 1, 'user_messages'),".
+ "(?, 'main', 2, 'user_favorites'),".
+ "(?, 'side', 0, 'user_welcome'),".
+ "(?, 'side', 1, 'random_media'),".
+ "(?, 'side', 2, 'upcoming_events'),".
+ "(?, 'side', 3, 'logged_in')"
+ )->execute(array($user_id, $user_id, $user_id, $user_id, $user_id, $user_id, $user_id));
+ return get_user_blocks($user_id);
+ }
+}
+
+function get_gedcom_blocks($gedcom_id) {
+ global $TBLPREFIX;
+
+ $blocks=array('main'=>array(), 'side'=>array());
+ $rows=WT_DB::prepare(
+ "SELECT location, block_id, module_name".
+ " FROM {$TBLPREFIX}block".
+ " WHERE gedcom_id=?".
+ " ORDER BY location, block_order"
+ )->execute(array($gedcom_id))->fetchAll();
+ foreach ($rows as $row) {
+ $blocks[$row->location][$row->block_id]=$row->module_name;
+ }
+ if ($rows) {
+ return $blocks;
+ } else {
+ WT_DB::prepare(
+ "REPLACE INTO {$TBLPREFIX}block (gedcom_id, location, block_order, module_name) VALUES ".
+ "(?, 'main', 0, 'gedcom_stats'),".
+ "(?, 'main', 1, 'gedcom_news'),".
+ "(?, 'main', 2, 'gedcom_favorites'),".
+ "(?, 'main', 3, 'review_changes'),".
+ "(?, 'side', 0, 'gedcom_block'),".
+ "(?, 'side', 1, 'random_media'),".
+ "(?, 'side', 2, 'todays_events'),".
+ "(?, 'side', 3, 'logged_in')"
+ )->execute(array($gedcom_id, $gedcom_id, $gedcom_id, $gedcom_id, $gedcom_id, $gedcom_id, $gedcom_id, $gedcom_id));
+ return get_gedcom_blocks($gedcom_id);
+ }
+}
+
+function get_block_setting($block_id, $setting_name, $default_value=null) {
+ global $TBLPREFIX;
+
+ $value=
+ WT_DB::prepare("SELECT setting_value FROM {$TBLPREFIX}block_setting WHERE block_id=? AND setting_name=?")
+ ->execute(array($block_id, $setting_name))
+ ->fetchOne();
+
+ if (is_null($value)) {
+ return $default_value;
+ } else {
+ return $value;
+ }
+}
+
+function set_block_setting($block_id, $setting_name, $setting_value) {
+ global $TBLPREFIX;
+
+ if (is_null($setting_value)) {
+ WT_DB::prepare("DELETE FROM {$TBLPREFIX}block_setting WHERE block_id=? AND setting_name=?")
+ ->execute(array($block_id, $setting_name));
+ } else {
+ WT_DB::prepare("REPLACE INTO {$TBLPREFIX}block_setting (block_id, setting_name, setting_value) VALUES (?, ?, ?)")
+ ->execute(array($block_id, $setting_name, $setting_value));
+ }
+}
+
+
/**
* update favorites regarding a merge of records
*
diff --git a/index.php b/index.php
index 959544300c..da18d43e84 100644
--- a/index.php
+++ b/index.php
@@ -31,70 +31,11 @@
define('WT_SCRIPT_NAME', 'index.php');
require './includes/session.php';
require_once WT_ROOT.'includes/index_cache.php';
-require_once WT_ROOT.'includes/functions/functions_print_facts.php'; //--needed for the expand url function in some of the blocks
if (isset($_REQUEST['action'])) $action = $_REQUEST['action'];
if (isset($_REQUEST['ctype'])) $ctype = $_REQUEST['ctype'];
-$message_id = safe_GET('message_id');
-$gid = safe_POST('gid');
-$favnote = safe_POST('favnote');
-$favtype = safe_POST('favtype');
-$url = safe_POST('url', WT_REGEX_URL);
-$favtitle = safe_POST('favtitle');
-$fv_id = safe_GET('fv_id');
$news_id = safe_GET('news_id');
-/**
- * Block definition array
- *
- * The following block definition array defines the
- * blocks that can be used to customize the portals
- * their names and the function to call them
- * 'name' is the name of the block in the lists
- * 'descr' is a description of this block
- * 'type' the options are 'user' or 'gedcom' or 'both'
- * - The type determines which lists the block is available in.
- * - Leaving the type undefined allows it to be on both the user and gedcom portal
- * @global $WT_BLOCKS
- */
-
-/**
- * Load List of Blocks in blocks directory (unchanged)
- */
-$WT_BLOCKS = array();
-$d = opendir('blocks');
-while (false !== ($f=readdir($d))) {
- if (preg_match('/\.php$/', $f)>0) {
- require_once WT_ROOT.'blocks/'.$f;
- }
-}
-closedir($d);
-/**
- * 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
-*/
-
$time = client_time();
if (!isset($action)) $action='';
@@ -115,120 +56,11 @@ if (empty($ctype)) {
else $ctype = 'user';
}
-if (WT_USER_ID) {
- //-- add favorites action
- if ($action=='addfav' && !empty($gid)) {
- $gid = strtoupper($gid);
- $indirec = find_gedcom_record($gid, WT_GED_ID);
- $ct = preg_match('/0 @(.*)@ (.*)/', $indirec, $match);
- if ($indirec && $ct>0) {
- $favorite = array();
- if (empty($favtype)) {
- if ($ctype=='user') $favtype = 'user';
- else $favtype = 'gedcom';
- }
- if ($favtype=='gedcom') {
- $favtype = $GEDCOM;
- $_SESSION['clearcache'] = true;
- }
- else $favtype=WT_USER_NAME;
- $favorite['username'] = $favtype;
- $favorite['gid'] = $gid;
- $favorite['type'] = trim($match[2]);
- $favorite['file'] = $GEDCOM;
- $favorite['url'] = '';
- $favorite['note'] = $favnote;
- $favorite['title'] = '';
- addFavorite($favorite);
- }
- }
- if (($action=='addfav')&&(!empty($url))) {
- if (empty($favtitle)) $favtitle = $url;
- $favorite = array();
- if (!isset($favtype)) {
- if ($ctype=='user') $favtype = 'user';
- else $favtype = 'gedcom';
- }
- if ($favtype=='gedcom') {
- $favtype = $GEDCOM;
- $_SESSION['clearcache'] = true;
- }
- else $favtype=WT_USER_NAME;
- $favorite['username'] = $favtype;
- $favorite['gid'] = '';
- $favorite['type'] = 'URL';
- $favorite['file'] = $GEDCOM;
- $favorite['url'] = $url;
- $favorite['note'] = $favnote;
- $favorite['title'] = $favtitle;
- addFavorite($favorite);
- }
- if (($action=='deletefav')&&(!empty($fv_id))) {
- deleteFavorite($fv_id);
- if ($ctype=='gedcom') $_SESSION['clearcache'] = true;
- }
- else if ($action=='deletemessage') {
- if (isset($message_id)) {
- if (!is_array($message_id)) deleteMessage($message_id);
- else {
- foreach($message_id as $indexval => $mid) {
- if (isset($mid)) deleteMessage($mid);
- }
- }
- if ($ctype=='gedcom') $_SESSION['clearcache'] = true;
- }
- }
- else if (($action=='deletenews')&&(isset($news_id))) {
- deleteNews($news_id);
- if ($ctype=='gedcom') $_SESSION['clearcache'] = true;
- }
-}
-
//-- get the blocks list
if ($ctype=='user') {
- $ublocks = getBlocks(WT_USER_NAME);
- if ((count($ublocks['main'])==0) && (count($ublocks['right'])==0)) {
- $ublocks['main'][] = array('print_todays_events', '');
- $ublocks['main'][] = array('print_user_messages', '');
- $ublocks['main'][] = array('print_user_favorites', '');
-
- $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 ((count($ublocks['main'])==0) && (count($ublocks['right'])==0)) {
- $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('print_gedcom_block', '');
- $ublocks['right'][] = array('print_random_media', '');
- $ublocks['right'][] = array('print_todays_events', '');
- $ublocks['right'][] = array('print_logged_in_users', '');
- }
-}
-
-//-- Set some behaviour controls that depend on which blocks are selected
-$welcome_block_present = false;
-$gedcom_block_present = false;
-$top10_block_present = false;
-$login_block_present = false;
-foreach($ublocks['right'] as $block) {
- if ($block[0]=='print_welcome_block') $welcome_block_present = true;
- if ($block[0]=='print_gedcom_block') $gedcom_block_present = true;
- if ($block[0]=='print_block_name_top10') $top10_block_present = true;
- if ($block[0]=='print_login_block') $login_block_present = true;
-}
-foreach($ublocks['main'] as $block) {
- if ($block[0]=='print_welcome_block') $welcome_block_present = true;
- if ($block[0]=='print_gedcom_block') $gedcom_block_present = true;
- if ($block[0]=='print_block_name_top10') $top10_block_present = true;
- if ($block[0]=='print_login_block') $login_block_present = true;
+ $blocks=get_user_blocks(WT_USER_ID);
+} else {
+ $blocks=get_gedcom_blocks(WT_GED_ID);
}
//-- clear the GEDCOM cache files
@@ -240,66 +72,33 @@ if (!empty($_SESSION['clearcache'])) {
// We have finished writing to $_SESSION, so release the lock
session_write_close();
-//-- handle block AJAX calls
-/**
- * In order for a block to make an AJAX call the following request parameters must be set
- * block = the method name of the block to call (e.g. 'print_random_media')
- * side = the side of the page the block is on (e.g. 'main' or 'right')
- * bindex = the number of the block on that side, first block = 0
- */
+$all_blocks=WT_Module::getActiveBlocks();
+
+// We generate individual blocks using AJAX
if ($action=='ajax') {
header('Content-Type: text/html; charset=UTF-8');
- //-- if a block wasn't sent then exit with nothing
- if (!isset($_REQUEST['block'])) {
- echo 'Block not sent';
+ // Check we're displaying an allowable block.
+ $block_id=safe_GET('block_id');
+ if (array_key_exists($block_id, $blocks['main'])) {
+ $module_name=$blocks['main'][$block_id];
+ } elseif (array_key_exists($block_id, $blocks['side'])) {
+ $module_name=$blocks['side'][$block_id];
+ } else {
exit;
}
- $block = $_REQUEST['block'];
- //-- set which side the block is on
- $side = 'main';
- if (isset($_REQUEST['side'])) $side = $_REQUEST['side'];
- //-- get the block number
- if (isset($_REQUEST['bindex'])) {
- if (isset($ublocks[$side][$_REQUEST['bindex']])) {
- $blockval = $ublocks[$side][$_REQUEST['bindex']];
- if ($blockval[0]==$block && array_key_exists($blockval[0], $WT_BLOCKS)) {
- if ($side=='main') {
- $param1 = 'false';
- } else {
- $param1 = 'true';
- }
- if (array_key_exists($blockval[0], $WT_BLOCKS) && !loadCachedBlock($blockval, $side.$_REQUEST['bindex'])) {
- ob_start();
- eval($blockval[0]."($param1, \$blockval[1], \"$side\", ".$_REQUEST['bindex'].");");
- $content = ob_get_contents();
- saveCachedBlock($blockval, $side.$_REQUEST['bindex'], $content);
- ob_end_flush();
- }
- if (WT_DEBUG) {
- echo execution_stats();
- }
- if (WT_DEBUG_SQL) {
- echo WT_DB::getQueryLog();
- }
- exit;
- }
- }
+ if (array_key_exists($module_name, $all_blocks)) {
+ $class_name=$module_name.'_WT_Module';
+ $module=new $class_name;
+ $module->getBlock($block_id);
}
-
- //-- not sure which block to call so call the first one we find
- foreach($ublocks['main'] as $bindex=>$blockval) {
- if ($blockval[0]==$block && array_key_exists($blockval[0], $WT_BLOCKS)) {
- eval($blockval[0]."(false, \$blockval[1], \"main\", $bindex);");
- }
+ if (WT_DEBUG) {
+ echo execution_stats();
}
- foreach($ublocks['right'] as $bindex=>$blockval) {
- if ($blockval[0]==$block && array_key_exists($blockval[0], $WT_BLOCKS)) {
- eval($blockval[0]."(true, \$blockval[1], \"right\", $bindex);");
- }
+ if (WT_DEBUG_SQL) {
+ echo WT_DB::getQueryLog();
}
exit;
}
-//-- end of ajax call handler
if ($ctype=='user') {
$helpindex = 'index_myged_help';
@@ -313,6 +112,7 @@ if (WT_USE_LIGHTBOX) {
require WT_ROOT.'modules/lightbox/functions/lb_call_js.php';
}
+// TODO: these should be moved to their respective module/block
echo WT_JS_START;
?>
function refreshpage() {
@@ -328,126 +128,70 @@ echo WT_JS_START;
function paste_id(value) {
pastefield.value=value;
}
-/**
- * blocks may use this JS function to update themselves using AJAX technology
- * @param string targetId the id of the block to target the results too
- * @param string block the method name of the block to call (e.g. 'print_random_media')
- * @param string side the side of the page the block is on (e.g. 'main' or 'right')
- * @param int bindex the number of the block on that side, first block = 0
- * @param string ctype shows whether block is on Welcome or My Page ('gedcom' or 'user')
- * @param boolean loading Whether or not to show the loading message
- */
- function ajaxBlock(targetId, block, side, bindex, ctype, loading) {
- target = document.getElementById(targetId);
- if (!target) return false;
-
- target.style.height = (target.offsetHeight) + "px";
- if (loading) target.innerHTML = "<br /><br /><?php echo i18n::translate('Loading...'); ?><br /><br />";
-
- var oXmlHttp = createXMLHttp();
- link = "index.php?action=ajax&block="+block+"&side="+side+"&bindex="+bindex+"&ctype="+ctype;
- oXmlHttp.open("get", link, true);
- oXmlHttp.onreadystatechange=function()
- {
- if (oXmlHttp.readyState==4)
- {
- target.innerHTML = oXmlHttp.responseText;
- target.style.height = 'auto';
- }
- };
- oXmlHttp.send(null);
- return false;
- }
<?php
echo WT_JS_END;
//-- start of main content section
-echo '<table width="100%"><tr><td>'; // This is needed so that page footers print in the right place
if ($ctype=='user') {
- echo '<div align="center" style="width: 99%;">';
+ echo '<div align="center">';
echo '<h1>', i18n::translate('My Page'), '</h1>';
echo i18n::translate('My Page allows you to keep bookmarks of your favorite people, track upcoming events, and collaborate with other webtrees users.');
echo '<br /><br /></div>';
}
-if (count($ublocks['main'])!=0) {
- if (count($ublocks['right'])!=0) {
+echo '<script src="js/jquery/jquery.min.js" type="text/javascript"></script>';
+echo '<script type="text/javascript">jQuery.noConflict();</script>';
+if ($blocks['main']) {
+ if ($blocks['side']) {
echo '<div id="index_main_blocks">';
} else {
echo '<div id="index_full_blocks">';
}
- echo '<script src="js/jquery/jquery.min.js" type="text/javascript"></script>';
- echo '<script type="text/javascript">jQuery.noConflict();</script>';
- foreach($ublocks['main'] as $bindex=>$block) {
- if (WT_DEBUG) {
- echo execution_stats();
- }
- if (array_key_exists($block[0], $WT_BLOCKS) && !loadCachedBlock($block, 'main'.$bindex)) {
- $url="index.php?action=ajax&block={$block[0]}&side=main&bindex={$bindex}&ctype={$ctype}";
- if ($SEARCH_SPIDER || WT_DEBUG) {
- // Search spiders get the blocks directly
- ob_start();
- eval($block[0]."(false, \$block[1], \"main\", $bindex);");
- $content = ob_get_contents();
- $temp = $SEARCH_SPIDER;
- $SEARCH_SPIDER = false;
- saveCachedBlock($block, 'main'.$bindex, $content);
- $SEARCH_SPIDER = $temp;
- ob_end_flush();
- } else {
- // Interactive users get the blocks via ajax
- echo '<div id="block_main_', $bindex, '"><img src="images/loading.gif" alt="', htmlspecialchars(i18n::translate('Loading...')), '"/></div>';
- echo WT_JS_START, "jQuery('#block_main_{$bindex}').load('{$url}');", WT_JS_END;
- }
+ foreach ($blocks['main'] as $block_id=>$module_name) {
+ $class_name=$module_name.'_WT_Module';
+ $module=new $class_name;
+ if ($SEARCH_SPIDER || !$module->canLoadAjax()) {
+ // Load the block directly
+ $module->getBlock($block_id);
+ } else {
+ // Load the block asynchronously
+ echo '<div id="block_', $block_id, '"><img src="images/loading.gif" alt="', htmlspecialchars(i18n::translate('Loading...')), '"/></div>';
+ echo WT_JS_START, "jQuery('#block_{$block_id}').load('index.php?ctype={$ctype}&action=ajax&block_id={$block_id}');", WT_JS_END;
}
}
echo '</div>';
}
-//-- end of main content section
-//-- start of blocks section
-if (count($ublocks['right'])!=0) {
- if (count($ublocks['main'])!=0) {
+if ($blocks['side']) {
+ if ($blocks['main']) {
echo '<div id="index_small_blocks">';
} else {
echo '<div id="index_full_blocks">';
}
- foreach($ublocks['right'] as $bindex=>$block) {
- if (WT_DEBUG) {
- echo execution_stats();
- }
- if (array_key_exists($block[0], $WT_BLOCKS) && !loadCachedBlock($block, 'right'.$bindex)) {
- $url="index.php?action=ajax&block={$block[0]}&side=right&bindex={$bindex}&ctype={$ctype}";
- if ($SEARCH_SPIDER || WT_DEBUG) {
- // Search spiders get the blocks directly
- ob_start();
- eval($block[0]."(true, \$block[1], \"right\", $bindex);");
- $content = ob_get_contents();
- saveCachedBlock($block, 'right'.$bindex, $content);
- ob_end_flush();
- } else {
- // Interactive users get the blocks via ajax
- echo '<div id="block_right_', $bindex, '"><img src="images/loading.gif" alt="', htmlspecialchars(i18n::translate('Loading...')), '"/></div>';
- echo WT_JS_START, "jQuery('#block_right_{$bindex}').load('{$url}');", WT_JS_END;
- }
+ foreach ($blocks['side'] as $block_id=>$module_name) {
+ $class_name=$module_name.'_WT_Module';
+ $module=new $class_name;
+ if ($SEARCH_SPIDER || !$module->canLoadAjax()) {
+ // Load the block directly
+ $module->getBlock($block_id);
+ } else {
+ // Load the block asynchronously
+ echo '<div id="block_', $block_id, '"><img src="images/loading.gif" alt="', htmlspecialchars(i18n::translate('Loading...')), '"/></div>';
+ echo WT_JS_START, "jQuery('#block_{$block_id}').load('index.php?ctype={$ctype}&action=ajax&block_id={$block_id}');", WT_JS_END;
}
}
echo '</div>';
}
-//-- end of blocks section
-echo '</td></tr></table><br />'; // Close off that table
-
-if ($ctype=='user' && !$welcome_block_present) {
- echo '<div align="center" style="width: 99%;">';
+// Ensure there is always way to configure the blocks
+if ($ctype=='user' && !in_array('user_welcome', $blocks['main']) && !in_array('user_welcome', $blocks['side'])) {
+ echo '<div align="center">';
echo "<a href=\"javascript:;\" onclick=\"window.open('index_edit.php?name=".WT_USER_NAME."&ctype=user', '_blank', 'top=50,left=10,width=600,height=500,scrollbars=1,resizable=1');\">".i18n::translate('Customize My Page').'</a>';
echo help_link('mygedview_customize');
echo '</div>';
}
-if ($ctype=='gedcom' && !$gedcom_block_present) {
- if (WT_USER_IS_ADMIN) {
- echo '<div align="center" style="width: 99%;">';
- echo "<a href=\"javascript:;\" onclick=\"window.open('".encode_url("index_edit.php?name={$GEDCOM}&ctype=gedcom", false)."', '_blank', 'top=50,left=10,width=600,height=500,scrollbars=1,resizable=1');\">".i18n::translate('Customize this GEDCOM Home Page').'</a>';
- echo '</div>';
- }
+if (WT_USER_IS_ADMIN && $ctype=='gedcom' && !in_array('gedcom_block', $blocks['main']) && !in_array('gedcom_block', $blocks['side'])) {
+ echo '<div align="center">';
+ echo "<a href=\"javascript:;\" onclick=\"window.open('".encode_url("index_edit.php?name={$GEDCOM}&ctype=gedcom", false)."', '_blank', 'top=50,left=10,width=600,height=500,scrollbars=1,resizable=1');\">".i18n::translate('Customize this GEDCOM Home Page').'</a>';
+ echo '</div>';
}
print_footer();
diff --git a/index_edit.php b/index_edit.php
index 2fcfef7ffe..f75d2116f2 100644
--- a/index_edit.php
+++ b/index_edit.php
@@ -62,6 +62,8 @@ if (!isset($setdefault)) $setdefault=false;
if (!isset($side)) $side='main';
if (!isset($index)) $index=1;
+$block_id=safe_REQUEST($_REQUEST, 'block_id');
+
// Define all the icons we're going to use
$IconUarrow = "<img src=\"".$WT_IMAGE_DIR.'/'.$WT_IMAGES['uarrow']['other']."\" width=\"20\" height=\"20\" alt=\"\" />";
$IconDarrow = "<img src=\"".$WT_IMAGE_DIR.'/'.$WT_IMAGES['darrow']['other']."\" width=\"20\" height=\"20\" alt=\"\" />";
@@ -70,86 +72,25 @@ $IconLarrow = "<img src=\"".$WT_IMAGE_DIR.'/'.$WT_IMAGES['larrow']['other']."\"
$IconRDarrow = "<img src=\"".$WT_IMAGE_DIR.'/'.$WT_IMAGES['rdarrow']['other']."\" width=\"20\" height=\"20\" alt=\"\" />";
$IconLDarrow = "<img src=\"".$WT_IMAGE_DIR.'/'.$WT_IMAGES['ldarrow']['other']."\" width=\"20\" height=\"20\" alt=\"\" />";
-/**
- * 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'];
+$all_blocks=array();
+foreach (WT_Module::getActiveBlocks() as $name=>$block) {
+ if ($ctype=='user' && $block->isUserBlock() || $ctype=='gedcom' && $block->isGedcomBlock()) {
+ $all_blocks[$name]=$block;
}
}
-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', '');
+ if ($action=='reset') {
+ WT_DB::prepare("DELETE {$TBLPREFIX}block_setting FROM {$TBLPREFIX}block_setting JOIN {$TBLPREFIX}block USING (block_id) WHERE user_id=?")->execute(array(WT_USER_ID));
+ WT_DB::prepare("DELETE FROM {$TBLPREFIX}block WHERE user_id=?")->execute(array(WT_USER_ID));
}
+ $blocks=get_user_blocks(WT_USER_ID);
} 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 ($action=='reset') {
+ WT_DB::prepare("DELETE {$TBLPREFIX}block_setting FROM {$TBLPREFIX}block_setting JOIN {$TBLPREFIX}block USING (block_id) WHERE gedcom_id=?")->execute(array(WT_GED_ID));
}
+ $blocks=get_gedcom_blocks(WT_GED_ID);
}
if ($ctype=='user') {
@@ -158,62 +99,34 @@ if ($ctype=='user') {
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;
- }
+ foreach (array('main', 'side') as $location) {
+ if ($location=='main') {
+ $new_blocks=$main;
+ } else {
+ $new_blocks=$right;
+ }
+ // Deleted blocks
+ foreach ($blocks[$location] as $block_id=>$block_name) {
+ if (!in_array($block_id, $new_blocks)) {
+ WT_DB::prepare("DELETE FROM {$TBLPREFIX}block_setting WHERE block_id=?")->execute(array($block_id));
+ WT_DB::prepare("DELETE FROM {$TBLPREFIX}block WHERE block_id=?")->execute(array($block_id));
}
- 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;
+ foreach ($new_blocks as $order=>$block_name) {
+ if (is_numeric($block_name)) {
+ // existing block
+ WT_DB::prepare("UPDATE {$TBLPREFIX}block SET block_order=? WHERE block_id=?")->execute(array($order, $block_name));
+ } else {
+ // new block
+ if ($ctype=='user') {
+ WT_DB::prepare("INSERT INTO {$TBLPREFIX}block (user_id, location, block_order, module_name) VALUES (?, ?, ?, ?)")->execute(array(WT_USER_ID, $location, $order, $block_name));
+ } else {
+ WT_DB::prepare("INSERT INTO {$TBLPREFIX}block (gedcom_id, location, block_order, module_name) VALUES (?, ?, ?, ?)")->execute(array(WT_GED_ID, $location, $order, $block_name));
}
}
- 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;
@@ -224,14 +137,24 @@ if ($action=="clearcache") {
echo "<span class=\"warning\">".i18n::translate('The cache files have been removed.')."</span><br /><br />";
}
-if ($action=="configure" && isset($ublocks[$side][$index])) {
- $block = $ublocks[$side][$index];
+//var_dump($blocks);die("eek");
+if ($action=="configure") {
+ if (array_key_exists($block_id, $blocks['main'])) {
+ $block_name=$blocks['main'][$block_id];
+ } elseif (array_key_exists($block_id, $blocks['side'])) {
+ $block_name=$blocks['side'][$block_id];
+ } else {
+ echo WT_JS_START, 'window.close();', WT_JS_END;
+ exit;
+ }
+ $class_name=$block_name.'_WT_Module';
+ $block=new $class_name;
echo "<table class=\"facts_table ".$TEXT_DIRECTION."\" width=\"99%\">";
echo "<tr><td class=\"facts_label\">";
echo "<h2>".i18n::translate('Configure')."</h2>";
echo "</td></tr>";
echo "<tr><td class=\"facts_label03\">";
- echo "<b>".$WT_BLOCKS[$block[0]]["name"]."</b>";
+ echo "<b>".$block->getTitle()."</b>";
echo "</td></tr>";
echo "</table>";
?>
@@ -244,32 +167,17 @@ if ($action=="configure" && isset($ublocks[$side][$index])) {
//-->
</script>
<?php
- echo "\n<form name=\"block\" method=\"post\" action=\"index_edit.php\">\n";
- echo "<input type=\"hidden\" name=\"ctype\" value=\"$ctype\" />\n";
- echo "<input type=\"hidden\" name=\"action\" value=\"updateconfig\" />\n";
- echo "<input type=\"hidden\" name=\"name\" value=\"$name\" />\n";
- echo "<input type=\"hidden\" name=\"nextaction\" value=\"configure\" />\n";
- echo "<input type=\"hidden\" name=\"side\" value=\"$side\" />\n";
- echo "<input type=\"hidden\" name=\"index\" value=\"$index\" />\n";
- echo "<table border=\"0\" class=\"facts_table ".$TEXT_DIRECTION."\" width=\"99%\">";
- if ($WT_BLOCKS[$block[0]]["canconfig"]) {
- eval($block[0]."_config(\$block[1]);");
- echo "<tr><td colspan=\"2\" class=\"topbottombar\">";
- echo "<input type=\"button\" value=\"".i18n::translate('Save')."\" onclick=\"document.block.submit();\" />";
- echo "&nbsp;&nbsp;<input type =\"button\" value=\"".i18n::translate('Cancel')."\" onclick=\"window.close()\" />";
- echo "</td></tr>";
- } else {
- echo "<tr><td colspan=\"2\" class=\"optionbox\">";
- echo i18n::translate('This block cannot be configured.');
- echo "</td></tr>";
- echo "<tr><td colspan=\"2\" class=\"topbottombar\">";
- echo "<input type=\"button\" value=\"".i18n::translate('Save')."\" onclick=\"opener.window.location.reload(); window.close();\" />";
- echo "</td></tr>";
- }
+ echo "\n<form name=\"block\" method=\"post\" action=\"index_edit.php?action=configure&amp;ctype={$ctype}&amp;block_id=", $block_id, "\">\n";
+ echo "<input type=\"hidden\" name=\"save\" value=\"1\" />\n";
+ echo "<table border=\"0\" class=\"facts_table ".$TEXT_DIRECTION."\">";
+ $block->configureBlock($block_id);
+ echo "<tr><td colspan=\"2\" class=\"topbottombar\">";
+ echo "<input type=\"button\" value=\"".i18n::translate('Save')."\" onclick=\"document.block.submit();\" />";
+ echo "&nbsp;&nbsp;<input type =\"button\" value=\"".i18n::translate('Cancel')."\" onclick=\"window.close()\" />";
+ echo "</td></tr>";
echo "</table>";
echo "</form>";
-}
-else {
+} else {
?>
<script language="JavaScript" type="text/javascript">
<!--
@@ -358,8 +266,8 @@ else {
*/
<?php
echo "var block_descr = new Array();\n";
- foreach ($WT_BLOCKS as $b=>$block) {
- echo "block_descr['$b'] = '".str_replace("'", "\\'", embed_globals($block["descr"]))."';\n";
+ foreach ($all_blocks as $block_name=>$block) {
+ echo "block_descr['$block_name'] = '".str_replace("'", "\\'", $block->getDescription())."';\n";
}
echo "block_descr['advice1'] = '".str_replace("'", "\\'", i18n::translate('Highlight a block name and then click on one of the arrow icons to move that highlighted block in the indicated direction.'))."';\n";
?>
@@ -440,10 +348,8 @@ else {
// NOTE: Row 2 column 2: Left (Main) block list
echo "<td class=\"optionbox\" dir=\"".$TEXT_DIRECTION."\">\n";
echo "<select multiple=\"multiple\" id=\"main_select\" name=\"main[]\" size=\"10\" onchange=\"show_description('main_select');\">\n";
- foreach($ublocks["main"] as $indexval => $block) {
- if (function_exists($block[0])) {
- echo "<option value=\"$block[0]\">".$WT_BLOCKS[$block[0]]["name"]."</option>\n";
- }
+ foreach($blocks['main'] as $block_id=>$block_name) {
+ echo "<option value=\"$block_id\">".$all_blocks[$block_name]->getTitle()."</option>\n";
}
echo "</select>\n";
echo "</td>";
@@ -461,8 +367,8 @@ else {
// Row 2 column 4: Middle (Available) block list
echo "<td class=\"optionbox\" dir=\"".$TEXT_DIRECTION."\">";
echo "<select id=\"available_select\" name=\"available[]\" size=\"10\" onchange=\"show_description('available_select');\">\n";
- foreach($SortedBlocks as $key => $value) {
- echo "<option value=\"$key\">".$SortedBlocks[$key]."</option>\n";
+ foreach($all_blocks as $block_name=>$block) {
+ echo "<option value=\"$block_name\">".$block->getTitle()."</option>\n";
}
echo "</select>\n";
echo "</td>";
@@ -479,10 +385,8 @@ else {
// NOTE: Row 2 column 6: Right block list
echo "<td class=\"optionbox\" dir=\"".$TEXT_DIRECTION."\">";
echo "<select multiple=\"multiple\" id=\"right_select\" name=\"right[]\" size=\"10\" onchange=\"show_description('right_select');\">\n";
- foreach($ublocks["right"] as $indexval => $block) {
- if (function_exists($block[0])) {
- echo "<option value=\"$block[0]\">".$WT_BLOCKS[$block[0]]["name"]."</option>\n";
- }
+ foreach($blocks['side'] as $block_id=>$block_name) {
+ echo "<option value=\"$block_id\">".$all_blocks[$block_name]->getTitle()."</option>\n";
}
echo "</select>\n";
echo "</td>";
diff --git a/blocks/block_htmlplus_keywords.tpl b/modules/block_htmlplus/block_htmlplus_keywords.tpl
index 0145950490..0145950490 100644
--- a/blocks/block_htmlplus_keywords.tpl
+++ b/modules/block_htmlplus/block_htmlplus_keywords.tpl
diff --git a/blocks/block_htmlplus_narrative.tpl b/modules/block_htmlplus/block_htmlplus_narrative.tpl
index abddad6c73..abddad6c73 100644
--- a/blocks/block_htmlplus_narrative.tpl
+++ b/modules/block_htmlplus/block_htmlplus_narrative.tpl
diff --git a/blocks/block_htmlplus_stats.tpl b/modules/block_htmlplus/block_htmlplus_stats.tpl
index 1e94994a8b..1e94994a8b 100644
--- a/blocks/block_htmlplus_stats.tpl
+++ b/modules/block_htmlplus/block_htmlplus_stats.tpl
diff --git a/modules/block_htmlplus/module.php b/modules/block_htmlplus/module.php
index 541d71c6d2..506e638d82 100644
--- a/modules/block_htmlplus/module.php
+++ b/modules/block_htmlplus/module.php
@@ -22,8 +22,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * @package webtrees
- * @subpackage Modules
* @version $Id: class_media.php 5451 2009-05-05 22:15:34Z fisharebest $
*/
@@ -46,12 +44,281 @@ class block_htmlplus_WT_Module extends WT_Module implements WT_Module_Block {
}
// Implement class WT_Module_Block
- public function getBlock($block, $config, $side, $index) {
- // Generate the block contents
+ public function getBlock($block_id) {
+ global $ctype, $GEDCOM, $WT_IMAGE_DIR, $WT_IMAGES, $TEXT_DIRECTION, $MULTI_MEDIA, $SHOW_ID_NUMBERS, $THEME_DIR;
+
+ /*
+ * Select GEDCOM
+ */
+ $gedcom=get_block_setting($block_id, 'gedcom');
+ switch($gedcom) {
+ case '__current__':
+ break;
+ case '':
+ break;
+ case '__default__':
+ $GEDCOM=get_site_setting('DEFAULT_GEDCOM');
+ if (!$GEDCOM) {
+ foreach (get_all_gedcoms() as $gedcom) {
+ $GEDCOM=$gedcom;
+ break;
+ }
+ }
+ break;
+ default:
+ if (get_gedcom_setting(get_gedcom_from_id($gedcom), 'imported')) {
+ $GEDCOM = $gedcom;
+ }
+ break;
+ }
+
+ /*
+ * Initiate the stats object.
+ */
+ if (get_block_setting($block_id, 'compat')) {
+ require_once WT_ROOT.'includes/classes/class_stats_compat.php';
+ $stats = new stats_compat($GEDCOM);
+ } elseif(get_block_setting($block_id, 'ui')) {
+ require_once WT_ROOT.'includes/classes/class_stats_ui.php';
+ $stats = new stats_ui($GEDCOM);
+ } else {
+ require_once WT_ROOT.'includes/classes/class_stats.php';
+ $stats = new stats($GEDCOM);
+ }
+
+ // Make some values from the GEDCOM's 0 HEAD record visible to the world
+ global $CREATED_SOFTWARE, $CREATED_VERSION, $CREATED_DATE;
+ $CREATED_SOFTWARE = $stats->gedcomCreatedSoftware();
+ $CREATED_VERSION = $stats->gedcomCreatedVersion();
+ $CREATED_DATE = $stats->gedcomDate();
+
+ /*
+ * First Pass.
+ * Handle embedded language, fact, global, etc. references
+ * This needs to be done first because the language variables could themselves
+ * contain embedded keywords.
+ */
+ // Title
+ $title_tmp=embed_globals(get_block_setting($block_id, 'title'));
+ $html =embed_globals(get_block_setting($block_id, 'html'));
+ /*
+ * Second Pass.
+ */
+ list($new_tags, $new_values) = $stats->getTags("{$title_tmp} {$html}");
+ // Title
+ if (strstr($title_tmp, '#')){$title_tmp = str_replace($new_tags, $new_values, $title_tmp);}
+ // Content
+ $html = str_replace($new_tags, $new_values, $html);
+
+ /*
+ * Restore Current GEDCOM
+ */
+ $GEDCOM = WT_GEDCOM;
+
+ /*
+ * Start Of Output
+ */
+ $id=$this->getName().$block_id;
+ $title='';
+ if ($ctype=="gedcom" && WT_USER_GEDCOM_ADMIN || $ctype=="user" && WT_USER_ID) {
+ if ($ctype=="gedcom") {
+ $name = WT_GEDCOM;
+ } else {
+ $name = WT_USER_NAME;
+ }
+ $title .= "<a href=\"javascript: configure block\" onclick=\"window.open('index_edit.php?action=configure&amp;ctype={$ctype}&amp;block_id={$block_id}', '_blank', 'top=50,left=50,width=600,height=350,scrollbars=1,resizable=1'); return false;\">"
+ ."<img class=\"adminicon\" src=\"{$WT_IMAGE_DIR}/{$WT_IMAGES['admin']['small']}\" width=\"15\" height=\"15\" border=\"0\" alt=\"".i18n::translate('Configure').'" /></a>';
+ ;
+ }
+ if (WT_USER_GEDCOM_ADMIN) {
+ $title .= help_link('index_htmlplus_a');
+ } else {
+ $title .= help_link('index_htmlplus');
+ }
+ $title.=$title_tmp;
+
+ $content = $html;
+
+ $block=get_block_setting($block_id, 'block', false);
+ if ($block) {
+ require $THEME_DIR.'templates/block_small_temp.php';
+ } else {
+ require $THEME_DIR.'templates/block_main_temp.php';
+ }
+ }
+
+ // Implement class WT_Module_Block
+ public function canLoadAjax() {
+ return true;
+ }
+
+ // Implement class WT_Module_Block
+ public function isUserBlock() {
+ return true;
+ }
+
+ // Implement class WT_Module_Block
+ public function isGedcomBlock() {
+ return true;
}
// Implement class WT_Module_Block
- public function configureBlock() {
- // Create an edit form, and respond to the result
+ public function configureBlock($block_id) {
+ if (safe_POST_bool('save')) {
+ set_block_setting($block_id, 'compat', safe_POST_bool('compat'));
+ set_block_setting($block_id, 'ui', safe_POST_bool('ui'));
+ set_block_setting($block_id, 'gedcom', safe_POST('gedcom'));
+ set_block_setting($block_id, 'title', $_POST['title']);
+ set_block_setting($block_id, 'html', $_POST['html']);
+ echo WT_JS_START, 'window.opener.location.href=window.opener.location.href;window.close();', WT_JS_END;
+ exit;
+ }
+
+ $useFCK = file_exists(WT_ROOT.'modules/FCKeditor/fckeditor.php');
+ if($useFCK){
+ require WT_ROOT.'modules/FCKeditor/fckeditor.php';
+ }
+
+ $templates = array();
+ $d = dir(WT_ROOT.'modules/block_htmlplus');
+ while(false !== ($entry = $d->read()))
+ {
+ if(strstr($entry, 'block_htmlplus_'))
+ {
+ $tpl = file(WT_ROOT."modules/block_htmlplus/{$entry}");
+ $info = array_shift($tpl);
+ $bits = explode('|', $info);
+ if(count($bits) != 2)
+ {
+ $bits = array($entry, '');
+ }
+ $templates[] = array(
+ 'filename' =>$entry,
+ 'title' =>$bits[0],
+ 'description' =>$bits[1],
+ 'template' =>htmlspecialchars(join('', $tpl),ENT_COMPAT,'UTF-8')
+ );
+ }
+ }
+ $d->close();
+
+ $title=get_block_setting($block_id, 'title');
+ $html=get_block_setting($block_id, 'html');
+ // title
+ print "<tr><td class=\"descriptionbox wrap width33\">"
+ .i18n::translate('TITL')
+ .help_link('index_htmlplus_title')
+ ."</td><td class=\"optionbox\"><input type=\"text\" name=\"title\" size=\"30\" value=\"".htmlspecialchars($title)."\" /></td></tr>"
+ ;
+
+ // templates
+ print "<tr><td class=\"descriptionbox wrap width33\">"
+ .i18n::translate('Templates')
+ .help_link('index_htmlplus_template')
+ ."</td><td class=\"optionbox\">"
+ ;
+ if($useFCK)
+ {
+ print "\t\t\t<script language=\"JavaScript\" type=\"text/javascript\">\n"
+ ."\t\t\t<!--\n"
+ ."\t\t\t\tfunction loadTemplate(html)\n"
+ ."\t\t\t\t{\n"
+ ."\t\t\t\t\tvar oEditor = FCKeditorAPI.GetInstance('html');\n"
+ ."\t\t\t\t\toEditor.SetHTML(html);\n"
+ ."\t\t\t\t}\n"
+ ."\t\t\t-->\n"
+ ."\t\t\t</script>\n"
+ ."\t\t\t<select name=\"template\" onchange=\"loadTemplate(document.block.template.options[document.block.template.selectedIndex].value);\">\n"
+ ;
+ }
+ else
+ {
+ print "\t\t\t<select name=\"template\" onchange=\"document.block.html.value=document.block.template.options[document.block.template.selectedIndex].value;\">\n";
+ }
+ print "\t\t\t\t<option value=\"\">".i18n::translate('Custom')."</option>\n";
+ foreach($templates as $tpl)
+ {
+ print "\t\t\t\t<option value=\"{$tpl['template']}\">{$tpl['title']}</option>\n";
+ }
+ print "\t\t\t</select>\n"
+ ."\t\t</td>\n\t</tr>\n"
+ ;
+
+ // gedcom
+ $gedcoms = get_all_gedcoms();
+ $gedcom=get_block_setting($block_id, 'gedcom');
+ if(count($gedcoms) > 1)
+ {
+ if($gedcom == '__current__'){$sel_current = ' selected="selected"';}else{$sel_current = '';}
+ if($gedcom == '__default__'){$sel_default = ' selected="selected"';}else{$sel_default = '';}
+ print "\t<tr>\n\t\t<td class=\"descriptionbox wrap width33\">"
+ .i18n::translate('Family Tree')
+ .help_link('index_htmlplus_gedcom')
+ ."</td><td class=\"optionbox\">\n"
+ ."\t\t\t<select name=\"gedcom\">\n"
+ ."\t\t\t\t<option value=\"__current__\"{$sel_current}>".i18n::translate('Current')."</option>\n"
+ ."\t\t\t\t<option value=\"__default__\"{$sel_default}>".i18n::translate('Default')."</option>\n"
+ ;
+ foreach($gedcoms as $ged_id=>$ged_name)
+ {
+ if($ged_name == $gedcom){$sel = ' selected="selected"';}else{$sel = '';}
+ print "\t\t\t\t<option value=\"{$ged_name}\"{$sel}>".PrintReady(get_gedcom_setting($ged_id, 'title'))."</option>\n";
+ }
+ print "\t\t\t</select>\n"
+ ."\t\t</td>\n\t</tr>\n"
+ ;
+ }
+
+ // html
+ print "\t<tr>\n\t\t<td class=\"descriptionbox wrap width33\">\n"
+ .i18n::translate('Content')
+ .help_link('index_htmlplus_content')
+ ."<br /><br /></td>"
+ ."<td class=\"optionbox\">"
+ ;
+ if($useFCK)
+ {
+ // use FCKeditor module
+ require_once WT_ROOT.'modules/FCKeditor/fckeditor.php';
+ $oFCKeditor = new FCKeditor('html') ;
+ $oFCKeditor->BasePath = './modules/FCKeditor/';
+ $oFCKeditor->Value = $html;
+ $oFCKeditor->Width = 700;
+ $oFCKeditor->Height = 250;
+ $oFCKeditor->Config['AutoDetectLanguage'] = false ;
+ $oFCKeditor->Config['DefaultLanguage'] = WT_LOCALE;
+ $oFCKeditor->Create() ;
+ }
+ else
+ {
+ //use standard textarea
+ print "<textarea name=\"html\" rows=\"10\" cols=\"80\">".htmlspecialchars($html)."</textarea>";
+ }
+
+ print "\n\t\t</td>\n\t</tr>\n";
+
+ // compatibility mode
+ $compat=get_block_setting($block_id, 'compat', false);
+ if($compat == 1){$compat = ' checked="checked"';}else{$compat = '';}
+ print "\t<tr>\n\t\t<td class=\"descriptionbox wrap width33\">"
+ .i18n::translate('Compatibility Mode')
+ .help_link('index_htmlplus_compat')
+ ."</td>\n<td class=\"optionbox\"><input type=\"checkbox\" name=\"compat\" value=\"1\"{$compat} /></td>\n"
+ ."\t</tr>\n"
+ ;
+
+ // extended features
+ $ui=get_block_setting($block_id, 'ui', false);
+ if ($ui == 1) {
+ $ui = ' checked="checked"';
+ } else {
+ $ui = '';
+ }
+ print "\t<tr>\n\t\t<td class=\"descriptionbox wrap width33\">"
+ .i18n::translate('Extended Interface')
+ .help_link('index_htmlplus_ui')
+ ."</td><td class=\"optionbox\"><input type=\"checkbox\" name=\"ui\" value=\"1\"{$ui} /></td>\n"
+ ."\t</tr>\n"
+ ;
}
}
diff --git a/modules/charts/module.php b/modules/charts/module.php
index eadbd290b6..38b2af26b4 100644
--- a/modules/charts/module.php
+++ b/modules/charts/module.php
@@ -22,8 +22,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * @package webtrees
- * @subpackage Modules
* @version $Id: class_media.php 5451 2009-05-05 22:15:34Z fisharebest $
*/
@@ -33,6 +31,8 @@ if (!defined('WT_WEBTREES')) {
}
require_once WT_ROOT.'includes/classes/class_module.php';
+require_once WT_ROOT.'includes/controllers/hourglass_ctrl.php';
+require_once WT_ROOT.'includes/classes/class_treenav.php';
class charts_WT_Module extends WT_Module implements WT_Module_Block {
// Extend class WT_Module
@@ -46,12 +46,183 @@ class charts_WT_Module extends WT_Module implements WT_Module_Block {
}
// Implement class WT_Module_Block
- public function getBlock($block, $config, $side, $index) {
- // Generate the block contents
+ public function getBlock($block_id) {
+ global $ctype, $WT_IMAGE_DIR, $WT_IMAGES, $PEDIGREE_ROOT_ID, $PEDIGREE_FULL_DETAILS, $show_full, $bwidth, $bheight, $THEME_DIR;
+
+ $details=get_block_setting($block_id, 'details', false);
+ $type =get_block_setting($block_id, 'type', 'treenav');
+ $pid =get_block_setting($block_id, 'pid', WT_USER_ID ? (WT_USER_GEDCOM_ID ? WT_USER_GEDCOM_ID : $PEDIGREE_ROOT_ID) : $PEDIGREE_ROOT_ID);
+
+ // Override GEDCOM configuration temporarily
+ if (isset($show_full)) $saveShowFull = $show_full;
+ $savePedigreeFullDetails = $PEDIGREE_FULL_DETAILS;
+ if (!$details) {
+ $show_full = 0;
+ // Here we could adjust the block width & height to accommodate larger displays
+ } else {
+ $show_full = 1;
+ // Here we could adjust the block width & height to accommodate larger displays
+ }
+ $PEDIGREE_FULL_DETAILS = $show_full;
+
+ if ($type!='treenav') {
+ $controller = new HourglassController();
+ $controller->init($pid,0,3);
+ $controller->setupJavascript();
+ } else {
+ $nav = new TreeNav($pid, 'blocknav',-1);
+ $nav->generations = 2;
+ }
+
+ $person = Person::getInstance($pid);
+ if ($person==null) {
+ $pid = $PEDIGREE_ROOT_ID;
+ set_block_setting($block_id, 'pid', $pid);
+ $person = Person::getInstance($pid);
+ }
+
+ $id=$this->getName().$block_id;
+ $title='';
+ if ($ctype=="gedcom" && WT_USER_GEDCOM_ADMIN || $ctype=="user" && WT_USER_ID) {
+ $title .= "<a href=\"javascript: configure block\" onclick=\"window.open('index_edit.php?action=configure&amp;ctype={ctype}&amp;block_id={$block_id}', '_blank', 'top=50,left=50,width=700,height=400,scrollbars=1,resizable=1'); return false;\">";
+ $title .= "<img class=\"adminicon\" src=\"$WT_IMAGE_DIR/".$WT_IMAGES["admin"]["small"]."\" width=\"15\" height=\"15\" border=\"0\" alt=\"".i18n::translate('Configure')."\" /></a>";
+ }
+ if ($person) {
+ $name=PrintReady($person->getFullName());
+ switch($type) {
+ case 'pedigree':
+ $title .= $name." ".i18n::translate('Pedigree Tree');
+ break;
+ case 'descendants':
+ $title .= $name." ".i18n::translate('Descendancy Chart');
+ break;
+ case 'hourglass':
+ $title .= $name." ".i18n::translate('Hourglass Chart');
+ break;
+ case 'treenav':
+ $title .= $name." ".i18n::translate('Tree');
+ break;
+ }
+ $title .= help_link('index_charts');
+ $content = "";
+ $content .= "<script src=\"js/webtrees.js\" language=\"JavaScript\" type=\"text/javascript\"></script>";
+ if ($show_full==0) {
+ $content .= '<center><span class="details2">'.i18n::translate('Click on any of the boxes to get more information about that person.').'</span></center><br />';
+ }
+ $content .= '<table cellspacing="0" cellpadding="0" border="0"><tr>';
+ if ($type=='descendants' || $type=='hourglass') {
+ $content .= "<td valign=\"middle\">";
+ ob_start();
+ $controller->print_descendency($person->getXref(), 1, false);
+ $content .= ob_get_clean();
+ $content .= "</td>";
+ }
+ if ($type=='pedigree' || $type=='hourglass') {
+ //-- print out the root person
+ if ($type!='hourglass') {
+ $content .= "<td valign=\"middle\">";
+ ob_start();
+ print_pedigree_person($person->getXref());
+ $content .= ob_get_clean();
+ $content .= "</td>";
+ }
+ $content .= "<td valign=\"middle\">";
+ ob_start();
+ $controller->print_person_pedigree($person->getXref(), 1);
+ $content .= ob_get_clean();
+ $content .= "</td>";
+ }
+ if ($type=='treenav') {
+ $content .= "<td>";
+ ob_start();
+ $nav->drawViewport('blocknav', "", "240px");
+ $content .= ob_get_clean();
+ $content .= "</td>";
+ }
+ $content .= "</tr></table>";
+ $content .= '<script language="JavaScript" type="text/javascript">
+ <!--
+ if (sizeLines) sizeLines();
+ -->
+ </script>';
+ } else {
+ $content=i18n::translate('No such ID exists in this GEDCOM file.');
+ }
+
+ require $THEME_DIR.'templates/block_small_temp.php';
+
+ // Restore GEDCOM configuration
+ unset($show_full);
+ if (isset($saveShowFull)) $show_full = $saveShowFull;
+ $PEDIGREE_FULL_DETAILS = $savePedigreeFullDetails;
+ }
+
+ // Implement class WT_Module_Block
+ public function canLoadAjax() {
+ return false;
}
// Implement class WT_Module_Block
- public function configureBlock() {
- // Create an edit form, and respond to the result
+ public function isUserBlock() {
+ return true;
+ }
+
+ // Implement class WT_Module_Block
+ public function isGedcomBlock() {
+ return true;
+ }
+
+ // Implement class WT_Module_Block
+ public function configureBlock($block_id) {
+ global $ctype, $WT_BLOCKS, $TEXT_DIRECTION, $PEDIGREE_ROOT_ID, $ENABLE_AUTOCOMPLETE;
+
+ if (safe_POST_bool('save')) {
+ set_block_setting($block_id, 'details', safe_POST_bool('details'));
+ set_block_setting($block_id, 'type', safe_POST('type', array('pedigree', 'descendants', 'hourglass', 'treenav'), 'treenav'));
+ set_block_setting($block_id, 'pid', safe_POST('pid', WT_REGEX_XREF));
+ echo WT_JS_START, 'window.opener.location.href=window.opener.location.href;window.close();', WT_JS_END;
+ exit;
+ }
+
+ $details=get_block_setting($block_id, 'details', false);
+ $type =get_block_setting($block_id, 'type', 'treenav');
+ $pid =get_block_setting($block_id, 'pid', WT_USER_ID ? (WT_USER_GEDCOM_ID ? WT_USER_GEDCOM_ID : $PEDIGREE_ROOT_ID) : $PEDIGREE_ROOT_ID);
+
+ if ($ENABLE_AUTOCOMPLETE) require WT_ROOT.'js/autocomplete.js.htm';
+ ?>
+ <tr><td class="descriptionbox wrap width33"><?php print i18n::translate('Chart Type'); ?></td>
+ <td class="optionbox">
+ <select name="type">
+ <option value="pedigree"<?php if ($type=="pedigree") print " selected=\"selected\""; ?>><?php print i18n::translate('Pedigree Tree'); ?></option>
+ <option value="descendants"<?php if ($type=="descendants") print " selected=\"selected\""; ?>><?php print i18n::translate('Descendancy Chart'); ?></option>
+ <option value="hourglass"<?php if ($type=="hourglass") print " selected=\"selected\""; ?>><?php print i18n::translate('Hourglass Chart'); ?></option>
+ <?php if (file_exists(WT_ROOT.'includes/classes/class_treenav.php')) { ?>
+ <option value="treenav"<?php if ($type=="treenav") print " selected=\"selected\""; ?>><?php print i18n::translate('Interactive Tree'); ?></option>
+ <?php } ?>
+ </select>
+ </td></tr>
+ <tr>
+ <td class="descriptionbox wrap width33"><?php print i18n::translate('Show Details'); ?></td>
+ <td class="optionbox">
+ <select name="details">
+ <option value="no" <?php if (!$details) print " selected=\"selected\""; ?>><?php print i18n::translate('No'); ?></option>
+ <option value="yes" <?php if ($details) print " selected=\"selected\""; ?>><?php print i18n::translate('Yes'); ?></option>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td class="descriptionbox wrap width33"><?php print i18n::translate('Root Person ID'); ?></td>
+ <td class="optionbox">
+ <input type="text" name="pid" id="pid" value="<?php print $pid; ?>" size="5" />
+ <?php
+ print_findindi_link('pid','');
+ $root=Person::getInstance($pid);
+ if ($root) {
+ echo ' <span class="list_item">', $root->getFullName(), $root->format_first_major_fact(WT_EVENTS_BIRT, 1), '</span>';
+ }
+ ?>
+ </td>
+ </tr>
+ <?php
}
}
diff --git a/modules/gedcom_block/module.php b/modules/gedcom_block/module.php
index cff65077ee..8bbc74ef71 100644
--- a/modules/gedcom_block/module.php
+++ b/modules/gedcom_block/module.php
@@ -22,8 +22,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * @package webtrees
- * @subpackage Modules
* @version $Id: class_media.php 5451 2009-05-05 22:15:34Z fisharebest $
*/
@@ -46,12 +44,40 @@ class gedcom_block_WT_Module extends WT_Module implements WT_Module_Block {
}
// Implement class WT_Module_Block
- public function getBlock($block, $config, $side, $index) {
- // Generate the block contents
+ public function getBlock($block_id) {
+ global $hitCount, $SHOW_COUNTER, $THEME_DIR;
+
+ $id=$this->getName().$block_id;
+ $title=get_gedcom_setting(WT_GED_ID, 'title');
+ $content = "<div class=\"center\">";
+ $content .= "<br />".format_timestamp(client_time())."<br />\n";
+ if ($SHOW_COUNTER)
+ $content .= i18n::translate('Hit Count:')." ".$hitCount."<br />\n";
+ $content .= "\n<br />";
+ if (WT_USER_GEDCOM_ADMIN) {
+ $content .= "<a href=\"javascript:;\" onclick=\"window.open('".encode_url("index_edit.php?name=".WT_GEDCOM."&ctype=gedcom")."', '_blank', 'top=50,left=10,width=600,height=500,scrollbars=1,resizable=1'); return false;\">".i18n::translate('Customize this GEDCOM Home Page')."</a><br />\n";
+ }
+ $content .= "</div>";
+
+ require $THEME_DIR.'templates/block_main_temp.php';
+ }
+
+ // Implement class WT_Module_Block
+ public function canLoadAjax() {
+ return false;
+ }
+
+ // Implement class WT_Module_Block
+ public function isUserBlock() {
+ return false;
+ }
+
+ // Implement class WT_Module_Block
+ public function isGedcomBlock() {
+ return true;
}
// Implement class WT_Module_Block
- public function configureBlock() {
- // Create an edit form, and respond to the result
+ public function configureBlock($block_id) {
}
}
diff --git a/modules/gedcom_favorites/module.php b/modules/gedcom_favorites/module.php
index b2eaadabce..41327f526d 100644
--- a/modules/gedcom_favorites/module.php
+++ b/modules/gedcom_favorites/module.php
@@ -22,8 +22,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * @package webtrees
- * @subpackage Modules
* @version $Id: class_media.php 5451 2009-05-05 22:15:34Z fisharebest $
*/
@@ -46,12 +44,245 @@ class gedcom_favorites_WT_Module extends WT_Module implements WT_Module_Block {
}
// Implement class WT_Module_Block
- public function getBlock($block, $config, $side, $index) {
- // Generate the block contents
+ public function getBlock($block_id) {
+ global $WT_IMAGE_DIR, $WT_IMAGES, $ctype, $TEXT_DIRECTION;
+ global $show_full, $PEDIGREE_FULL_DETAILS, $BROWSERTYPE, $ENABLE_AUTOCOMPLETE;
+
+ $action=safe_GET('action');
+ switch ($action) {
+ case 'deletefav':
+ $fv_id=safe_GET('fv_id');
+ if ($fv_id) {
+ deleteFavorite($fv_id);
+ }
+ break;
+ case 'addfav':
+ $gid =safe_GET('gid');
+ $favnote =safe_GET('favnote');
+ $favtype =safe_GET('favtype');
+ $url =safe_GET('url', WT_REGEX_URL);
+ $favtitle=safe_GET('favtitle');
+
+ if ($gid) {
+ $indirec = find_gedcom_record($gid, WT_GED_ID);
+ $ct = preg_match('/0 @(.*)@ (.*)/', $indirec, $match);
+ if ($indirec && $ct>0) {
+ $favorite = array();
+ if (empty($favtype)) {
+ if ($ctype=='user') $favtype = 'user';
+ else $favtype = 'gedcom';
+ }
+ if ($favtype=='gedcom') {
+ $favtype = WT_GEDCOM;
+ $_SESSION['clearcache'] = true;
+ }
+ else $favtype=WT_GEDCOM;
+ $favorite['username'] = $favtype;
+ $favorite['gid'] = $gid;
+ $favorite['type'] = trim($match[2]);
+ $favorite['file'] = WT_GEDCOM;
+ $favorite['url'] = '';
+ $favorite['note'] = $favnote;
+ $favorite['title'] = '';
+ addFavorite($favorite);
+ }
+ }
+ $url=safe_GET('url');
+ if ($url) {
+ if (empty($favtitle)) $favtitle = $url;
+ $favorite = array();
+ if (!isset($favtype)) {
+ if ($ctype=='user') $favtype = 'user';
+ else $favtype = 'gedcom';
+ }
+ if ($favtype=='gedcom') {
+ $favtype = $GEDCOM;
+ $_SESSION['clearcache'] = true;
+ }
+ else $favtype=WT_GEDCOM;
+ $favorite['username'] = $favtype;
+ $favorite['gid'] = '';
+ $favorite['type'] = 'URL';
+ $favorite['file'] = $GEDCOM;
+ $favorite['url'] = $url;
+ $favorite['note'] = $favnote;
+ $favorite['title'] = $favtitle;
+ addFavorite($favorite);
+ }
+ break;
+ }
+
+ $block=get_block_setting($block_id, 'block', false);
+
+ // Override GEDCOM configuration temporarily
+ if (isset($show_full)) $saveShowFull = $show_full;
+ $savePedigreeFullDetails = $PEDIGREE_FULL_DETAILS;
+ $show_full = 1;
+ $PEDIGREE_FULL_DETAILS = 1;
+
+ $userfavs = getUserFavorites(WT_GEDCOM);
+ if (!is_array($userfavs)) $userfavs = array();
+
+ $id=$this->getName().$block_id;
+ $title=i18n::translate('This GEDCOM\'s Favorites').help_link('index_favorites');
+ if ($TEXT_DIRECTION=="rtl") $title .= getRLM();
+ $title .= "(".count($userfavs).")";
+ if ($TEXT_DIRECTION=="rtl") $title .= getRLM();
+
+ if (WT_USER_IS_ADMIN && $ENABLE_AUTOCOMPLETE) {
+ $content = '<script type="text/javascript" src="js/jquery/jquery.min.js"></script>
+ <script type="text/javascript" src="js/jquery/jquery.autocomplete.js"></script>
+ <script type="text/javascript" src="js/jquery/jquery.ajaxQueue.js"></script>
+ <script type="text/javascript">
+ jQuery.noConflict(); // @see http://docs.jquery.com/Using_jQuery_with_Other_Libraries/
+ jQuery(document).ready(function($){
+ $("input[name^=gid]").autocomplete("autocomplete.php", {
+ extraParams: {field:"IFSRO"},
+ formatItem: function(row, i) {
+ return row[0] + " (" + row[1] + ")";
+ },
+ formatResult: function(row) {
+ return row[1];
+ },
+ width: 400,
+ minChars: 2
+ });
+ });
+ </script>';
+ } else $content = '';
+
+ if ($block) {
+ $style = 2; // 1 means "regular box", 2 means "wide box"
+ $tableWidth = ($BROWSERTYPE=="msie") ? "95%" : "99%"; // IE needs to have room for vertical scroll bar inside the box
+ $cellSpacing = "1px";
+ } else {
+ $style = 2;
+ $tableWidth = "99%";
+ $cellSpacing = "3px";
+ }
+ if (count($userfavs)==0) {
+ if (WT_USER_GEDCOM_ADMIN) {
+ $content .= i18n::translate('You have not selected any favorites.<br /><br />To add an individual, a family, or a source to your favorites, click on the <b>Add a new favorite</b> link to reveal some fields where you can enter or search for an ID number. Instead of an ID number, you can enter a URL and a title.');
+ } else {
+ $content .= i18n::translate('At this moment there are no selected Favorites. The admin can add Favorites to display at startup.');
+ }
+ } else {
+ $content .= "<table width=\"{$tableWidth}\" style=\"border:none\" cellspacing=\"{$cellSpacing}\" class=\"center $TEXT_DIRECTION\">";
+ foreach($userfavs as $key=>$favorite) {
+ if (isset($favorite["id"])) $key=$favorite["id"];
+ $removeFavourite = "<a class=\"font9\" href=\"".encode_url("index.php?ctype=$ctype&action=deletefav&fv_id={$key}")."\" onclick=\"return confirm('".i18n::translate('Are you sure you want to remove this item from your list of Favorites?')."');\">".i18n::translate('Remove')."</a><br />\n";
+ $content .= "<tr><td>";
+ if ($favorite["type"]=="URL") {
+ $content .= "<div id=\"boxurl".$key.".0\" class=\"person_box\">\n";
+ if ($ctype=="user" || WT_USER_GEDCOM_ADMIN) $content .= $removeFavourite;
+ $content .= "<a href=\"".$favorite["url"]."\"><b>".PrintReady($favorite["title"])."</b></a>";
+ $content .= "<br />".PrintReady($favorite["note"]);
+ $content .= "</div>\n";
+ } else {
+ if (displayDetailsById($favorite["gid"], $favorite["type"])) {
+ if ($favorite["type"]=="INDI") {
+ $indirec = find_person_record($favorite["gid"], WT_GED_ID);
+ $content .= "<div id=\"box".$favorite["gid"].".0\" class=\"person_box";
+ if (strpos($indirec, "\n1 SEX F")!==false) $content .= "F";
+ elseif (strpos($indirec, "\n1 SEX M")!==false) $content .= "";
+ else $content .= "NN";
+ $content .= "\">\n";
+ if ($ctype=="user" || WT_USER_GEDCOM_ADMIN) $content .= $removeFavourite;
+ ob_start();
+ print_pedigree_person($favorite["gid"], $style, 1, $key);
+ $content .= ob_get_clean();
+ $content .= PrintReady($favorite["note"]);
+ $content .= "</div>\n";
+ } else {
+ $record=GedcomRecord::getInstance($favorite['gid']);
+ $content .= "<div id=\"box".$favorite["gid"].".0\" class=\"person_box\">";
+ if ($ctype=="user" || WT_USER_GEDCOM_ADMIN) $content .= $removeFavourite;
+ if ($record) {
+ $content.=$record->format_list('span');
+ } else {
+ $content.=i18n::translate('No such ID exists in this GEDCOM file.');
+ }
+ $content .= "<br />".PrintReady($favorite["note"]);
+ $content .= "</div>";
+ }
+ }
+ }
+ $content .= "</td></tr>\n";
+ }
+ $content .= "</table>\n";
+ }
+ if (WT_USER_GEDCOM_ADMIN) {
+ $content .= '
+ <script language="JavaScript" type="text/javascript">
+ <!--
+ var pastefield;
+ function paste_id(value) {
+ pastefield.value=value;
+ }
+ -->
+ </script>
+ <br />
+ ';
+ $uniqueID = floor(microtime() * 1000000);
+ $content .= "<b><a href=\"javascript://".i18n::translate('Add a new favorite')." \" onclick=\"expand_layer('add_ged_fav'); return false;\"><img id=\"add_ged_fav_img\" src=\"".$WT_IMAGE_DIR."/".$WT_IMAGES["plus"]["other"]."\" border=\"0\" alt=\"\" />&nbsp;".i18n::translate('Add a new favorite')."</a></b>";
+ $content .= help_link('index_add_favorites');
+ $content .= "<br /><div id=\"add_ged_fav\" style=\"display: none;\">\n";
+ $content .= "<form name=\"addgfavform\" method=\"get\" action=\"index.php\">\n";
+ $content .= "<input type=\"hidden\" name=\"action\" value=\"addfav\" />\n";
+ $content .= "<input type=\"hidden\" name=\"ctype\" value=\"$ctype\" />\n";
+ $content .= "<input type=\"hidden\" name=\"favtype\" value=\"gedcom\" />\n";
+ $content .= "<input type=\"hidden\" name=\"ged\" value=\"".WT_GEDCOM."\" />\n";
+ $content .= "<table width=\"{$tableWidth}\" style=\"border:none\" cellspacing=\"{$cellSpacing}\" class=\"center {$TEXT_DIRECTION}\">";
+ $content .= "<tr><td>".i18n::translate('Enter a Person, Family, or Source ID')." <br />";
+ $content .= "<input class=\"pedigree_form\" type=\"text\" name=\"gid\" id=\"gid{$uniqueID}\" size=\"5\" value=\"\" />";
+
+ $content .= print_findindi_link("gid{$uniqueID}",'',true)."\n";
+ $content .= print_findfamily_link("gid{$uniqueID}",'',true)."\n";
+ $content .= print_findsource_link("gid{$uniqueID}",'',true)."\n";
+ $content .= print_findrepository_link("gid{$uniqueID}",'',true)."\n";
+ $content .= print_findnote_link("gid{$uniqueID}",'',true)."\n";
+ $content .= print_findmedia_link("gid{$uniqueID}",'1','',true)."\n";
+
+ $content .= "\n<br />".i18n::translate('OR<br />Enter a URL and a title');
+ $content .= "\n<table><tr><td>".translate_fact('URL')."</td><td><input type=\"text\" name=\"url\" size=\"40\" value=\"\" /></td></tr>";
+ $content .= "\n<tr><td>".i18n::translate('Title:')."</td><td><input type=\"text\" name=\"favtitle\" size=\"40\" value=\"\" /></td></tr></table>";
+ if ($block) $content .= "\n</td></tr><tr><td><br />";
+ else $content .= "\n</td><td>";
+ $content .= "\n".i18n::translate('Enter an optional note about this favorite');
+ $content .= "\n<br /><textarea name=\"favnote\" rows=\"6\" cols=\"50\"></textarea>";
+ $content .= "</td></tr></table>\n";
+ $content .= "\n<br /><input type=\"submit\" value=\"".i18n::translate('Add')."\" style=\"font-size: 8pt; \" />";
+ $content .= "\n</form></div>\n";
+ }
+
+ global $THEME_DIR;
+ if ($block) {
+ require $THEME_DIR.'templates/block_small_temp.php';
+ } else {
+ require $THEME_DIR.'templates/block_main_temp.php';
+ }
+ // Restore GEDCOM configuration
+ unset($show_full);
+ if (isset($saveShowFull)) $show_full = $saveShowFull;
+ $PEDIGREE_FULL_DETAILS = $savePedigreeFullDetails;
+ }
+
+ // Implement class WT_Module_Block
+ public function canLoadAjax() {
+ return false;
+ }
+
+ // Implement class WT_Module_Block
+ public function isUserBlock() {
+ return false;
+ }
+
+ // Implement class WT_Module_Block
+ public function isGedcomBlock() {
+ return true;
}
// Implement class WT_Module_Block
- public function configureBlock() {
- // Create an edit form, and respond to the result
+ public function configureBlock($block_id) {
}
}
diff --git a/modules/gedcom_news/module.php b/modules/gedcom_news/module.php
index 5d58407a29..360f2a3bd4 100644
--- a/modules/gedcom_news/module.php
+++ b/modules/gedcom_news/module.php
@@ -22,8 +22,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * @package webtrees
- * @subpackage Modules
* @version $Id: class_media.php 5451 2009-05-05 22:15:34Z fisharebest $
*/
@@ -46,12 +44,154 @@ class gedcom_news_WT_Module extends WT_Module implements WT_Module_Block {
}
// Implement class WT_Module_Block
- public function getBlock($block, $config, $side, $index) {
- // Generate the block contents
+ public function getBlock($block_id) {
+ global $WT_IMAGE_DIR, $WT_IMAGES, $TEXT_DIRECTION, $ctype, $THEME_DIR;
+
+ switch (safe_GET('action')) {
+ case 'deletenews':
+ $news_id=safe_GET('news_id');
+ if ($news_id) {
+ deleteNews($news_id);
+ }
+ break;
+ }
+
+ if (isset($_REQUEST['gedcom_news_archive'])) {
+ $limit='nolimit';
+ $flag=0;
+ } else {
+ $flag=get_block_setting($block_id, 'flag');
+ if ($flag==0) {
+ $limit='nolimit';
+ } else {
+ $limit=get_block_setting($block_id, 'limit');
+ }
+ }
+
+ $usernews = getUserNews(WT_GEDCOM);
+
+ $id=$this->getName().$block_id;
+ $title='';
+ if ($ctype=="gedcom" && WT_USER_GEDCOM_ADMIN || $ctype=="user" && WT_USER_ID) {
+ if ($ctype=="gedcom") {
+ $name = WT_GEDCOM;
+ } else {
+ $name = WT_USER_NAME;
+ }
+ $title .= "<a href=\"javascript: configure block\" onclick=\"window.open('index_edit.php?action=configure&block_id={$block_id}', '_blank', 'top=50,left=50,width=600,height=350,scrollbars=1,resizable=1'); return false;\">"
+ ."<img class=\"adminicon\" src=\"{$WT_IMAGE_DIR}/{$WT_IMAGES['admin']['small']}\" width=\"15\" height=\"15\" border=\"0\" alt=\"".i18n::translate('Configure')."\" /></a>\n"
+ ;
+ }
+ $title .= i18n::translate('News');
+ if(WT_USER_GEDCOM_ADMIN) {
+ $title .= help_link('index_gedcom_news_adm');
+ } else {
+ $title .= help_link('index_gedcom_news');
+ }
+ $content = "";
+ if(count($usernews) == 0)
+ {
+ $content .= i18n::translate('No News articles have been submitted.').'<br />';
+ }
+ $c = 0;
+ $td = time();
+ foreach($usernews as $news)
+ {
+ if ($limit=='count') {
+ if ($c >= $flag) {
+ break;
+ }
+ $c++;
+ }
+ if ($limit=='date') {
+ if (floor(($td - $news['date']) / 86400) > $flag) {
+ break;
+ }
+ }
+ // print "<div class=\"person_box\" id=\"{$news['anchor']}\">\n";
+ $content .= "<div class=\"news_box\" id=\"{$news['anchor']}\">\n";
+
+ // Look for $GLOBALS substitutions in the News title
+ $newsTitle = embed_globals($news['title']);
+ $content .= "<span class=\"news_title\">".PrintReady($newsTitle)."</span><br />\n";
+ $content .= "<span class=\"news_date\">".format_timestamp($news['date'])."</span><br /><br />\n";
+
+ // Look for $GLOBALS substitutions in the News text
+ $newsText = embed_globals($news['text']);
+ $trans = get_html_translation_table(HTML_SPECIALCHARS);
+ $trans = array_flip($trans);
+ $newsText = strtr($newsText, $trans);
+ $newsText = nl2br($newsText);
+ $content .= PrintReady($newsText)."<br />\n";
+
+ // Print Admin options for this News item
+ if(WT_USER_GEDCOM_ADMIN) {
+ $content .= "<hr size=\"1\" />"
+ ."<a href=\"javascript:;\" onclick=\"editnews('".$news['id']."'); return false;\">".i18n::translate('Edit')."</a> | "
+ ."<a href=\"".encode_url("index.php?action=deletenews&news_id=".$news['id']."&ctype={$ctype}")."\" onclick=\"return confirm('".i18n::translate('Are you sure you want to delete this News entry?')."');\">".i18n::translate('Delete')."</a><br />";
+ }
+ $content .= "</div>\n";
+ }
+ $printedAddLink = false;
+ if (WT_USER_GEDCOM_ADMIN) {
+ $content .= "<a href=\"javascript:;\" onclick=\"addnews('".urlencode(WT_GEDCOM)."'); return false;\">".i18n::translate('Add a News article')."</a>";
+ $printedAddLink = true;
+ }
+ if ($limit=='date' || $limit=='count') {
+ if ($printedAddLink) $content .= "&nbsp;&nbsp;|&nbsp;&nbsp;";
+ $content .= "<a href=\"".encode_url("index.php?gedcom_news_archive=yes&ctype={$ctype}")."\">".i18n::translate('View archive')."</a>";
+ $content .= help_link('gedcom_news_archive').'<br />';
+ }
+
+ require $THEME_DIR.'templates/block_main_temp.php';
+ }
+
+ // Implement class WT_Module_Block
+ public function canLoadAjax() {
+ return false;
+ }
+
+ // Implement class WT_Module_Block
+ public function isUserBlock() {
+ return false;
+ }
+
+ // Implement class WT_Module_Block
+ public function isGedcomBlock() {
+ return true;
}
// Implement class WT_Module_Block
- public function configureBlock() {
- // Create an edit form, and respond to the result
+ public function configureBlock($block_id) {
+ global $ctype, $WT_BLOCKS;
+ if (empty ($config)) $config = $WT_BLOCKS["print_gedcom_news"]["config"];
+ if (!isset ($config["limit"])) $config["limit"] = "nolimit";
+ if (!isset ($config["flag"])) $config["flag"] = 0;
+ if (!isset($config["cache"])) $config["cache"] = $WT_BLOCKS["print_gedcom_news"]["config"]["cache"];
+
+ // Limit Type
+ echo
+ '<tr><td class="descriptionbox wrap width33">',
+ i18n::translate('Limit display by:'), help_link('gedcom_news_limit'),
+ '</td><td class="optionbox"><select name="limit"><option value="nolimit"',
+ ($config['limit'] == 'nolimit'?' selected="selected"':'').">",
+ i18n::translate('No limit')."</option>",
+ '<option value="date"'.($config['limit'] == 'date'?' selected="selected"':'').">".i18n::translate('Age of item')."</option>",
+ '<option value="count"'.($config['limit'] == 'count'?' selected="selected"':'').">".i18n::translate('Number of items')."</option>",
+ '</select></td></tr>';
+
+ // Flag to look for
+ echo '<tr><td class="descriptionbox wrap width33">';
+ echo i18n::translate('Limit:'), help_link('gedcom_news_flag');
+ echo '</td><td class="optionbox"><input type="text" name="flag" size="4" maxlength="4" value="'.$config['flag'].'" /></td></tr>';
+
+ // Cache file life
+ if ($ctype=="gedcom") {
+ echo '<tr><td class="descriptionbox wrap width33">';
+ echo i18n::translate('Cache file life'), help_link('cache_life');
+ echo '</td><td class="optionbox">';
+ echo '<input type="text" name="cache" size="2" value="', $config['cache'], '" />';
+ echo "</td></tr>";
+ }
}
}
diff --git a/modules/gedcom_stats/module.php b/modules/gedcom_stats/module.php
index 54e7f5e20d..70969531d4 100644
--- a/modules/gedcom_stats/module.php
+++ b/modules/gedcom_stats/module.php
@@ -22,8 +22,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * @package webtrees
- * @subpackage Modules
* @version $Id: class_media.php 5451 2009-05-05 22:15:34Z fisharebest $
*/
@@ -46,12 +44,332 @@ class gedcom_stats_WT_Module extends WT_Module implements WT_Module_Block {
}
// Implement class WT_Module_Block
- public function getBlock($block, $config, $side, $index) {
- // Generate the block contents
+ public function getBlock($block_id) {
+ global $ALLOW_CHANGE_GEDCOM, $ctype, $COMMON_NAMES_THRESHOLD, $WT_IMAGE_DIR, $WT_IMAGES, $MULTI_MEDIA, $top10_block_present, $THEME_DIR;
+
+ $show_common_surnames=get_block_setting($block_id, 'show_common_surnames', true);
+ $stat_indi =get_block_setting($block_id, 'stat_indi', true);
+ $stat_fam =get_block_setting($block_id, 'stat_fam', true);
+ $stat_sour =get_block_setting($block_id, 'stat_sour', true);
+ $stat_other =get_block_setting($block_id, 'stat_other', true);
+ $stat_media =get_block_setting($block_id, 'stat_media', true);
+ $stat_surname =get_block_setting($block_id, 'stat_surname', true);
+ $stat_events =get_block_setting($block_id, 'stat_events', true);
+ $stat_users =get_block_setting($block_id, 'stat_users', true);
+ $stat_first_birth =get_block_setting($block_id, 'stat_first_birth', true);
+ $stat_last_birth =get_block_setting($block_id, 'stat_last_birth', true);
+ $stat_first_death =get_block_setting($block_id, 'stat_first_death', true);
+ $stat_last_death =get_block_setting($block_id, 'stat_last_death', true);
+ $stat_long_life =get_block_setting($block_id, 'stat_long_life', true);
+ $stat_avg_life =get_block_setting($block_id, 'stat_avg_life', true);
+ $stat_most_chil =get_block_setting($block_id, 'stat_most_chil', true);
+ $stat_avg_chil =get_block_setting($block_id, 'stat_avg_chil', true);
+ $stat_link =get_block_setting($block_id, 'stat_link', true);
+
+ $block=get_block_setting($block_id, 'block', false);
+
+ $id=$this->getName().$block_id;
+ $title='';
+ if ($ctype=='gedcom' && WT_USER_GEDCOM_ADMIN || $ctype=='user' && WT_USER_ID) {
+ $title .= "<a href=\"javascript: configure block\" onclick=\"window.open('".encode_url("index_edit.php?action=configure&block_id={$block_id}")."', '_blank', 'top=50,left=50,width=700,height=400,scrollbars=1,resizable=1'); return false;\">";
+ $title .= "<img class=\"adminicon\" src=\"$WT_IMAGE_DIR/".$WT_IMAGES['admin']['small']."\" width=\"15\" height=\"15\" border=\"0\" alt=\"".i18n::translate('Configure')."\" /></a>";
+ }
+ $title.=i18n::translate('GEDCOM Statistics').help_link('index_stats');
+
+ require_once WT_ROOT.'includes/classes/class_stats.php';
+ $stats=new stats(WT_GEDCOM);
+
+ $content = "<b><a href=\"index.php?ctype=gedcom\">".PrintReady(strip_tags(get_gedcom_setting(WT_GED_ID, 'title')))."</a></b><br />";
+ $head = find_other_record('HEAD', WT_GED_ID);
+ $ct=preg_match('/1 SOUR (.*)/', $head, $match);
+ if ($ct>0) {
+ $softrec = get_sub_record(1, '1 SOUR', $head);
+ $tt= preg_match('/2 NAME (.*)/', $softrec, $tmatch);
+ if ($tt>0) $software = printReady(trim($tmatch[1]));
+ else $software = trim($match[1]);
+ if (!empty($software)) {
+ $tt = preg_match('/2 VERS (.*)/', $softrec, $tmatch);
+ if ($tt>0) $version = printReady(trim($tmatch[1]));
+ else $version='';
+ $content .= i18n::translate('This GEDCOM was created using <b>%s %s</b>', $software, $version);
+ }
+ }
+ if (preg_match('/1 DATE (.+)/', $head, $match)) {
+ if (empty($software)) {
+ $content.=i18n::translate('This GEDCOM was created on <b>%s</b>', $stats->gedcomDate());
+ } else {
+ $content.=i18n::translate(' on <b>%s</b>', $stats->gedcomDate());
+ }
+ }
+
+ $content .= '<br /><table><tr><td valign="top" class="width20"><table cellspacing="1" cellpadding="0">';
+ if ($stat_indi) {
+ $content.='<tr><td class="facts_label">'.i18n::translate('Individuals').'</td><td class="facts_value"><div dir="rtl"><a href="'.encode_url("indilist.php?surname_sublist=no&ged=".WT_GEDCOM).'">'.$stats->totalIndividuals().'</a></div></td></tr>';
+ $content.='<tr><td class="facts_label">'.i18n::translate('Males').'</td><td class="facts_value"><div dir="rtl">'.$stats->totalSexMales().'<br />'.$stats->totalSexMalesPercentage().'%</div></td></tr>';
+ $content.='<tr><td class="facts_label">'.i18n::translate('Females').'</td><td class="facts_value"><div dir="rtl">'.$stats->totalSexFemales().'<br />'.$stats->totalSexFemalesPercentage().'%</div></td></tr>';
+ }
+ if ($stat_surname) {
+ $content .= '<tr><td class="facts_label">'.i18n::translate('Total surnames').'</td><td class="facts_value"><div dir="rtl"><a href="'.encode_url("indilist.php?show_all=yes&surname_sublist=yes&ged=".WT_GEDCOM).'">'.$stats->totalSurnames().'</a></div></td></tr>';
+ }
+ if ($stat_fam) {
+ $content .= '<tr><td class="facts_label">'. i18n::translate('Families').'</td><td class="facts_value"><div dir="rtl"><a href="famlist.php">'.$stats->totalFamilies().'</a></div></td></tr>';
+ }
+ if ($stat_sour) {
+ $content .= '<tr><td class="facts_label">'. i18n::translate('Sources').'</td><td class="facts_value"><div dir="rtl"><a href="sourcelist.php">'.$stats->totalSources().'</a></div></td></tr>';
+ }
+ if ($stat_media && $MULTI_MEDIA==true) {
+ $content .= '<tr><td class="facts_label">'. i18n::translate('Media objects').'</td><td class="facts_value"><div dir="rtl"><a href="medialist.php">'.$stats->totalMedia().'</a></div></td></tr>';
+ }
+ if ($stat_other) {
+ $content .= '<tr><td class="facts_label">'. i18n::translate('Other records').'</td><td class="facts_value"><div dir="rtl">'.$stats->totalOtherRecords().'</div></td></tr>';
+ }
+ if ($stat_events) {
+ $content .= '<tr><td class="facts_label">'. i18n::translate('Total events').'</td><td class="facts_value"><div dir="rtl">'.$stats->totalEvents().'</div></td></tr>';
+ }
+ if ($stat_users) {
+ $content .= '<tr><td class="facts_label">'. i18n::translate('Total users').'</td><td class="facts_value"><div dir="rtl">';
+ if (WT_USER_GEDCOM_ADMIN){
+ $content .= '<a href="useradmin.php">'.$stats->totalUsers().'</a>';
+ } else {
+ $content .= $stats->totalUsers();
+ }
+ $content .= '</div>
+ </td>
+ </tr>';
+ }
+ if (!$block) {
+ $content .= '</table></td><td><br /></td><td valign="top"><table cellspacing="1" cellpadding="1" border="0">';
+ }
+ if ($stat_first_birth) {
+ $content .= '<tr><td class="facts_label">'. i18n::translate('Earliest birth year').'</td><td class="facts_value"><div dir="rtl">'.$stats->firstBirthYear().'</div></td>';
+ if (!$block) {
+ $content .= '<td class="facts_value">'.$stats->firstBirth().'</td>';
+ }
+ $content .= '</tr>';
+ }
+ if ($stat_last_birth) {
+ $content .= '<tr><td class="facts_label">'. i18n::translate('Latest birth year').'</td><td class="facts_value"><div dir="rtl">'.$stats->lastBirthYear().'</div></td>';
+ if (!$block){
+ $content .= '<td class="facts_value">'.$stats->lastBirth().'</td>';
+ }
+ $content .= '</tr>';
+ }
+ if ($stat_first_death) {
+ $content .= '<tr><td class="facts_label">'. i18n::translate('Earliest death year').'</td><td class="facts_value"><div dir="rtl">'.$stats->firstDeathYear().'</div></td>';
+ if (!$block){
+ $content .= '<td class="facts_value">'.$stats->firstDeath().'</td>';
+ }
+ $content .= '</tr>';
+ }
+ if ($stat_last_death) {
+ $content .= '<tr><td class="facts_label">'. i18n::translate('Latest death year') .'</td><td class="facts_value"><div dir="rtl">'.$stats->lastDeathYear().'</div>
+ </td>';
+ if (!$block){
+ $content .= '<td class="facts_value">'.$stats->lastDeath().'</td>';
+ }
+ $content .='</tr>';
+ }
+ if ($stat_long_life) {
+ $content .= '<tr><td class="facts_label">'. i18n::translate('Person who lived the longest').'</td><td class="facts_value"><div dir="rtl">'.$stats->LongestLifeAge().'</div></td>';
+ if (!$block){
+ $content .= '<td class="facts_value">'.$stats->LongestLife().'</td>';
+ }
+ $content .= '</tr>';
+ }
+ if ($stat_avg_life) {
+ $content .= '<tr><td class="facts_label">'. i18n::translate('Average age at death').'</td><td class="facts_value"><div dir="rtl">'.$stats->averageLifespan().'</div></td>';
+ if (!$block) {
+ $content .= '<td class="facts_value">'.i18n::translate('Males').':&nbsp;'.$stats->averageLifespanMale();
+ $content .= '&nbsp;&nbsp;&nbsp;'.i18n::translate('Females').':&nbsp;'.$stats->averageLifespanFemale().'</td>';
+ }
+ $content .= '</tr>';
+ }
+
+ if ($stat_most_chil && !$block) {
+ $content .= '<tr><td class="facts_label">'. i18n::translate('Family with the most children').'</td><td class="facts_value"><div dir="rtl">'.$stats->largestFamilySize().'</div></td>';
+ if (!$block) {
+ $content .= '<td class="facts_value">'.$stats->largestFamily().'</td>';
+ }
+ $content .= '</tr>';
+ }
+ if ($stat_avg_chil) {
+ $content .= '<tr><td class="facts_label">'. i18n::translate('Average number of children per family').'</td><td class="facts_value"><div dir="rtl">'.$stats->averageChildren().'</div></td>';
+ if (!$block) {
+ $content .= '<td class="facts_value">&nbsp;</td>';
+ }
+ $content .= '</tr>';
+ }
+ $content .= '</table></td></tr></table>';
+ if ($stat_link) {
+ $content .= '<a href="statistics.php"><b>'.i18n::translate('View statistics as graphs').'</b></a><br />';
+ }
+ // NOTE: Print the most common surnames
+ if ($show_common_surnames) {
+ $surnames = get_common_surnames($COMMON_NAMES_THRESHOLD);
+ if (count($surnames)>0) {
+ $content .= '<br /><b>'.i18n::translate('Most Common Surnames').'</b>';
+ $content .= help_link('index_common_names');
+ $content .= '<br />';
+ $i=0;
+ foreach($surnames as $indexval => $surname) {
+ if (stristr($surname['name'], '@N.N')===false) {
+ if ($i>0) {
+ $content .= ', ';
+ }
+ $content .= '<a href="'.encode_url("indilist.php?ged=".WT_GEDCOM."&surname=".$surname['name']).'">'.PrintReady($surname['name']).'</a>';
+ $i++;
+ }
+ }
+ }
+ }
+
+ require $THEME_DIR.'templates/block_main_temp.php';
+ }
+
+ // Implement class WT_Module_Block
+ public function canLoadAjax() {
+ return true;
+ }
+
+ // Implement class WT_Module_Block
+ public function isUserBlock() {
+ return true;
+ }
+
+ // Implement class WT_Module_Block
+ public function isGedcomBlock() {
+ return true;
}
// Implement class WT_Module_Block
- public function configureBlock() {
- // Create an edit form, and respond to the result
+ public function configureBlock($block_id) {
+ if (safe_POST_bool('save')) {
+ set_block_setting($block_id, 'show_common_surnames', safe_POST_bool('show_common_surnames'));
+ set_block_setting($block_id, 'stat_indi', safe_POST_bool('stat_indi'));
+ set_block_setting($block_id, 'stat_fam', safe_POST_bool('stat_fam'));
+ set_block_setting($block_id, 'stat_sour', safe_POST_bool('stat_sour'));
+ set_block_setting($block_id, 'stat_other', safe_POST_bool('stat_other'));
+ set_block_setting($block_id, 'stat_media', safe_POST_bool('stat_media'));
+ set_block_setting($block_id, 'stat_surname', safe_POST_bool('stat_surname'));
+ set_block_setting($block_id, 'stat_events', safe_POST_bool('stat_events'));
+ set_block_setting($block_id, 'stat_users', safe_POST_bool('stat_users'));
+ set_block_setting($block_id, 'stat_first_birth', safe_POST_bool('stat_first_birth'));
+ set_block_setting($block_id, 'stat_last_birth', safe_POST_bool('stat_last_birth'));
+ set_block_setting($block_id, 'stat_first_death', safe_POST_bool('stat_first_death'));
+ set_block_setting($block_id, 'stat_last_death', safe_POST_bool('stat_last_death'));
+ set_block_setting($block_id, 'stat_long_life', safe_POST_bool('stat_long_life'));
+ set_block_setting($block_id, 'stat_avg_life', safe_POST_bool('stat_avg_life'));
+ set_block_setting($block_id, 'stat_most_chil', safe_POST_bool('stat_most_chil'));
+ set_block_setting($block_id, 'stat_avg_chil', safe_POST_bool('stat_avg_chil'));
+ set_block_setting($block_id, 'stat_link', safe_POST_bool('stat_link'));
+ echo WT_JS_START, 'window.opener.location.href=window.opener.location.href;window.close();', WT_JS_END;
+ exit;
+ }
+
+ require_once WT_ROOT.'includes/functions/functions_edit.php';
+
+ $show_common_surnames=get_block_setting($block_id, 'show_common_surnames', true);
+ echo '<tr><td class="descriptionbox wrap width33">';
+ echo i18n::translate('Show common surnames?'), help_link('show_common_surnames');
+ echo '</td><td class="optionbox">';
+ echo edit_field_yes_no('show_common_surnames', $show_common_surnames);
+ echo '</td></tr>';
+
+ $stat_indi =get_block_setting($block_id, 'stat_indi', true);
+ $stat_fam =get_block_setting($block_id, 'stat_fam', true);
+ $stat_sour =get_block_setting($block_id, 'stat_sour', true);
+ $stat_other =get_block_setting($block_id, 'stat_other', true);
+ $stat_media =get_block_setting($block_id, 'stat_media', true);
+ $stat_surname =get_block_setting($block_id, 'stat_surname', true);
+ $stat_events =get_block_setting($block_id, 'stat_events', true);
+ $stat_users =get_block_setting($block_id, 'stat_users', true);
+ $stat_first_birth =get_block_setting($block_id, 'stat_first_birth', true);
+ $stat_last_birth =get_block_setting($block_id, 'stat_last_birth', true);
+ $stat_first_death =get_block_setting($block_id, 'stat_first_death', true);
+ $stat_last_death =get_block_setting($block_id, 'stat_last_death', true);
+ $stat_long_life =get_block_setting($block_id, 'stat_long_life', true);
+ $stat_avg_life =get_block_setting($block_id, 'stat_avg_life', true);
+ $stat_most_chil =get_block_setting($block_id, 'stat_most_chil', true);
+ $stat_avg_chil =get_block_setting($block_id, 'stat_avg_chil', true);
+ $stat_link =get_block_setting($block_id, 'stat_link', true);
+?>
+ <tr>
+ <td class="descriptionbox wrap width33"><?php echo i18n::translate('Select the stats to show in this block'); ?></td>
+ <td class="optionbox">
+ <table>
+ <tr>
+ <td><input type="checkbox" value="yes" name="stat_indi"
+ <?php if ($stat_indi) echo ' checked="checked"'; ?> />
+ <?php echo i18n::translate('Individuals'); ?></td>
+ <td><input type="checkbox" value="yes" name="stat_first_birth"
+ <?php if ($stat_first_birth) echo ' checked="checked"'; ?> />
+ <?php echo i18n::translate('Earliest birth year'); ?></td>
+ </tr>
+ <tr>
+ <td><input type="checkbox" value="yes" name="stat_surname"
+ <?php if ($stat_surname) echo ' checked="checked"'; ?> />
+ <?php echo i18n::translate('Total surnames'); ?></td>
+ <td><input type="checkbox" value="yes" name="stat_last_birth"
+ <?php if ($stat_last_birth) echo ' checked="checked"'; ?> />
+ <?php echo i18n::translate('Latest birth year'); ?></td>
+ </tr>
+ <tr>
+ <td><input type="checkbox" value="yes" name="stat_fam"
+ <?php if ($stat_fam) echo ' checked="checked"'; ?> />
+ <?php echo i18n::translate('Families'); ?></td>
+ <td><input type="checkbox" value="yes" name="stat_first_death"
+ <?php if ($stat_first_death) echo ' checked="checked"'; ?> />
+ <?php echo i18n::translate('Earliest death year'); ?></td>
+ </tr>
+ <tr>
+ <td><input type="checkbox" value="yes" name="stat_sour"
+ <?php if ($stat_sour) echo ' checked="checked"'; ?> />
+ <?php echo i18n::translate('Sources'); ?></td>
+ <td><input type="checkbox" value="yes" name="stat_last_death"
+ <?php if ($stat_last_death) echo ' checked="checked"'; ?> />
+ <?php echo i18n::translate('Latest death year'); ?></td>
+ </tr>
+ <tr>
+ <td><input type="checkbox" value="yes" name="stat_media"
+ <?php if ($stat_media) echo ' checked="checked"'; ?> />
+ <?php echo i18n::translate('Media objects'); ?></td>
+ <td><input type="checkbox" value="yes" name="stat_long_life"
+ <?php if ($stat_long_life) echo ' checked="checked"'; ?> />
+ <?php echo i18n::translate('Person who lived the longest'); ?></td>
+ </tr>
+ <tr>
+ <td><input type="checkbox" value="yes" name="stat_other"
+ <?php if ($stat_other) echo ' checked="checked"'; ?> />
+ <?php echo i18n::translate('Other records'); ?></td>
+ <td><input type="checkbox" value="yes" name="stat_avg_life"
+ <?php if ($stat_avg_life) echo ' checked="checked"'; ?> />
+ <?php echo i18n::translate('Average age at death'); ?></td>
+ </tr>
+ <tr>
+ <td><input type="checkbox" value="yes" name="stat_events"
+ <?php if ($stat_events) echo ' checked="checked"'; ?> />
+ <?php echo i18n::translate('Total events'); ?></td>
+ <td><input type="checkbox" value="yes" name="stat_most_chil"
+ <?php if ($stat_most_chil) echo ' checked="checked"'; ?> />
+ <?php echo i18n::translate('Family with the most children'); ?></td>
+ </tr>
+ <tr>
+ <td><input type="checkbox" value="yes" name="stat_users"
+ <?php if ($stat_users) echo ' checked="checked"'; ?> />
+ <?php echo i18n::translate('Total users'); ?></td>
+ <td><input type="checkbox" value="yes" name="stat_avg_chil"
+ <?php if ($stat_avg_chil) echo ' checked="checked"'; ?> />
+ <?php echo i18n::translate('Average number of children per family'); ?></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <?php
+ $stat_link=get_block_setting($block_id, 'stat_link', true);
+ echo '<tr><td class="descriptionbox wrap width33">';
+ echo i18n::translate('Show link to Statistics charts?'), help_link('show_common_surnames');
+ echo '</td><td class="optionbox">';
+ echo edit_field_yes_no('stat_link', $stat_link);
+ echo '</td></tr>';
}
}
diff --git a/modules/html_block/module.php b/modules/html_block/module.php
index b503a6dbb8..54af723ed7 100644
--- a/modules/html_block/module.php
+++ b/modules/html_block/module.php
@@ -22,8 +22,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * @package webtrees
- * @subpackage Modules
* @version $Id: class_media.php 5451 2009-05-05 22:15:34Z fisharebest $
*/
@@ -46,12 +44,71 @@ class html_block_WT_Module extends WT_Module implements WT_Module_Block {
}
// Implement class WT_Module_Block
- public function getBlock($block, $config, $side, $index) {
- // Generate the block contents
+ public function getBlock($block_id) {
+ global $ctype, $WT_IMAGE_DIR, $WT_IMAGES, $THEME_DIR;
+
+ $id=$this->getName().$block_id;
+ $title='';
+ $content=embed_globals(get_block_setting($block_id, 'html'));
+
+ if ($ctype=="gedcom" && WT_USER_GEDCOM_ADMIN || $ctype=="user") {
+ $content .= "<br /><a href=\"javascript:;\" onclick=\"window.open('".encode_url("index_edit.php?action=configure&block_id={$block_id}")."', '_blank', 'top=50,left=50,width=600,height=350,scrollbars=1,resizable=1'); return false;\">";
+ $content .= "<img class=\"adminicon\" src=\"$WT_IMAGE_DIR/".$WT_IMAGES["admin"]["small"]."\" width=\"15\" height=\"15\" border=\"0\" alt=\"".i18n::translate('Configure')."\" title=\"".i18n::translate('Configure')."\" /></a>\n";
+ }
+
+ $block=get_block_setting($block_id, 'block', false);
+ if ($block) {
+ require $THEME_DIR.'templates/block_small_temp.php';
+ } else {
+ require $THEME_DIR.'templates/block_main_temp.php';
+ }
+ }
+
+ // Implement class WT_Module_Block
+ public function canLoadAjax() {
+ return true;
+ }
+
+ // Implement class WT_Module_Block
+ public function isUserBlock() {
+ return true;
}
// Implement class WT_Module_Block
- public function configureBlock() {
- // Create an edit form, and respond to the result
+ public function isGedcomBlock() {
+ return true;
+ }
+
+ // Implement class WT_Module_Block
+ public function configureBlock($block_id) {
+ if (safe_POST_bool('save')) {
+ set_block_setting($block_id, 'html', $_POST['html']);
+ echo WT_JS_START, 'window.opener.location.href=window.opener.location.href;window.close();', WT_JS_END;
+ exit;
+ }
+
+ $useFCK = file_exists(WT_ROOT.'modules/FCKeditor/fckeditor.php');
+ if($useFCK){
+ require WT_ROOT.'modules/FCKeditor/fckeditor.php';
+ }
+
+?>
+ <tr>
+ <td class="optionbox" colspan="2"><?php
+ if ($useFCK) { // use FCKeditor module
+ $oFCKeditor = new FCKeditor('html') ;
+ $oFCKeditor->BasePath = './modules/FCKeditor/';
+ $oFCKeditor->Value = get_block_setting($block_id, 'html');
+ $oFCKeditor->Width = 700;
+ $oFCKeditor->Height = 250;
+ $oFCKeditor->Config['AutoDetectLanguage'] = false ;
+ $oFCKeditor->Config['DefaultLanguage'] = WT_LOCALE;
+ $oFCKeditor->Create() ;
+ } else { //use standard textarea
+ echo '<textarea name="html" rows="10" cols="80">', htmlspecialchars(get_block_setting($block_id, 'html')), '</textarea>';
+ }
+ ?></td>
+ </tr>
+ <?php
}
}
diff --git a/modules/logged_in/module.php b/modules/logged_in/module.php
index fe7506040c..90fd7326f8 100644
--- a/modules/logged_in/module.php
+++ b/modules/logged_in/module.php
@@ -22,8 +22,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * @package webtrees
- * @subpackage Modules
* @version $Id: class_media.php 5451 2009-05-05 22:15:34Z fisharebest $
*/
@@ -46,12 +44,70 @@ class logged_in_WT_Module extends WT_Module implements WT_Module_Block {
}
// Implement class WT_Module_Block
- public function getBlock($block, $config, $side, $index) {
- // Generate the block contents
+ public function getBlock($block_id) {
+ global $WT_SESSION_TIME, $TEXT_DIRECTION, $THEME_DIR;
+
+ // Log out inactive users
+ foreach (get_idle_users(time()-$WT_SESSION_TIME) as $user_id=>$user_name) {
+ if ($user_id!=WT_USER_ID) {
+ userLogout($user_id);
+ }
+ }
+
+ // List active users
+ $NumAnonymous = 0;
+ $loggedusers = array ();
+ foreach (get_logged_in_users() as $user_id=>$user_name) {
+ if (WT_USER_IS_ADMIN || get_user_setting($user_id, 'visibleonline')=='Y') {
+ $loggedusers[$user_id]=$user_name;
+ } else {
+ $NumAnonymous++;
+ }
+ }
+
+ $id=$this->getName().$block_id;
+ $title=i18n::translate('Users Logged In').help_link('index_loggedin');
+ $content='<table width="90%">';
+ $LoginUsers=count($loggedusers);
+ if ($LoginUsers==0 && $NumAnonymous==0) {
+ $content.='<tr><td><b>' . i18n::translate('No logged-in and no anonymous users') . '</b></td></tr>';
+ }
+ if ($NumAnonymous>0) {
+ $content.='<tr><td><b>' . i18n::plural('%d anonymous logged-in user', '%d anonymous logged-in users', $NumAnonymous, $NumAnonymous) . '</b></td></tr>';
+ }
+ if ($LoginUsers>0) {
+ $content.='<tr><td><b>' . i18n::plural('%d logged-in user', '%d logged-in users', $LoginUsers, $LoginUsers) . '</b></td></tr>';
+ }
+ if (WT_USER_ID) {
+ foreach ($loggedusers as $user_id=>$user_name) {
+ $content .= "<tr><td><br />".PrintReady(getUserFullName($user_id))." - ".$user_name;
+ if (WT_USER_ID!=$user_id && get_user_setting($user_id, 'contactmethod')!="none") {
+ $content .= "<br /><a href=\"javascript:;\" onclick=\"return message('" . $user_id . "');\">" . i18n::translate('Send Message') . "</a>";
+ }
+ $content .= "</td></tr>";
+ }
+ }
+ $content .= "</table>";
+
+ require $THEME_DIR.'templates/block_main_temp.php';
+ }
+
+ // Implement class WT_Module_Block
+ public function canLoadAjax() {
+ return false;
+ }
+
+ // Implement class WT_Module_Block
+ public function isUserBlock() {
+ return true;
+ }
+
+ // Implement class WT_Module_Block
+ public function isGedcomBlock() {
+ return true;
}
// Implement class WT_Module_Block
- public function configureBlock() {
- // Create an edit form, and respond to the result
+ public function configureBlock($block_id) {
}
}
diff --git a/modules/login_block/module.php b/modules/login_block/module.php
index 2a234d0341..59f24bed71 100644
--- a/modules/login_block/module.php
+++ b/modules/login_block/module.php
@@ -22,8 +22,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * @package webtrees
- * @subpackage Modules
* @version $Id: class_media.php 5451 2009-05-05 22:15:34Z fisharebest $
*/
@@ -46,12 +44,129 @@ class login_block_WT_Module extends WT_Module implements WT_Module_Block {
}
// Implement class WT_Module_Block
- public function getBlock($block, $config, $side, $index) {
- // Generate the block contents
+ public function getBlock($block_id) {
+ global $QUERY_STRING, $USE_REGISTRATION_MODULE, $TEXT_DIRECTION, $THEME_DIR;
+
+ $id=$this->getName().$block_id;
+ if (WT_USER_ID) {
+ $title = i18n::translate('Logout');
+
+ $i = 0; // Initialize tab index
+
+ $content = '<div class="center"><form method="post" action="index.php?logout=1" name="logoutform" onsubmit="return true;">';
+ $content .= '<br /><a href="edituser.php" class="name2">'.i18n::translate('Logged in as ').' ('.WT_USER_NAME.')</a><br /><br />';
+
+ $i++;
+ $content .= "<input type=\"submit\" tabindex=\"{$i}\" value=\"".i18n::translate('Logout')."\" />";
+
+ $content .= "<br /><br /></form></div>";
+ } else {
+ $i = 0; // Initialize tab index
+ $title = i18n::translate('Login');
+ if ($USE_REGISTRATION_MODULE) {
+ $title.=help_link('index_login_register');
+ } else {
+ $title.=help_link('index_login');
+ }
+ $LOGIN_URL=get_site_setting('LOGIN_URL');
+ $content = "<div class=\"center\"><form method=\"post\" action=\"$LOGIN_URL\" name=\"loginform\" onsubmit=\"t = new Date(); document.loginform.usertime.value=t.getFullYear()+'-'+(t.getMonth()+1)+'-'+t.getDate()+' '+t.getHours()+':'+t.getMinutes()+':'+t.getSeconds(); return true;\">";
+ $content .= "<input type=\"hidden\" name=\"url\" value=\"index.php\" />";
+ $content .= "<input type=\"hidden\" name=\"ged\" value=\"";
+ $content .= WT_GEDCOM;
+ $content .= "\" />";
+ $content .= "<input type=\"hidden\" name=\"pid\" value=\"";
+ if (isset($pid)) $content .= $pid;
+ $content .= "\" />";
+ $content .= "<input type=\"hidden\" name=\"usertime\" value=\"\" />";
+ $content .= "<input type=\"hidden\" name=\"action\" value=\"login\" />";
+ $content .= "<table class=\"center tabs_table\">";
+
+ // Row 1: Userid
+ $i++;
+ $content .= "<tr><td ";
+ $content .= write_align_with_textdir_check("right", true);
+ $content .= " class=\"{$TEXT_DIRECTION} wrap width50\">";
+ $content .= i18n::translate('User name');
+ $content .= help_link('username');
+ $content .= "</td><td ";
+ $content .= write_align_with_textdir_check("left", true);
+ $content .= " class=\"{$TEXT_DIRECTION}\"><input type=\"text\" tabindex=\"{$i}\" name=\"username\" size=\"20\" class=\"formField\" />";
+ $content .= "</td></tr>";
+
+ // Row 2: Password
+ $i++;
+ $content .= "<tr><td ";
+ $content .= write_align_with_textdir_check("right", true);
+ $content .= " class=\"{$TEXT_DIRECTION} wrap width50\">";
+ $content .= i18n::translate('Password');
+ $content .= help_link('password');
+ $content .= "</td><td ";
+ $content .= write_align_with_textdir_check("left", true);
+ $content .= " class=\"{$TEXT_DIRECTION}\"><input type=\"password\" tabindex=\"{$i}\" name=\"password\" size=\"20\" class=\"formField\" />";
+ $content .= "</td></tr>";
+
+ // Row 3: "Login" link
+ $i++;
+ $content .= "<tr><td colspan=\"2\" class=\"center\">";
+ $content .= "<input type=\"submit\" tabindex=\"{$i}\" value=\"".i18n::translate('Login')."\" />&nbsp;";
+ $content .= "</td></tr>";
+
+ if ($USE_REGISTRATION_MODULE) {
+
+ // Row 4: "Request Account" link
+ $i++;
+ $content .= "<tr><td ";
+ $content .= write_align_with_textdir_check("right", true);
+ $content .= " class=\"{$TEXT_DIRECTION} wrap width50\"><br />";
+ $content .= i18n::translate('No account?');
+ $content .= help_link('new_user');
+ $content .= "</td><td ";
+ $content .= write_align_with_textdir_check("left", true);
+ $content .= " class=\"{$TEXT_DIRECTION}\"><br />";
+ $content .= "<a href=\"login_register.php?action=register\" tabindex=\"{$i}\">";
+ $content .= i18n::translate('Request new user account');
+ $content .= "</a>";
+ $content .= "</td></tr>";
+
+ // Row 5: "Lost Password" link
+ $i++;
+ $content .= "<tr><td ";
+ $content .= write_align_with_textdir_check("right", true);
+ $content .= " class=\"{$TEXT_DIRECTION} wrap width50\">";
+ $content .= i18n::translate('Lost your password?');
+ $content .= help_link('new_password');
+ $content .= "</td><td ";
+ $content .= write_align_with_textdir_check("left", true);
+ $content .= " class=\"{$TEXT_DIRECTION}\">";
+ $content .= "<a href=\"login_register.php?action=pwlost\" tabindex=\"{$i}\">";
+ $content .= i18n::translate('Request new password');
+ $content .= "</a>";
+ $content .= "</td></tr>";
+ }
+
+ $content .= "</table>";
+ $content .= "</form></div>";
+ }
+
+ require $THEME_DIR.'templates/block_main_temp.php';
+ }
+
+ // Implement class WT_Module_Block
+ public function canLoadAjax() {
+ return false;
+ }
+
+ // Implement class WT_Module_Block
+ public function isUserBlock() {
+ return true;
+ }
+
+ // Implement class WT_Module_Block
+ public function isGedcomBlock() {
+ return true;
}
// Implement class WT_Module_Block
- public function configureBlock() {
- // Create an edit form, and respond to the result
+ public function configureBlock($block_id) {
}
}
diff --git a/modules/random_media/module.php b/modules/random_media/module.php
index 2f8b993f38..cc2d6db8bc 100644
--- a/modules/random_media/module.php
+++ b/modules/random_media/module.php
@@ -22,8 +22,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * @package webtrees
- * @subpackage Modules
* @version $Id: class_media.php 5451 2009-05-05 22:15:34Z fisharebest $
*/
@@ -46,12 +44,449 @@ class random_media_WT_Module extends WT_Module implements WT_Module_Block {
}
// Implement class WT_Module_Block
- public function getBlock($block, $config, $side, $index) {
- // Generate the block contents
+ public function getBlock($block_id) {
+ global $foundlist, $MULTI_MEDIA, $TEXT_DIRECTION, $WT_IMAGE_DIR, $WT_IMAGES;
+ global $MEDIA_EXTERNAL, $MEDIA_DIRECTORY, $SHOW_SOURCES;
+ global $MEDIATYPE, $THUMBNAIL_WIDTH, $USE_MEDIA_VIEWER, $WT_IMAGE_DIR, $WT_IMAGES;
+
+ if (!$MULTI_MEDIA) return;
+
+ $filter =get_block_setting($block_id, 'filter', 'all');
+ $controls=get_block_setting($block_id, 'controls', true);
+ $start =get_block_setting($block_id, 'start', false) || safe_GET_bool('start');
+ $block =get_block_setting($block_id, 'block', true);
+
+ $filters=array(
+ 'avi' =>get_block_setting($block_id, 'filter_avi', false),
+ 'bmp' =>get_block_setting($block_id, 'filter_bmp', true),
+ 'gif' =>get_block_setting($block_id, 'filter_gif', true),
+ 'jpeg' =>get_block_setting($block_id, 'filter_jpeg', true),
+ 'mp3' =>get_block_setting($block_id, 'filter_mp3', false),
+ 'ole' =>get_block_setting($block_id, 'filter_ole', true),
+ 'pcx' =>get_block_setting($block_id, 'filter_pcx', true),
+ 'pdf' =>get_block_setting($block_id, 'filter_pdf', false),
+ 'png' =>get_block_setting($block_id, 'filter_png', true),
+ 'tiff' =>get_block_setting($block_id, 'filter_tiff', true),
+ 'wav' =>get_block_setting($block_id, 'filter_wav', false),
+ 'audio' =>get_block_setting($block_id, 'filter_audio', false),
+ 'book' =>get_block_setting($block_id, 'filter_book', true),
+ 'card' =>get_block_setting($block_id, 'filter_card', true),
+ 'certificate'=>get_block_setting($block_id, 'filter_certificate', true),
+ 'coat' =>get_block_setting($block_id, 'filter_coat', true),
+ 'document' =>get_block_setting($block_id, 'filter_document', true),
+ 'electronic' =>get_block_setting($block_id, 'filter_electronic', true),
+ 'fiche' =>get_block_setting($block_id, 'filter_fiche', true),
+ 'film' =>get_block_setting($block_id, 'filter_film', true),
+ 'magazine' =>get_block_setting($block_id, 'filter_magazine', true),
+ 'manuscript' =>get_block_setting($block_id, 'filter_manuscript', true),
+ 'map' =>get_block_setting($block_id, 'filter_map', true),
+ 'newspaper' =>get_block_setting($block_id, 'filter_newspaper', true),
+ 'other' =>get_block_setting($block_id, 'filter_other', true),
+ 'painting' =>get_block_setting($block_id, 'filter_painting', true),
+ 'photo' =>get_block_setting($block_id, 'filter_photo', true),
+ 'tombstone' =>get_block_setting($block_id, 'filter_tombstone', true),
+ 'video' =>get_block_setting($block_id, 'filter_video', false),
+ );
+
+ $medialist = array();
+ $foundlist = array();
+
+ $medialist = get_medialist(false, '', true, true);
+ $ct = count($medialist);
+ if ($ct>0) {
+ $i=0;
+ $disp = false;
+ //-- try up to 40 times to get a media to display
+ while($i<40) {
+ $error = false;
+ $value = array_rand($medialist);
+ if (WT_DEBUG) {
+ print "<br />";print_r($medialist[$value]);print "<br />";
+ print "Trying ".$medialist[$value]["XREF"]."<br />";
+ }
+ $links = $medialist[$value]["LINKS"];
+ $disp = ($medialist[$value]["EXISTS"]>0) && $medialist[$value]["LINKED"] && $medialist[$value]["CHANGE"]!="delete" ;
+ if (WT_DEBUG && !$disp && !$error) {$error = true; print "<span class=\"error\">".$medialist[$value]["XREF"]." File does not exist, or is not linked to anyone, or is marked for deletion.</span><br />";}
+
+ $disp &= displayDetailsById($medialist[$value]["XREF"], "OBJE");
+ $disp &= !FactViewRestricted($medialist[$value]["XREF"], $medialist[$value]["GEDCOM"]);
+
+ if (WT_DEBUG && !$disp && !$error) {$error = true; print "<span class=\"error\">".$medialist[$value]["XREF"]." Failed to pass privacy</span><br />";}
+
+ $isExternal = isFileExternal($medialist[$value]["FILE"]);
+
+ if ($block && !$isExternal) $disp &= ($medialist[$value]["THUMBEXISTS"]>0);
+ if (WT_DEBUG && !$disp && !$error) {$error = true; print "<span class=\"error\">".$medialist[$value]["XREF"]." thumbnail file could not be found</span><br />";}
+
+ // Filter according to format and type (Default: unless configured otherwise, don't filter)
+ if (!empty($medialist[$value]["FORM"]) && !get_block_setting($block_id, "filter_".$medialist[$value]["FORM"])) $disp = false;
+ if (!empty($medialist[$value]["TYPE"]) && !get_block_setting($block_id, "filter_".$medialist[$value]["TYPE"])) $disp = false;
+ if (WT_DEBUG && !$disp && !$error) {$error = true; print "<span class=\"error\">".$medialist[$value]["XREF"]." failed Format or Type filters</span><br />";}
+
+ if ($disp && count($links) != 0){
+ if ($disp && $filter!="all") {
+ // Apply filter criteria
+ $ct = preg_match("/0\s(@.*@)\sOBJE/", $medialist[$value]["GEDCOM"], $match);
+ $objectID = $match[1];
+ //-- we could probably use the database for this filter
+ foreach($links as $key=>$type) {
+ $gedrec = find_gedcom_record($key, WT_GED_ID);
+ $ct2 = preg_match("/(\d)\sOBJE\s{$objectID}/", $gedrec, $match2);
+ if ($ct2>0) {
+ $objectRefLevel = $match2[1];
+ if ($filter=="indi" && $objectRefLevel!="1") $disp = false;
+ if ($filter=="event" && $objectRefLevel=="1") $disp = false;
+ if (WT_DEBUG && !$disp && !$error) {$error = true; print "<span class=\"error\">".$medialist[$value]["XREF"]." failed to pass config filter</span><br />";}
+ }
+ else $disp = false;
+ }
+ }
+ }
+ //-- leave the loop if we find an image that works
+ if ($disp) {
+ break;
+ }
+ //-- otherwise remove the private media item from the list
+ else {
+ if (WT_DEBUG) print "<span class=\"error\">".$medialist[$value]["XREF"]." Will not be shown</span><br />";
+ unset($medialist[$value]);
+ }
+ //-- if there are no more media items, then try to get some more
+ if (count($medialist)==0) $medialist = get_medialist(false, '', true, true);
+ $i++;
+ }
+ if (!$disp) {
+ return false;
+ }
+
+ $id=$this->getName().$block_id;
+ $title='';
+ $content = "";
+ $title .= "<a href=\"javascript: configure block\" onclick=\"window.open('".encode_url("index_edit.php?action=configure&block_id={$block_id}")."', '_blank', 'top=50,left=50,width=600,height=350,scrollbars=1,resizable=1'); return false;\">";
+ $title .= "<img class=\"adminicon\" src=\"{$WT_IMAGE_DIR}/{$WT_IMAGES['admin']['small']}\" width=\"15\" height=\"15\" border=\"0\" alt=\"".i18n::translate('Configure')."\" /></a>";
+ $title .= i18n::translate('Random Picture');
+ $title .= help_link('index_media');
+ $content = "<div id=\"random_picture_container$block_id\">";
+ if ($controls) {
+ if ($start) {
+ $image = "stop";
+ } else {
+ $image = "rarrow";
+ }
+ $linkNextImage = "<a href=\"javascript: ".i18n::translate('Next image')."\" onclick=\"jQuery('#block_{$block_id}').load('index.php?action=ajax&block_id={$block_id}');return false;\"><img src=\"{$WT_IMAGE_DIR}/{$WT_IMAGES['rdarrow']['other']}\" border=\"0\" alt=\"".i18n::translate('Next image')."\" title=\"".i18n::translate('Next image')."\" /></a>";
+
+ $content .= "<div class=\"center\" id=\"random_picture_controls$block_id\"><br />";
+ if ($TEXT_DIRECTION=="rtl") $content .= $linkNextImage;
+ $content .= "<a href=\"javascript: ".i18n::translate('Play')."/".i18n::translate('Stop')."\" onclick=\"togglePlay(); return false;\">";
+ if (isset($WT_IMAGES[$image]['other'])) $content .= "<img id=\"play_stop\" src=\"{$WT_IMAGE_DIR}/{$WT_IMAGES[$image]['other']}\" border=\"0\" alt=\"".i18n::translate('Play')."/".i18n::translate('Stop')."\" title=\"".i18n::translate('Play')."/".i18n::translate('Stop')."\" />";
+ else $content .= i18n::translate('Play')."/".i18n::translate('Stop');
+ $content .= "</a>";
+ if ($TEXT_DIRECTION=="ltr") $content .= $linkNextImage;
+ $content .= '
+ </div>
+ <script language="JavaScript" type="text/javascript">
+ <!--
+ var play = false;
+ function togglePlay() {
+ if (play) {
+ play = false;
+ imgid = document.getElementById("play_stop");
+ imgid.src = \''.$WT_IMAGE_DIR."/".$WT_IMAGES["rarrow"]['other'].'\';
+ }
+ else {
+ play = true;
+ playSlideShow();
+ imgid = document.getElementById("play_stop");
+ imgid.src = \''.$WT_IMAGE_DIR."/".$WT_IMAGES["stop"]['other'].'\';
+ }
+ }
+
+ function playSlideShow() {
+ if (play) {
+ window.setTimeout(\'reload_image()\', 6000);
+ }
+ }
+ function reload_image() {
+ jQuery(\'#block_'.$block_id.'\').load(\'index.php?action=ajax&block_id='.$block_id.'&start=1\');
+ }
+
+ //-->
+ </script>';
+ }
+ if ($start) {
+ $content .= '
+ <script language="JavaScript" type="text/javascript">
+ <!--
+ play = true;
+ imgid = document.getElementById("play_stop");
+ imgid.src = \''.$WT_IMAGE_DIR."/".$WT_IMAGES["stop"]['other'].'\';
+ window.setTimeout("playSlideShow()", 6000);
+ //-->
+ </script>';
+ }
+ $content .= "<div class=\"center\" id=\"random_picture_content$block_id\">";
+ $imgsize = findImageSize($medialist[$value]["FILE"]);
+ $imgwidth = $imgsize[0]+40;
+ $imgheight = $imgsize[1]+150;
+ $content .= "<table id=\"random_picture_box\" width=\"100%\"><tr><td valign=\"top\"";
+
+ if ($block) $content .= " align=\"center\" class=\"details1\"";
+ else $content .= " class=\"details2\"";
+ $mediaid = $medialist[$value]["XREF"];
+
+//LBox -------- change for Lightbox Album --------------------------------------------
+?>
+<script language="JavaScript" type="text/javascript">
+<!--
+function openPic(filename, width, height) {
+ height=height+50;
+ screenW = screen.width;
+ screenH = screen.height;
+ if (width>screenW-100) width=screenW-100;
+ if (height>screenH-110) height=screenH-120;
+ if ((filename.search(/\.je?pg$/gi)!=-1)||(filename.search(/\.gif$/gi)!=-1)||(filename.search(/\.png$/gi)!=-1)||(filename.search(/\.bmp$/gi)!=-1))
+ win02 = window.open('imageview.php?filename='+filename,'win02','top=50,left=150,height='+height+',width='+width+',scrollbars=1,resizable=1');
+ // win03.resizeTo(winWidth 2,winHeight 30);
+ else window.open(unescape(filename),'win02','top=50,left=150,height='+height+',width='+width+',scrollbars=1,resizable=1');
+ win02.focus();
+ }
+-->
+</script><?php
+
+ if (WT_USE_LIGHTBOX) {
+ // $content .= " ><a href=\"javascript:;\" onclick=\"return openPic('".$medialist[$value]["FILE"]."', $imgwidth, $imgheight);\">";
+ // $content .= " ><a href=\"javascript:;\" onclick=\"return openImage('".$medialist[$value]["FILE"]."', $imgwidth, $imgheight);\">";
+ // $content .= "><a href=\"" . $medialist[$value]["FILE"] . "\" rel=\"clearbox[general_4]\" title=\"" . $mediaid . "\">" . "\n";
+ $content .= " ><a href=\"mediaviewer.php?mid=".$mediaid."\">";
+ }else
+// ---------------------------------------------------------------------------------------------
+
+
+ if ($USE_MEDIA_VIEWER) {
+ $content .= " ><a href=\"mediaviewer.php?mid=".$mediaid."\">";
+ }
+ else {
+ $content .= " ><a href=\"javascript:;\" onclick=\"return openImage('".$medialist[$value]["FILE"]."', $imgwidth, $imgheight);\">";
+ }
+ $mediaTitle = "";
+ if (!empty($medialist[$value]["TITL"])) {
+ $mediaTitle = PrintReady($medialist[$value]["TITL"]);
+ }
+ else $mediaTitle = basename($medialist[$value]["FILE"]);
+ if ($block) {
+ $content .= "<img src=\"".$medialist[$value]["THUMB"]."\" border=\"0\" class=\"thumbnail\"";
+ if ($isExternal) $content .= " width=\"".$THUMBNAIL_WIDTH."\"";
+ } else {
+ $content .= "<img src=\"".$medialist[$value]["FILE"]."\" border=\"0\" class=\"thumbnail\" ";
+ $imgsize = findImageSize($medialist[$value]["FILE"]);
+ if ($imgsize[0] > 175) $content .= "width=\"175\" ";
+ }
+ $content .= " alt=\"{$mediaTitle}\" title=\"{$mediaTitle}\" />";
+ $content .= "</a>";
+ if ($block) $content .= "<br />";
+ else $content .= "</td><td class=\"details2\">";
+ $content .= "<a href=\"mediaviewer.php?mid=".$mediaid."\">";
+ $content .= "<b>". $mediaTitle ."</b>";
+ $content .= "</a><br />";
+
+ ob_start();
+ PrintMediaLinks($medialist[$value]["LINKS"], "normal");
+ $content .= ob_get_clean();
+ $content .= "<br /><div class=\"indent" . ($TEXT_DIRECTION=="rtl"?"_rtl":"") . "\">";
+ $content .= print_fact_notes($medialist[$value]["GEDCOM"], "1", false, true);
+ $content .= "</div>";
+ $content .= "</td></tr></table>";
+ $content .= "</div>"; // random_picture_content
+ $content .= "</div>"; // random_picture_container
+ global $THEME_DIR;
+ require $THEME_DIR.'templates/block_main_temp.php';
+ }
+ }
+
+ // Implement class WT_Module_Block
+ public function canLoadAjax() {
+ return true;
}
// Implement class WT_Module_Block
- public function configureBlock() {
- // Create an edit form, and respond to the result
+ public function isUserBlock() {
+ return true;
+ }
+
+ // Implement class WT_Module_Block
+ public function isGedcomBlock() {
+ return true;
+ }
+
+ // Implement class WT_Module_Block
+ public function configureBlock($block_id) {
+ if (safe_POST_bool('save')) {
+ set_block_setting($block_id, 'filter', safe_POST('filter', array('indi', 'event', 'all'), 'all'));
+ set_block_setting($block_id, 'controls', safe_POST_bool('controls'));
+ set_block_setting($block_id, 'start', safe_POST_bool('start'));
+ set_block_setting($block_id, 'filter_avi', safe_POST_bool('filter_avi'));
+ set_block_setting($block_id, 'filter_bmp', safe_POST_bool('filter_bmp'));
+ set_block_setting($block_id, 'filter_gif', safe_POST_bool('filter_gif'));
+ set_block_setting($block_id, 'filter_jpeg', safe_POST_bool('filter_jpeg'));
+ set_block_setting($block_id, 'filter_mp3', safe_POST_bool('filter_mp3'));
+ set_block_setting($block_id, 'filter_ole', safe_POST_bool('filter_ole'));
+ set_block_setting($block_id, 'filter_pcx', safe_POST_bool('filter_pcx'));
+ set_block_setting($block_id, 'filter_pdf', safe_POST_bool('filter_pdf'));
+ set_block_setting($block_id, 'filter_png', safe_POST_bool('filter_png'));
+ set_block_setting($block_id, 'filter_tiff', safe_POST_bool('filter_tiff'));
+ set_block_setting($block_id, 'filter_wav', safe_POST_bool('filter_wav'));
+ set_block_setting($block_id, 'filter_audio', safe_POST_bool('filter_audio'));
+ set_block_setting($block_id, 'filter_book', safe_POST_bool('filter_book'));
+ set_block_setting($block_id, 'filter_card', safe_POST_bool('filter_card'));
+ set_block_setting($block_id, 'filter_certificate', safe_POST_bool('filter_certificate'));
+ set_block_setting($block_id, 'filter_coat', safe_POST_bool('filter_coat'));
+ set_block_setting($block_id, 'filter_document', safe_POST_bool('filter_document'));
+ set_block_setting($block_id, 'filter_electronic', safe_POST_bool('filter_electronic'));
+ set_block_setting($block_id, 'filter_fiche', safe_POST_bool('filter_fiche'));
+ set_block_setting($block_id, 'filter_film', safe_POST_bool('filter_film'));
+ set_block_setting($block_id, 'filter_magazine', safe_POST_bool('filter_magazine'));
+ set_block_setting($block_id, 'filter_manuscript', safe_POST_bool('filter_manuscript'));
+ set_block_setting($block_id, 'filter_map', safe_POST_bool('filter_map'));
+ set_block_setting($block_id, 'filter_newspaper', safe_POST_bool('filter_newspaper'));
+ set_block_setting($block_id, 'filter_other', safe_POST_bool('filter_other'));
+ set_block_setting($block_id, 'filter_painting', safe_POST_bool('filter_painting'));
+ set_block_setting($block_id, 'filter_photo', safe_POST_bool('filter_photo'));
+ set_block_setting($block_id, 'filter_tombstone', safe_POST_bool('filter_tombstone'));
+ set_block_setting($block_id, 'filter_video', safe_POST_bool('filter_video'));
+ echo WT_JS_START, 'window.opener.location.href=window.opener.location.href;window.close();', WT_JS_END;
+ exit;
+ }
+
+ require_once WT_ROOT.'includes/functions/functions_edit.php';
+
+ $filter=get_block_setting($block_id, 'filter', 'all');
+ echo '<tr><td class="descriptionbox wrap width33">';
+ echo i18n::translate('Show only persons, events, or all?'), help_link('random_media_persons_or_all');
+ echo '</td><td class="optionbox">';
+ echo select_edit_control('filter', array('indi'=>i18n::translate('Persons'), 'event'=>i18n::translate('Events'), 'all'=>i18n::translate('All')), null, $filter, '');
+ echo '</td></tr>';
+
+ $filters=array(
+ 'avi' =>get_block_setting($block_id, 'filter_avi', false),
+ 'bmp' =>get_block_setting($block_id, 'filter_bmp', true),
+ 'gif' =>get_block_setting($block_id, 'filter_gif', true),
+ 'jpeg' =>get_block_setting($block_id, 'filter_jpeg', true),
+ 'mp3' =>get_block_setting($block_id, 'filter_mp3', false),
+ 'ole' =>get_block_setting($block_id, 'filter_ole', true),
+ 'pcx' =>get_block_setting($block_id, 'filter_pcx', true),
+ 'pdf' =>get_block_setting($block_id, 'filter_pdf', false),
+ 'png' =>get_block_setting($block_id, 'filter_png', true),
+ 'tiff' =>get_block_setting($block_id, 'filter_tiff', true),
+ 'wav' =>get_block_setting($block_id, 'filter_wav', false),
+ 'audio' =>get_block_setting($block_id, 'filter_audio', false),
+ 'book' =>get_block_setting($block_id, 'filter_book', true),
+ 'card' =>get_block_setting($block_id, 'filter_card', true),
+ 'certificate'=>get_block_setting($block_id, 'filter_certificate', true),
+ 'coat' =>get_block_setting($block_id, 'filter_coat', true),
+ 'document' =>get_block_setting($block_id, 'filter_document', true),
+ 'electronic' =>get_block_setting($block_id, 'filter_electronic', true),
+ 'fiche' =>get_block_setting($block_id, 'filter_fiche', true),
+ 'film' =>get_block_setting($block_id, 'filter_film', true),
+ 'magazine' =>get_block_setting($block_id, 'filter_magazine', true),
+ 'manuscript' =>get_block_setting($block_id, 'filter_manuscript', true),
+ 'map' =>get_block_setting($block_id, 'filter_map', true),
+ 'newspaper' =>get_block_setting($block_id, 'filter_newspaper', true),
+ 'other' =>get_block_setting($block_id, 'filter_other', true),
+ 'painting' =>get_block_setting($block_id, 'filter_painting', true),
+ 'photo' =>get_block_setting($block_id, 'filter_photo', true),
+ 'tombstone' =>get_block_setting($block_id, 'filter_tombstone', true),
+ 'video' =>get_block_setting($block_id, 'filter_video', false),
+ );
+
+ echo '<tr><td class="descriptionbox wrap width33">';
+ echo i18n::translate('Filter'), help_link('random_media_filter');
+?>
+ </td>
+ <td class="optionbox">
+ <center><b><?php echo i18n::translate('FORM'); ?></b></center>
+ <table class="width100">
+ <tr>
+ <td class="width33"><input type="checkbox" value="yes"
+ name="filter_avi"
+ <?php if ($filters['avi']) print " checked=\"checked\""; ?> />&nbsp;&nbsp;avi&nbsp;&nbsp;</td>
+ <td class="width33"><input type="checkbox" value="yes"
+ name="filter_bmp"
+ <?php if ($filters['bmp']) print " checked=\"checked\""; ?> />&nbsp;&nbsp;bmp&nbsp;&nbsp;</td>
+ <td class="width33"><input type="checkbox" value="yes"
+ name="filter_gif"
+ <?php if ($filters['gif']) print " checked=\"checked\""; ?> />&nbsp;&nbsp;gif&nbsp;&nbsp;</td>
+ </tr>
+ <tr>
+ <td class="width33"><input type="checkbox" value="yes"
+ name="filter_jpeg"
+ <?php if ($filters['jpeg']) print " checked=\"checked\""; ?> />&nbsp;&nbsp;jpeg&nbsp;&nbsp;</td>
+ <td class="width33"><input type="checkbox" value="yes"
+ name="filter_mp3"
+ <?php if ($filters['mp3']) print " checked=\"checked\""; ?> />&nbsp;&nbsp;mp3&nbsp;&nbsp;</td>
+ <td class="width33"><input type="checkbox" value="yes"
+ name="filter_ole"
+ <?php if ($filters['ole']) print " checked=\"checked\""; ?> />&nbsp;&nbsp;ole&nbsp;&nbsp;</td>
+ </tr>
+ <tr>
+ <td class="width33"><input type="checkbox" value="yes"
+ name="filter_pcx"
+ <?php if ($filters['pcx']) print " checked=\"checked\""; ?> />&nbsp;&nbsp;pcx&nbsp;&nbsp;</td>
+ <td class="width33"><input type="checkbox" value="yes"
+ name="filter_pdf"
+ <?php if ($filters['pdf']) print " checked=\"checked\""; ?> />&nbsp;&nbsp;pdf&nbsp;&nbsp;</td>
+ <td class="width33"><input type="checkbox" value="yes"
+ name="filter_png"
+ <?php if ($filters['png']) print " checked=\"checked\""; ?> />&nbsp;&nbsp;png&nbsp;&nbsp;</td>
+ </tr>
+ <tr>
+ <td class="width33"><input type="checkbox" value="yes"
+ name="filter_tiff"
+ <?php if ($filters['tiff']) print " checked=\"checked\""; ?> />&nbsp;&nbsp;tiff&nbsp;&nbsp;</td>
+ <td class="width33"><input type="checkbox" value="yes"
+ name="filter_wav"
+ <?php if ($filters['wav']) print " checked=\"checked\""; ?> />&nbsp;&nbsp;wav&nbsp;&nbsp;</td>
+ <td class="width33">&nbsp;</td>
+ <td class="width33">&nbsp;</td>
+ </tr>
+ </table>
+ <br />
+ <center><b><?php echo i18n::translate('TYPE'); ?></b></center>
+ <table class="width100">
+ <tr>
+ <?php
+ //-- Build the list of checkboxes
+ $i = 0;
+ global $MEDIA_TYPES;
+ foreach ($MEDIA_TYPES as $typeName => $typeValue) {
+ $i++;
+ if ($i > 3) {
+ $i = 1;
+ print "</tr><tr>";
+ }
+ print "<td class=\"width33\"><input type=\"checkbox\" value=\"yes\" name=\"filter_".$typeName."\"";
+ if ($filters[$typeName]) print " checked=\"checked\"";
+ print " />&nbsp;&nbsp;".$typeValue."&nbsp;&nbsp;</td>";
+ }
+ ?>
+ </tr>
+ </table>
+ </td>
+ </tr>
+
+ <?php
+
+ $controls=get_block_setting($block_id, 'controls', false);
+ echo '<tr><td class="descriptionbox wrap width33">';
+ echo i18n::translate('Show slideshow controls?'), help_link('random_media_ajax_controls');
+ echo '</td><td class="optionbox">';
+ echo edit_field_yes_no('controls', $controls);
+ echo '</td></tr>';
+
+ $start=get_block_setting($block_id, 'start', false);
+ echo '<tr><td class="descriptionbox wrap width33">';
+ echo i18n::translate('Start slideshow on page load?'), help_link('random_media_start_slide');
+ echo '</td><td class="optionbox">';
+ echo edit_field_yes_no('start', $start);
+ echo '</td></tr>';
}
}
diff --git a/modules/recent_changes/module.php b/modules/recent_changes/module.php
index bbcca62658..73116db43e 100644
--- a/modules/recent_changes/module.php
+++ b/modules/recent_changes/module.php
@@ -22,8 +22,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * @package webtrees
- * @subpackage Modules
* @version $Id: class_media.php 5451 2009-05-05 22:15:34Z fisharebest $
*/
@@ -46,12 +44,95 @@ class recent_changes_WT_Module extends WT_Module implements WT_Module_Block {
}
// Implement class WT_Module_Block
- public function getBlock($block, $config, $side, $index) {
- // Generate the block contents
+ public function getBlock($block_id) {
+ global $ctype, $WT_IMAGE_DIR, $WT_IMAGES, $THEME_DIR;
+
+ $days =get_block_setting($block_id, 'days', 30);
+ $hide_empty=get_block_setting($block_id, 'hide_empty', false);
+
+ $found_facts=get_recent_changes(client_jd()-$days);
+
+ if (empty($found_facts) && $hide_empty) {
+ return;
+ }
+ // Print block header
+ $id=$this->getName().$block_id;
+ $title='';
+ if ($ctype=="gedcom" && WT_USER_GEDCOM_ADMIN || $ctype=='user') {
+ if ($ctype=="gedcom") {
+ $name = WT_GEDCOM;
+ } else {
+ $name = WT_USER_NAME;
+ }
+ $title .= "<a href=\"javascript: configure block\" onclick=\"window.open('".encode_url("index_edit.php?action=configure&block_id={$block_id}")."', '_blank', 'top=50,left=50,width=600,height=350,scrollbars=1,resizable=1'); return false;\">";
+ $title .= "<img class=\"adminicon\" src=\"$WT_IMAGE_DIR/".$WT_IMAGES["admin"]["small"]."\" width=\"15\" height=\"15\" border=\"0\" alt=\"".i18n::translate('Configure')."\" /></a>";
+ }
+ $title.=i18n::translate('Recent Changes').help_link('recent_changes');
+
+ $content = "";
+ // Print block content
+ if (count($found_facts)==0) {
+ $content .= i18n::translate('There have been no changes within the last %s days.', $days);
+ } else {
+ $content .= i18n::translate('Changes made within the last %s days', $days);
+ // sortable table
+ require_once WT_ROOT.'includes/functions/functions_print_lists.php';
+ ob_start();
+ print_changes_table($found_facts);
+ $content .= ob_get_clean();
+ }
+
+ $block=get_block_setting($block_id, 'block', true);
+ if ($block) {
+ require $THEME_DIR.'templates/block_small_temp.php';
+ } else {
+ require $THEME_DIR.'templates/block_main_temp.php';
+ }
+ }
+
+ // Implement class WT_Module_Block
+ public function canLoadAjax() {
+ return true;
+ }
+
+ // Implement class WT_Module_Block
+ public function isUserBlock() {
+ return true;
+ }
+
+ // Implement class WT_Module_Block
+ public function isGedcomBlock() {
+ return true;
}
// Implement class WT_Module_Block
- public function configureBlock() {
- // Create an edit form, and respond to the result
+ public function configureBlock($block_id) {
+ global $DAYS_TO_SHOW_LIMIT;
+
+ if (safe_POST_bool('save')) {
+ set_block_setting($block_id, 'days', safe_POST_integer('days', 1, $DAYS_TO_SHOW_LIMIT, $DAYS_TO_SHOW_LIMIT));
+ set_block_setting($block_id, 'hide_empty', safe_POST_bool('hide_empty'));
+ echo WT_JS_START, 'window.opener.location.href=window.opener.location.href;window.close();', WT_JS_END;
+ exit;
+ }
+
+ require_once WT_ROOT.'includes/functions/functions_edit.php';
+
+ $days=get_block_setting($block_id, 'days', $DAYS_TO_SHOW_LIMIT);
+ echo '<tr><td class="descriptionbox wrap width33">';
+ echo i18n::translate('Number of days to show'), help_link('days_to_show');
+ echo '</td><td class="optionbox">';
+ echo '<input type="text" name="days" size="2" value="', $days, '" />';
+ echo '</td></tr>';
+
+ $hide_empty=get_block_setting($block_id, 'hide_empty', true);
+ echo '<tr><td class="descriptionbox wrap width33">';
+ echo i18n::translate('Should this block be hidden when it is empty?');
+ echo '</td><td class="optionbox">';
+ echo edit_field_yes_no('hide_empty', $hide_empty);
+ echo '</td></tr>';
+ echo '<tr><td colspan="2" class="optionbox wrap">';
+ echo '<span class="error">', i18n::translate('If you hide an empty block, you will not be able to change its configuration until it becomes visible by no longer being empty.'), '</span>';
+ echo '</td></tr>';
}
}
diff --git a/modules/review_changes/module.php b/modules/review_changes/module.php
index c72b391dc3..d1be83f7a8 100644
--- a/modules/review_changes/module.php
+++ b/modules/review_changes/module.php
@@ -22,8 +22,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * @package webtrees
- * @subpackage Modules
* @version $Id: class_media.php 5451 2009-05-05 22:15:34Z fisharebest $
*/
@@ -46,12 +44,144 @@ class review_changes_WT_Module extends WT_Module implements WT_Module_Block {
}
// Implement class WT_Module_Block
- public function getBlock($block, $config, $side, $index) {
- // Generate the block contents
+ public function getBlock($block_id) {
+ global $ctype, $QUERY_STRING, $WT_IMAGE_DIR, $WT_IMAGES, $TEXT_DIRECTION, $SHOW_SOURCES, $WEBTREES_EMAIL, $TBLPREFIX;
+
+ $changes=WT_DB::prepare(
+ "SELECT 1".
+ " FROM {$TBLPREFIX}change".
+ " WHERE status='pending'".
+ " LIMIT 1"
+ )->fetchOne();
+
+ $days =get_block_setting($block_id, 'days', 1);
+ $sendmail=get_block_setting($block_id, 'sendmail', true);
+ $block =get_block_setting($block_id, 'block', true);
+
+ if ($changes) {
+ //-- if the time difference from the last email is greater than 24 hours then send out another email
+ $LAST_CHANGE_EMAIL=get_site_setting('LAST_CHANGE_EMAIL');
+ if (time()-$LAST_CHANGE_EMAIL > (60*60*24*$days)) {
+ $LAST_CHANGE_EMAIL = time();
+ set_site_setting('LAST_CHANGE_EMAIL', $LAST_CHANGE_EMAIL);
+ if ($sendmail=="yes") {
+ // Which users have pending changes?
+ $users_with_changes=array();
+ foreach (get_all_users() as $user_id=>$user_name) {
+ foreach (get_all_gedcoms() as $ged_id=>$ged_name) {
+ if (exists_pending_change($user_id, $ged_id)) {
+ $users_with_changes[$user_id]=$user_name;
+ break;
+ }
+ }
+ }
+ foreach ($users_with_changes as $user_id=>$user_name) {
+ //-- send message
+ $message = array();
+ $message["to"]=$user_name;
+ $message["from"] = $WEBTREES_EMAIL;
+ $message["subject"] = i18n::translate('webtrees - Review changes');
+ $message["body"] = i18n::translate('Online changes have been made to a genealogical database. These changes need to be reviewed and accepted before they will appear to all users. Please use the URL below to enter that webtrees site and login to review the changes.');
+ $message["method"] = get_user_setting($user_id, 'contactmethod');
+ $message["url"] = WT_SERVER_NAME.WT_SCRIPT_PATH;
+ $message["no_from"] = true;
+ addMessage($message);
+ }
+ }
+ }
+ if (WT_USER_CAN_EDIT) {
+ $id=$this->getName().$block_id;
+ $title='';
+ if ($ctype=="gedcom" && WT_USER_GEDCOM_ADMIN || $ctype=="user" && WT_USER_ID) {
+ if ($ctype=="gedcom") {
+ $name = WT_GEDCOM;
+ } else {
+ $name = WT_USER_NAME;
+ }
+ $title .= "<a href=\"javascript: configure block\" onclick=\"window.open('index_edit.php?action=configure&block_id={$block_id}', '_blank', 'top=50,left=50,width=600,height=350,scrollbars=1,resizable=1'); return false;\">";
+ $title .= "<img class=\"adminicon\" src=\"$WT_IMAGE_DIR/".$WT_IMAGES["admin"]["small"]."\" width=\"15\" height=\"15\" border=\"0\" alt=\"".i18n::translate('Configure')."\" /></a>";
+ }
+ $title.=i18n::translate('Review GEDCOM Changes').help_link('review_changes');
+ $content = "";
+ if (WT_USER_CAN_ACCEPT) {
+ $content .= "<a href=\"javascript:;\" onclick=\"window.open('edit_changes.php','_blank','width=600,height=500,resizable=1,scrollbars=1'); return false;\">".i18n::translate('Accept / Reject Changes')."</a><br />";
+ }
+ if ($sendmail=="yes") {
+ $content .= i18n::translate('Last email reminder was sent ').format_timestamp($LAST_CHANGE_EMAIL)."<br />";
+ $content .= i18n::translate('Next email reminder will be sent after ').format_timestamp($LAST_CHANGE_EMAIL+(60*60*24*$days))."<br /><br />";
+ }
+ $changes=WT_DB::prepare(
+ "SELECT xref".
+ " FROM {$TBLPREFIX}change".
+ " WHERE status='pending'".
+ " AND gedcom_id=?".
+ " GROUP BY xref"
+ )->execute(array(WT_GED_ID))->fetchAll();
+ foreach ($changes as $change) {
+ $record=GedcomRecord::getInstance($change->xref);
+ if ($record->getType()!='SOUR' || $SHOW_SOURCES>=WT_USER_ACCESS_LEVEL) {
+ $content.='<b>'.PrintReady($record->getFullName()).'</b> '.getLRM().'('.$record->getXref().')'.getLRM();
+ switch ($record->getType()) {
+ case 'INDI':
+ case 'FAM':
+ case 'SOUR':
+ case 'OBJE':
+ $content.=$block ? '<br />' : ' ';
+ $content.='<a href="'.encode_url($record->getLinkUrl().'&show_changes=yes').'">'.i18n::translate('View Change Diff').'</a>';
+ break;
+ }
+ $content.='<br />';
+ }
+ }
+
+ global $THEME_DIR;
+ if ($block) {
+ require $THEME_DIR.'templates/block_small_temp.php';
+ } else {
+ require $THEME_DIR.'templates/block_main_temp.php';
+ }
+ }
+ }
+ }
+
+ // Implement class WT_Module_Block
+ public function canLoadAjax() {
+ return false;
+ }
+
+ // Implement class WT_Module_Block
+ public function isUserBlock() {
+ return true;
+ }
+
+ // Implement class WT_Module_Block
+ public function isGedcomBlock() {
+ return true;
}
// Implement class WT_Module_Block
- public function configureBlock() {
- // Create an edit form, and respond to the result
+ public function configureBlock($block_id) {
+ global $WT_BLOCKS;
+ if (empty($config)) $config = $WT_BLOCKS["review_changes_block"]["config"];
+ print i18n::translate('Send out reminder emails?');
+ print "&nbsp;<select name='sendmail'>";
+ print "<option value='yes'";
+ if ($config["sendmail"]=="yes") print " selected='selected'";
+ print ">".i18n::translate('Yes')."</option>";
+ print "<option value='no'";
+ if ($config["sendmail"]=="no") print " selected='selected'";
+ print ">".i18n::translate('No')."</option>";
+ print "</select><br /><br />";
+ print i18n::translate('Reminder email frequency (days)')."&nbsp;<input type='text' name='days' value='".$config["days"]."' size='2' />";
+ // Cache file life
+ if ($ctype=="gedcom") {
+ echo "<tr><td class=\"descriptionbox wrap width33\">";
+ echo i18n::translate('Cache file life'), help_link('cache_life');
+ echo "</td><td class=\"optionbox\">";
+ echo "<input type=\"text\" name=\"cache\" size=\"2\" value=\"".$config["cache"]."\" />";
+ echo "</td></tr>";
+ }
+ // Cache file life is not configurable by user: anything other than "no cache" doesn't make sense
+ print "<input type=\"hidden\" name=\"cache\" value=\"0\" />";
}
}
diff --git a/modules/rss_block/module.php b/modules/rss_block/module.php
index 99ddaa4074..fc57604eb2 100644
--- a/modules/rss_block/module.php
+++ b/modules/rss_block/module.php
@@ -22,8 +22,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * @package webtrees
- * @subpackage Modules
* @version $Id: class_media.php 5451 2009-05-05 22:15:34Z fisharebest $
*/
@@ -47,12 +45,55 @@ class rss_block_WT_Module extends WT_Module implements WT_Module_Block {
}
// Implement class WT_Module_Block
- public function getBlock($block, $config, $side, $index) {
- // Generate the block contents
+ public function getBlock($block_id) {
+ global $THEME_DIR;
+ $id=$this->getName().$block_id;
+ $title=i18n::translate('RSS Feeds').help_link('rss_feed');
+ $content = "<br /><div class=\"center\">";
+ $content .= "<form method=\"post\" action=\"\" name=\"rssform\">";
+ $content .= "<select name=\"rssStyle\" class=\"header_select\" onchange=\"javascript:document.getElementById('rss_button').href = '".encode_url("rss.php?ged=".WT_GEDCOM."&lang=".WT_LOCALE) . "' + (document.rssform.module.value==''? '' : '&module=' + document.rssform.module.value) + (document.rssform.rssStyle.value==''? '' : '&rssStyle=' + document.rssform.rssStyle.value);\">";
+ $content .= "<option value=\"ATOM\" selected=\"selected\">ATOM 1.0</option>";
+ $content .= "<option value=\"RSS2.0\">RSS 2.0</option>";
+ $content .= "<option value=\"RSS1.0\">RSS 1.0</option>";
+ $content .= "<option value=\"ATOM0.3\">ATOM 0.3</option>";
+ $content .= "<option value=\"RSS0.91\">RSS 0.91</option>";
+ $content .= "<option value=\"HTML\">HTML</option>";
+ $content .= "<option value=\"JS\">JavaScript</option>";
+ $content .= "</select>";
+ $content .= "<select name=\"module\" class=\"header_select\" onchange=\"javascript:document.getElementById('rss_button').href = '".encode_url("rss.php?ged=".WT_GEDCOM."&lang=".WT_LOCALE) . "' + (document.rssform.module.value==''? '' : '&module=' + document.rssform.module.value) + (document.rssform.rssStyle.value==''? '' : '&rssStyle=' + document.rssform.rssStyle.value);\">";
+ $content .= "<option value=\"\">" . i18n::translate('All') . "</option>";
+ $content .= "<option value=\"today\">" . i18n::translate('On This Day ...') . " </option>";
+ $content .= "<option value=\"upcoming\">" . i18n::translate('Upcoming Events') . "</option>";
+ $content .= "<option value=\"gedcomStats\">" . i18n::translate('GEDCOM Statistics') . "</option>";
+ $content .= "<option value=\"gedcomNews\">" . i18n::translate('News') . "</option>";
+ $content .= "<option value=\"top10Surnames\">" . i18n::translate('Top 10 Surnames') . "</option>";
+ $content .= "<option value=\"recentChanges\">" . i18n::translate('Recent Changes') . "</option>";
+ $content .= "<option value=\"randomMedia\">" . i18n::translate('Random Picture') . "</option>";
+ $content .= "</select>";
+ $content .= " <a id=\"rss_button\" href=\"".encode_url("rss.php?ged=".WT_GEDCOM."&lang=".WT_LOCALE) . "\"><img class=\"icon\" src=\"images/feed-icon16x16.png\" alt=\"RSS\" title=\"RSS\" /></a>";
+ $content .= "</form></div>";
+ $content .= "<div class=\"center\">";
+ $content .= "</div><br />";
+
+ require $THEME_DIR.'templates/block_main_temp.php';
+ }
+
+ // Implement class WT_Module_Block
+ public function canLoadAjax() {
+ return false;
+ }
+
+ // Implement class WT_Module_Block
+ public function isUserBlock() {
+ return false;
+ }
+
+ // Implement class WT_Module_Block
+ public function isGedcomBlock() {
+ return true;
}
// Implement class WT_Module_Block
- public function configureBlock() {
- // Create an edit form, and respond to the result
+ public function configureBlock($block_id) {
}
}
diff --git a/modules/theme_select/module.php b/modules/theme_select/module.php
index c2a4d9eb99..6921b4affb 100644
--- a/modules/theme_select/module.php
+++ b/modules/theme_select/module.php
@@ -22,8 +22,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * @package webtrees
- * @subpackage Modules
* @version $Id: class_media.php 5451 2009-05-05 22:15:34Z fisharebest $
*/
@@ -46,12 +44,32 @@ class theme_select_WT_Module extends WT_Module implements WT_Module_Block {
}
// Implement class WT_Module_Block
- public function getBlock($block, $config, $side, $index) {
- // Generate the block contents
+ public function getBlock($block_id) {
+ global $ALLOW_THEME_DROPDOWN, $ALLOW_USER_THEMES, $THEME_DIR;
+
+ $id=$this->getName().$block_id;
+ $title=i18n::translate('Change Theme').help_link('change_theme');
+ $content='<br /><div class="center theme_form">'.MenuBar::getThemeMenu()->getMenuAsDropdown().'</div><br />';
+
+ require $THEME_DIR.'templates/block_main_temp.php';
+ }
+
+ // Implement class WT_Module_Block
+ public function canLoadAjax() {
+ return false;
+ }
+
+ // Implement class WT_Module_Block
+ public function isUserBlock() {
+ return true;
+ }
+
+ // Implement class WT_Module_Block
+ public function isGedcomBlock() {
+ return true;
}
// Implement class WT_Module_Block
- public function configureBlock() {
- // Create an edit form, and respond to the result
+ public function configureBlock($block_id) {
}
}
diff --git a/modules/todays_events/module.php b/modules/todays_events/module.php
index 2e6fa2e9df..5c1529e7c1 100644
--- a/modules/todays_events/module.php
+++ b/modules/todays_events/module.php
@@ -22,8 +22,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * @package webtrees
- * @subpackage Modules
* @version $Id: class_media.php 5451 2009-05-05 22:15:34Z fisharebest $
*/
@@ -46,12 +44,137 @@ class todays_events_WT_Module extends WT_Module implements WT_Module_Block {
}
// Implement class WT_Module_Block
- public function getBlock($block, $config, $side, $index) {
- // Generate the block contents
+ public function getBlock($block_id) {
+ global $SHOW_ID_NUMBERS, $ctype, $TEXT_DIRECTION, $WT_IMAGE_DIR, $WT_IMAGES, $DAYS_TO_SHOW_LIMIT, $THEME_DIR;
+
+ $filter =get_block_setting($block_id, 'days', 'all');
+ $onlyBDM =get_block_setting($block_id, 'days', 'no');
+ $infoStyle =get_block_setting($block_id, 'days', 'style2');
+ $sortStyle =get_block_setting($block_id, 'days', 'alpha');
+ $allowDownload=WT_USER_ID && get_block_setting($block_id, 'days', 1); // only allow if logged in
+
+ $todayjd=client_jd();
+
+ $id=$this->getName().$block_id;
+ $title='';
+ if ($ctype=="gedcom" && WT_USER_GEDCOM_ADMIN || $ctype=="user" && WT_USER_ID) {
+ if ($ctype=="gedcom") {
+ $name = WT_GEDCOM;
+ } else {
+ $name = WT_USER_NAME;
+ }
+ $title .= "<a href=\"javascript: configure block\" onclick=\"window.open('index_edit.php?block_id={$block_id}', '_blank', 'top=50,left=50,width=600,height=350,scrollbars=1,resizable=1'); return false;\">";
+ $title .= "<img class=\"adminicon\" src=\"$WT_IMAGE_DIR/".$WT_IMAGES["admin"]["small"]."\" width=\"15\" height=\"15\" border=\"0\" alt=\"".i18n::translate('Configure')."\" /></a>";
+ }
+ $title.=i18n::translate('On This Day ...').help_link('index_onthisday');
+
+ $content = "";
+ switch ($infoStyle) {
+ case "style1":
+ // Output style 1: Old format, no visible tables, much smaller text. Better suited to right side of page.
+ $content .= print_events_list($todayjd, $todayjd, $onlyBDM=='yes'?'BIRT MARR DEAT':'', $filter=='living', $sortStyle);
+ break;
+ case "style2":
+ // Style 2: New format, tables, big text, etc. Not too good on right side of page
+ ob_start();
+ $content .= print_events_table($todayjd, $todayjd, $onlyBDM=='yes'?'BIRT MARR DEAT':'', $filter=='living', $allowDownload=='yes', $sortStyle);
+ $content .= ob_get_clean();
+ break;
+ }
+
+ $block=get_block_setting($block_id, 'block', true);
+ if ($block) {
+ require $THEME_DIR.'templates/block_small_temp.php';
+ } else {
+ require $THEME_DIR.'templates/block_main_temp.php';
+ }
}
// Implement class WT_Module_Block
- public function configureBlock() {
- // Create an edit form, and respond to the result
+ public function canLoadAjax() {
+ return true;
+ }
+
+ // Implement class WT_Module_Block
+ public function isUserBlock() {
+ return true;
+ }
+
+ // Implement class WT_Module_Block
+ public function isGedcomBlock() {
+ return true;
+ }
+
+ // Implement class WT_Module_Block
+ public function configureBlock($block_id) {
+ global $WT_BLOCKS;
+ if (empty($config)) $config = $WT_BLOCKS["print_todays_events"]["config"];
+ if (!isset($config["filter"])) $config["filter"] = "all";
+ if (!isset($config["onlyBDM"])) $config["onlyBDM"] = "no";
+ if (!isset($config["infoStyle"])) $config["infoStyle"] = "style2";
+ if (!isset($config["sortStyle"])) $config["sortStyle"] = "alpha";
+ if (!isset($config["allowDownload"])) $config["allowDownload"] = "yes";
+
+ ?>
+ <tr><td class="descriptionbox wrap width33">
+ <?php
+ print i18n::translate('Show only events of living people?');
+ ?>
+ </td><td class="optionbox">
+ <select name="filter">
+ <option value="all"<?php if ($config["filter"]=="all") print " selected=\"selected\"";?>><?php print i18n::translate('No'); ?></option>
+ <option value="living"<?php if ($config["filter"]=="living") print " selected=\"selected\"";?>><?php print i18n::translate('Yes'); ?></option>
+ </select>
+ </td></tr>
+
+ <tr><td class="descriptionbox wrap width33">
+ <?php
+ print i18n::translate('Show only Births, Deaths, and Marriages?');
+ print help_link('basic_or_all');
+ ?>
+ </td><td class="optionbox">
+ <select name="onlyBDM">
+ <option value="no"<?php if ($config["onlyBDM"]=="no") print " selected=\"selected\"";?>><?php print i18n::translate('No'); ?></option>
+ <option value="yes"<?php if ($config["onlyBDM"]=="yes") print " selected=\"selected\"";?>><?php print i18n::translate('Yes'); ?></option>
+ </select>
+ </td></tr>
+
+ <tr><td class="descriptionbox wrap width33">
+ <?php
+ print i18n::translate('Presentation Style');
+ print help_link('style');
+ ?>
+ </td><td class="optionbox">
+ <select name="infoStyle">
+ <option value="style1"<?php if ($config["infoStyle"]=="style1") print " selected=\"selected\"";?>><?php print i18n::translate('List'); ?></option>
+ <option value="style2"<?php if ($config["infoStyle"]=="style2") print " selected=\"selected\"";?>><?php print i18n::translate('Table'); ?></option>
+ </select>
+ </td></tr>
+
+ <tr><td class="descriptionbox wrap width33">
+ <?php
+ print i18n::translate('Sort Style');
+ print help_link('sort_style');
+ ?>
+ </td><td class="optionbox">
+ <select name="sortStyle">
+ <option value="alpha"<?php if ($config["sortStyle"]=="alpha") print " selected=\"selected\"";?>><?php print i18n::translate('Alphabetically'); ?></option>
+ <option value="anniv"<?php if ($config["sortStyle"]=="anniv") print " selected=\"selected\"";?>><?php print i18n::translate('By Anniversary'); ?></option>
+ </select>
+ </td></tr>
+
+ <tr><td class="descriptionbox wrap width33">
+ <?php
+ print i18n::translate('Allow calendar events download?');
+ print help_link('cal_dowload');
+ ?>
+ </td><td class="optionbox">
+ <select name="allowDownload">
+ <option value="yes"<?php if ($config["allowDownload"]=="yes") print " selected=\"selected\"";?>><?php print i18n::translate('Yes'); ?></option>
+ <option value="no"<?php if ($config["allowDownload"]=="no") print " selected=\"selected\"";?>><?php print i18n::translate('No'); ?></option>
+ </select>
+ <input type="hidden" name="cache" value="1" />
+ </td></tr>
+ <?php
}
}
diff --git a/modules/todo/module.php b/modules/todo/module.php
index eabcc02c41..629b7123fc 100644
--- a/modules/todo/module.php
+++ b/modules/todo/module.php
@@ -22,8 +22,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * @package webtrees
- * @subpackage Modules
* @version $Id: class_media.php 5451 2009-05-05 22:15:34Z fisharebest $
*/
@@ -46,12 +44,124 @@ class todo_WT_Module extends WT_Module implements WT_Module_Block {
}
// Implement class WT_Module_Block
- public function getBlock($block, $config, $side, $index) {
- // Generate the block contents
+ public function getBlock($block_id) {
+ global $ctype, $WT_IMAGE_DIR, $WT_IMAGES, $THEME_DIR;
+
+ $show_unassigned=get_block_setting($block_id, 'show_unassigned', true);
+ $show_other =get_block_setting($block_id, 'show_other', true);
+ $show_future =get_block_setting($block_id, 'show_future', true);
+
+ $id=$this->getName().$block_id;
+ $title='';
+ if ($ctype=='gedcom' && WT_USER_GEDCOM_ADMIN || $ctype=='user' && WT_USER_ID) {
+ if ($ctype=='gedcom') {
+ $name = WT_GEDCOM;
+ } else {
+ $name = WT_USER_NAME;
+ }
+ $title .= "<a href=\"javascript: configure block\" onclick=\"window.open('".encode_url("index_edit.php?action=configure&block_id={$block_id}")."', '_blank', 'top=50,left=50,width=600,height=350,scrollbars=1,resizable=1'); return false;\">";
+ $title .= "<img class=\"adminicon\" src=\"{$WT_IMAGE_DIR}/{$WT_IMAGES['admin']['small']}\" width=\"15\" height=\"15\" border=\"0\" alt=\"".i18n::translate('Configure')."\" /></a>";
+ }
+ $title.=i18n::translate('&quot;To Do&quot; tasks').help_link('todo');
+ $content='';
+
+ require_once WT_ROOT.'js/sorttable.js.htm';
+ require_once WT_ROOT.'includes/classes/class_gedcomrecord.php';
+
+ $table_id = 'ID'.floor(microtime()*1000000); // sorttable requires a unique ID
+ $content .= '<table id="'.$table_id.'" class="sortable list_table center">';
+ $content .= '<tr>';
+ $content .= '<th class="list_label">'.i18n::translate('DATE').'</th>';
+ $content .= '<th class="list_label">'.i18n::translate('Record').'</th>';
+ if ($show_unassigned || $show_other) {
+ $content .= '<th class="list_label">'.i18n::translate('User name').'</th>';
+ }
+ $content .= '<th class="list_label">'.i18n::translate('TEXT').'</th>';
+ $content .= '</tr>';
+
+ $found=false;
+ $end_jd=$show_future ? 99999999 : client_jd();
+ foreach (get_calendar_events(0, $end_jd, '_TODO', WT_GED_ID) as $todo) {
+ $record=GedcomRecord::getInstance($todo['id']);
+ if ($record && $record->canDisplayDetails()) {
+ $pgvu=get_gedcom_value('_WT_USER', 2, $todo['factrec']);
+ if ($pgvu==WT_USER_NAME || !$pgvu && $show_unassigned || $pgvu && $show_other) {
+ $content.='<tr valign="top">';
+ $content.='<td class="list_value_wrap">'.str_replace('<a', '<a name="'.$todo['date']->MinJD().'"', $todo['date']->Display(false)).'</td>';
+ $name=$record->getListName();
+ $content.='<td class="list_value_wrap" align="'.get_align(WT_GEDCOM).'"><a href="'.encode_url($record->getLinkUrl()).'">'.PrintReady($name).'</a></td>';
+ if ($show_unassigned || $show_other) {
+ $content.='<td class="list_value_wrap">'.$pgvu.'</td>';
+ }
+ $text=get_gedcom_value('_TODO', 1, $todo['factrec']);
+ $content.='<td class="list_value_wrap" align="'.get_align($text).'">'.PrintReady($text).'</td>';
+ $content.='</tr>';
+ $found=true;
+ }
+ }
+ }
+
+ $content .= '</table>';
+ if (!$found) {
+ $content.='<p>'.i18n::translate('There are no &quot;To Do&quot; tasks.').'</p>';
+ }
+
+ $block=get_block_setting($block_id, 'block', true);
+ if ($block) {
+ require $THEME_DIR.'templates/block_small_temp.php';
+ } else {
+ require $THEME_DIR.'templates/block_main_temp.php';
+ }
}
// Implement class WT_Module_Block
- public function configureBlock() {
- // Create an edit form, and respond to the result
+ public function canLoadAjax() {
+ return true;
+ }
+
+ // Implement class WT_Module_Block
+ public function isUserBlock() {
+ return true;
+ }
+
+ // Implement class WT_Module_Block
+ public function isGedcomBlock() {
+ return true;
+ }
+
+ // Implement class WT_Module_Block
+ public function configureBlock($block_id) {
+ global $DAYS_TO_SHOW_LIMIT;
+
+ if (safe_POST_bool('save')) {
+ set_block_setting($block_id, 'show_other', safe_POST_bool('show_other'));
+ set_block_setting($block_id, 'show_unassigned', safe_POST_bool('show_unassigned'));
+ set_block_setting($block_id, 'show_future', safe_POST_bool('show_future'));
+ echo WT_JS_START, 'window.opener.location.href=window.opener.location.href;window.close();', WT_JS_END;
+ exit;
+ }
+
+ require_once WT_ROOT.'includes/functions/functions_edit.php';
+
+ $show_other=get_block_setting($block_id, 'show_other', true);
+ echo '<tr><td class="descriptionbox wrap width33">';
+ echo i18n::translate('Show other users\' tasks'), help_link('todo_show_other');
+ echo '</td><td class="optionbox">';
+ echo edit_field_yes_no('show_other', $show_other);
+ echo '</td></tr>';
+
+ $show_unassigned=get_block_setting($block_id, 'show_unassigned', true);
+ echo '<tr><td class="descriptionbox wrap width33">';
+ echo i18n::translate('Show unassigned tasks'), help_link('todo_show_unassigned');
+ echo '</td><td class="optionbox">';
+ echo edit_field_yes_no('show_other', $show_unassigned);
+ echo '</td></tr>';
+
+ $show_future=get_block_setting($block_id, 'show_future', true);
+ echo '<tr><td class="descriptionbox wrap width33">';
+ echo i18n::translate('Show future tasks'), help_link('todo_show_future');
+ echo '</td><td class="optionbox">';
+ echo edit_field_yes_no('show_other', $show_future);
+ echo '</td></tr>';
}
}
diff --git a/modules/top10_givnnames/module.php b/modules/top10_givnnames/module.php
index 4f38fb1ace..acfaaf9770 100644
--- a/modules/top10_givnnames/module.php
+++ b/modules/top10_givnnames/module.php
@@ -22,8 +22,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * @package webtrees
- * @subpackage Modules
* @version $Id: class_media.php 5451 2009-05-05 22:15:34Z fisharebest $
*/
@@ -46,12 +44,117 @@ class top10_givnnames_WT_Module extends WT_Module implements WT_Module_Block {
}
// Implement class WT_Module_Block
- public function getBlock($block, $config, $side, $index) {
- // Generate the block contents
+ public function getBlock($block_id) {
+ global $TEXT_DIRECTION, $WT_BLOCKS, $ctype, $WT_IMAGES, $WT_IMAGE_DIR;
+
+ $num=get_block_setting($block_id, 'num', 10);
+ $infoStyle=get_block_setting($block_id, 'infoStyle', 'table');
+ $showUnknown=get_block_setting($block_id, 'showUnknown', true);
+ $block=get_block_setting($block_id, 'block', false);
+
+ require_once WT_ROOT.'includes/classes/class_stats.php';
+ $stats=new Stats(WT_GEDCOM);
+
+ $id=$this->getName().$block_id;
+ $title='';
+ if ($ctype=="gedcom" && WT_USER_GEDCOM_ADMIN || $ctype=="user" && WT_USER_ID) {
+ $title .= "<a href=\"javascript: configure block\" onclick=\"window.open('index_edit.php?action=configure&amp;ctype={$ctype}&amp;block_id={$block_id}', '_blank', 'top=50,left=50,width=600,height=350,scrollbars=1,resizable=1'); return false;\">";
+ $title .= "<img class=\"adminicon\" src=\"$WT_IMAGE_DIR/".$WT_IMAGES["admin"]["small"]."\" width=\"15\" height=\"15\" border=\"0\" alt=\"".i18n::translate('Configure')."\" /></a>";
+ }
+ // I18N: There are separate lists of male/female names, containing %d names each
+ $title .= i18n::plural('Top Given Name', 'Top %d Given Names', $num, $num);
+ $title .= help_link('index_common_given_names');
+
+ $content = '<div class="normal_inner_block">';
+ //Select List or Table
+ switch ($infoStyle) {
+ case "list": // Output style 1: Simple list style. Better suited to left side of page.
+ if ($TEXT_DIRECTION=='ltr') $padding = 'padding-left: 15px';
+ else $padding = 'padding-right: 15px';
+ $params=array(1,$num,'rcount');
+ //List Female names
+ $totals=$stats->commonGivenFemaleTotals($params);
+ if ($totals) {
+ $content.='<b>'.i18n::translate('Female').'</b><div class="wrap" style="'.$padding.'">'.$totals.'</div><br />';
+ }
+ //List Male names
+ $totals=$stats->commonGivenMaleTotals($params);
+ if ($totals) {
+ $content.='<b>'.i18n::translate('Male').'</b><div class="wrap" style="'.$padding.'">'.$totals.'</div><br />';
+ }
+ //List Unknown names
+ $totals=$stats->commonGivenUnknownTotals($params);
+ if ($totals && $showUnknown) {
+ $content.='<b>'.i18n::translate('unknown').'</b><div class="wrap" style="'.$padding.'">'.$totals.'</div><br />';
+ }
+ break;
+ case "table": // Style 2: Tabular format. Narrow, 2 or 3 column table, good on right side of page
+ $params=array(1,$num,'rcount');
+ $content.='<table class="center"><tr valign="top"><td>'.$stats->commonGivenFemaleTable($params).'</td>';
+ $content.='<td>'.$stats->commonGivenMaleTable($params).'</td>';
+ if ($showUnknown) {
+ $content.='<td>'.$stats->commonGivenUnknownTable($params).'</td>';
+ }
+ $content.='</tr></table>';
+ break;
+ }
+ $content .= "</div>";
+
+ global $THEME_DIR;
+ $block=false;
+ if ($block) {
+ require $THEME_DIR.'templates/block_small_temp.php';
+ } else {
+ require $THEME_DIR.'templates/block_main_temp.php';
+ }
+ }
+
+ // Implement class WT_Module_Block
+ public function canLoadAjax() {
+ return true;
+ }
+
+ // Implement class WT_Module_Block
+ public function isUserBlock() {
+ return true;
+ }
+
+ // Implement class WT_Module_Block
+ public function isGedcomBlock() {
+ return true;
}
// Implement class WT_Module_Block
- public function configureBlock() {
- // Create an edit form, and respond to the result
+ public function configureBlock($block_id) {
+ if (safe_POST_bool('save')) {
+ set_block_setting($block_id, 'num', safe_POST_integer('num', 1, 10000));
+ set_block_setting($block_id, 'infoStyle', safe_POST('infoStyle', array('list', 'table'), 'table'));
+ set_block_setting($block_id, 'showUnknown', safe_POST_bool('showUnknown'));
+ echo WT_JS_START, 'window.opener.location.href=window.opener.location.href;window.close();', WT_JS_END;
+ exit;
+ }
+
+ require_once WT_ROOT.'includes/functions/functions_edit.php';
+
+ $num=get_block_setting($block_id, 'num', 10);
+ echo '<tr><td class="descriptionbox wrap width33">';
+ echo i18n::translate('Number of items to show');
+ echo '</td><td class="optionbox">';
+ echo '<input type="text" name="num" size="2" value="', $num, '" />';
+ echo '</td></tr>';
+
+ $infoStyle=get_block_setting($block_id, 'infoStyle', 'table');
+ echo '<tr><td class="descriptionbox wrap width33">';
+ echo i18n::translate('Presentation Style'), help_link('style');
+ echo '</td><td class="optionbox">';
+ echo select_edit_control('infoStyle', array('list'=>i18n::translate('List'), 'table'=>i18n::translate('Table')), null, $infoStyle, '');
+ echo '</td></tr>';
+
+ $showUnknown=get_block_setting($block_id, 'showUnknown', true);
+ echo '<tr><td class="descriptionbox wrap width33">';
+ echo i18n::translate('Show unknown gender'), help_link('showUnknown');
+ echo '</td><td class="optionbox">';
+ echo edit_field_yes_no('showUnknown', $showUnknown);
+ echo '</td></tr>';
}
}
diff --git a/modules/top10_pageviews/module.php b/modules/top10_pageviews/module.php
index f22bf749e8..04fe68ab02 100644
--- a/modules/top10_pageviews/module.php
+++ b/modules/top10_pageviews/module.php
@@ -22,8 +22,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * @package webtrees
- * @subpackage Modules
* @version $Id: class_media.php 5451 2009-05-05 22:15:34Z fisharebest $
*/
@@ -46,12 +44,110 @@ class top10_pageviews_WT_Module extends WT_Module implements WT_Module_Block {
}
// Implement class WT_Module_Block
- public function getBlock($block, $config, $side, $index) {
- // Generate the block contents
+ public function getBlock($block_id) {
+ global $ctype, $TBLPREFIX, $INDEX_DIRECTORY, $WT_IMAGES, $WT_IMAGE_DIR, $SHOW_COUNTER, $SHOW_SOURCES, $TEXT_DIRECTION;
+
+ $count_placement=get_block_setting($block_id, 'count_placement', 'before');
+ $num=get_block_setting($block_id, 'num', 10);
+ $block=get_block_setting($block_id, 'block', false);
+
+ $id=$this->getName().$block_id;
+ $title='';
+ if ($ctype=="gedcom" && WT_USER_GEDCOM_ADMIN || $ctype=="user" && WT_USER_ID) {
+ $title .= "<a href=\"javascript: configure block\" onclick=\"window.open('index_edit.php?action=configure&amp;ctype={$ctype}&amp;block_id={$block_id}', '_blank', 'top=50,left=50,width=600,height=350,scrollbars=1,resizable=1'); return false;\">";
+ $title .= "<img class=\"adminicon\" src=\"$WT_IMAGE_DIR/".$WT_IMAGES["admin"]["small"]."\" width=\"15\" height=\"15\" border=\"0\" alt=\"".i18n::translate('Configure')."\" /></a>";
+ }
+ $title .= i18n::translate('Most Viewed Items');
+ $title .= help_link('index_top10_pageviews');
+ $content = "";
+
+ // if the counter file does not exist then don't do anything
+ if (!$SHOW_COUNTER) {
+ if (WT_USER_IS_ADMIN) {
+ $content .= "<span class=\"error\">".i18n::translate('Hit counters must be enabled in the GEDCOM configuration, Display and Layout section, Hide and Show group.')."</span>";
+ }
+ } else {
+ // load the lines from the file
+ $top10=WT_DB::prepareLimit(
+ "SELECT page_parameter, page_count".
+ " FROM {$TBLPREFIX}hit_counter".
+ " WHERE gedcom_id=? AND page_name IN ('individual.php','family.php','source.php','repo.php','note.php','mediaviewer.php')".
+ " ORDER BY page_count DESC",
+ $num
+ )->execute(array(WT_GED_ID))->FetchAssoc();
+
+
+ if ($top10) {
+ if ($block) {
+ $content .= "<table width=\"90%\">";
+ } else {
+ $content .= "<table>";
+ }
+ foreach ($top10 as $id=>$count) {
+ $record=GedcomRecord::getInstance($id);
+ if ($record && $record->canDisplayDetails()) {
+ $content .= '<tr valign="top">';
+ if ($count_placement=='before') {
+ $content .= '<td dir="ltr" align="right">['.$count.']</td>';
+ }
+ $content .= '<td class="name2" ><a href="'.encode_url($record->getLinkUrl()).'">'.PrintReady($record->getFullName()).'</a></td>';
+ if ($count_placement=='after') {
+ $content .= '<td dir="ltr" align="right">['.$count.']</td>';
+ }
+ $content .= '</tr>';
+ }
+ }
+ $content .= "</table>";
+ } else {
+ $content .= "<b>".i18n::translate('There are currently no hits to show.')."</b>";
+ }
+ }
+
+ global $THEME_DIR;
+ if ($block) {
+ require $THEME_DIR.'templates/block_small_temp.php';
+ } else {
+ require $THEME_DIR.'templates/block_main_temp.php';
+ }
+ }
+
+ // Implement class WT_Module_Block
+ public function canLoadAjax() {
+ return true;
}
// Implement class WT_Module_Block
- public function configureBlock() {
- // Create an edit form, and respond to the result
+ public function isUserBlock() {
+ return false;
+ }
+
+ // Implement class WT_Module_Block
+ public function isGedcomBlock() {
+ return true;
+ }
+
+ // Implement class WT_Module_Block
+ public function configureBlock($block_id) {
+ if (safe_POST_bool('save')) {
+ set_block_setting($block_id, 'num', safe_POST_integer('num', 1, 10000));
+ set_block_setting($block_id, 'count_placement', safe_POST('count_placement', array('before', 'after'), 'before'));
+ echo WT_JS_START, 'window.opener.location.href=window.opener.location.href;window.close();', WT_JS_END;
+ exit;
+ }
+ require_once WT_ROOT.'includes/functions/functions_edit.php';
+
+ $num=get_block_setting($block_id, 'num', 10);
+ echo '<tr><td class="descriptionbox wrap width33">';
+ echo i18n::translate('Number of items to show');
+ echo '</td><td class="optionbox">';
+ echo '<input type="text" name="num" size="2" value="', $num, '" />';
+ echo '</td></tr>';
+
+ $count_placement=get_block_setting($block_id, 'count_placement', 'left');
+ print "<tr><td class=\"descriptionbox wrap width33\">";
+ print i18n::translate('Place counts before or after name?');
+ print "</td><td class=\"optionbox\">";
+ echo select_edit_control('count_placement', array('before'=>i18n::translate('before'), 'after'=>i18n::translate('after')), null, $count_placement, '');
+ echo '</td></tr>';
}
}
diff --git a/modules/top10_surnames/module.php b/modules/top10_surnames/module.php
index 21f5a6b641..92447a5137 100644
--- a/modules/top10_surnames/module.php
+++ b/modules/top10_surnames/module.php
@@ -22,8 +22,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * @package webtrees
- * @subpackage Modules
* @version $Id: class_media.php 5451 2009-05-05 22:15:34Z fisharebest $
*/
@@ -46,12 +44,128 @@ class top10_surnames_WT_Module extends WT_Module implements WT_Module_Block {
}
// Implement class WT_Module_Block
- public function getBlock($block, $config, $side, $index) {
- // Generate the block contents
+ public function getBlock($block_id) {
+ global $COMMON_NAMES_ADD, $COMMON_NAMES_REMOVE, $COMMON_NAMES_THRESHOLD, $WT_BLOCKS, $ctype, $WT_IMAGES, $WT_IMAGE_DIR, $SURNAME_LIST_STYLE;
+
+ $num=get_block_setting($block_id, 'num', 10);
+ $block=get_block_setting($block_id, 'block', false);
+
+ // This next function is a bit out of date, and doesn't cope well with surname variants
+ $top_surnames=get_top_surnames(WT_GED_ID, 1, $num);
+
+ $all_surnames=array();
+ foreach (array_keys($top_surnames) as $top_surname) {
+ $all_surnames=array_merge($all_surnames, get_indilist_surns($top_surname, '', false, false, WT_GED_ID));
+ }
+
+ // Insert from the "Add Names" list if not already in there
+ if ($COMMON_NAMES_ADD) {
+ foreach (preg_split('/[,; ]+/', $COMMON_NAMES_ADD) as $addname) {
+ $ADDNAME=utf8_strtoupper($addname);
+ if (isset($all_surnames[$ADDNAME])) {
+ $SURNAME=$ADDNAME;
+ foreach (array_keys($all_surnames[$ADDNAME]) as $surname) {
+ if ($SURNAME!=$surname && $SURNAME==utf8_strtoupper($surname)) {
+ $all_surnames[$ADDNAME][$SURNAME]=$all_surnames[$ADDNAME][$surname];
+ unset ($all_surnames[$ADDNAME][$surname]);
+ }
+ }
+ if (isset($all_surnames[$ADDNAME][$SURNAME])) {
+ $n=count($all_surnames[$ADDNAME][$SURNAME]);
+ $all_surnames[$ADDNAME][$SURNAME]=array_fill(0, max($n, $COMMON_NAMES_THRESHOLD), true);
+ } else {
+ $all_surnames[$ADDNAME][$SURNAME]=array_fill(0, $COMMON_NAMES_THRESHOLD, true);
+ }
+ } else {
+ $all_surnames[$ADDNAME][$ADDNAME]=array_fill(0, $COMMON_NAMES_THRESHOLD, true);
+ }
+ }
+ }
+
+ // Remove names found in the "Remove Names" list
+ if ($COMMON_NAMES_REMOVE) {
+ foreach (preg_split("/[,; ]+/", $COMMON_NAMES_REMOVE) as $delname) {
+ unset($all_surnames[utf8_strtoupper($delname)]);
+ }
+ }
+
+ $id=$this->getName().$block_id;
+ $title='';
+ if ($ctype=="gedcom" && WT_USER_GEDCOM_ADMIN || $ctype=="user" && WT_USER_ID) {
+ if ($ctype=="gedcom") {
+ $name = WT_GEDCOM;
+ } else {
+ $name = WT_USER_NAME;
+ }
+ $title .= "<a href=\"javascript: configure block\" onclick=\"window.open('".encode_url("index_edit.php?action=configure&amp;ctype={$ctype}&amp;block_id={$block_id}")."', '_blank', 'top=50,left=50,width=600,height=350,scrollbars=1,resizable=1'); return false;\">";
+ $title .= "<img class=\"adminicon\" src=\"$WT_IMAGE_DIR/".$WT_IMAGES["admin"]["small"]."\" width=\"15\" height=\"15\" border=\"0\" alt=\"".i18n::translate('Configure')."\" /></a>";
+ }
+ // I18N: There are separate lists of male/female names, containing %d names each
+ $title .= i18n::plural('Top surname', 'Top %d surnames', $num, $num);
+ $title .= help_link('index_common_names');
+
+ switch ($SURNAME_LIST_STYLE) {
+ case 'style3':
+ uksort($all_surnames,'utf8_strcasecmp');
+ $content=format_surname_tagcloud($all_surnames, 'indilist', true);
+ break;
+ case 'style2':
+ default:
+ uasort($all_surnames, array('top10_surnames_WT_Module', 'top_surname_sort'));
+ $content=format_surname_table($all_surnames, 'indilist');
+ break;
+ }
+
+ global $THEME_DIR;
+ if ($block) {
+ require $THEME_DIR.'templates/block_small_temp.php';
+ } else {
+ require $THEME_DIR.'templates/block_main_temp.php';
+ }
+ }
+
+ // Implement class WT_Module_Block
+ public function canLoadAjax() {
+ return true;
}
// Implement class WT_Module_Block
- public function configureBlock() {
- // Create an edit form, and respond to the result
+ public function isUserBlock() {
+ return true;
+ }
+
+ // Implement class WT_Module_Block
+ public function isGedcomBlock() {
+ return true;
+ }
+
+ // Implement class WT_Module_Block
+ public function configureBlock($block_id) {
+ if (safe_POST_bool('save')) {
+ set_block_setting($block_id, 'num', safe_POST_integer('num', 1, 10000));
+ echo WT_JS_START, 'window.opener.location.href=window.opener.location.href;window.close();', WT_JS_END;
+ exit;
+ }
+
+ require_once WT_ROOT.'includes/functions/functions_edit.php';
+
+ $num=get_block_setting($block_id, 'num', 10);
+ echo '<tr><td class="descriptionbox wrap width33">';
+ echo i18n::translate('Number of items to show');
+ echo '</td><td class="optionbox">';
+ echo '<input type="text" name="num" size="2" value="', $num, '" />';
+ echo '</td></tr>';
+ }
+
+ public static function top_surname_sort($a, $b) {
+ $counta=0;
+ foreach ($a as $x) {
+ $counta+=count($x);
+ }
+ $countb=0;
+ foreach ($b as $x) {
+ $countb+=count($x);
+ }
+ return $countb - $counta;
}
}
diff --git a/modules/upcoming_events/module.php b/modules/upcoming_events/module.php
index 0b9c6ddeb6..cee26afaed 100644
--- a/modules/upcoming_events/module.php
+++ b/modules/upcoming_events/module.php
@@ -22,8 +22,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * @package webtrees
- * @subpackage Modules
* @version $Id: class_media.php 5451 2009-05-05 22:15:34Z fisharebest $
*/
@@ -33,6 +31,7 @@ if (!defined('WT_WEBTREES')) {
}
require_once WT_ROOT.'includes/classes/class_module.php';
+require_once WT_ROOT.'includes/functions/functions_print_lists.php';
class upcoming_events_WT_Module extends WT_Module implements WT_Module_Block {
// Extend class WT_Module
@@ -46,12 +45,122 @@ class upcoming_events_WT_Module extends WT_Module implements WT_Module_Block {
}
// Implement class WT_Module_Block
- public function getBlock($block, $config, $side, $index) {
- // Generate the block contents
+ public function getBlock($block_id) {
+ global $SHOW_ID_NUMBERS, $ctype, $TEXT_DIRECTION, $WT_IMAGE_DIR, $WT_IMAGES, $WT_BLOCKS, $DAYS_TO_SHOW_LIMIT, $THEME_DIR;
+
+ $days=get_block_setting($block_id, 'days', $DAYS_TO_SHOW_LIMIT);
+ $filter=get_block_setting($block_id, 'filter', true);
+ $onlyBDM=get_block_setting($block_id, 'onlyBDM', false);
+ $infoStyle=get_block_setting($block_id, 'infoStyle', 'table');
+ $sortStyle=get_block_setting($block_id, 'sortStyle', 'alpha');
+ $allowDownload=WT_USER_ID && get_block_setting($block_id, 'allowDownload', true);
+
+ $startjd=client_jd()+1;
+ $endjd=client_jd()+$days;
+
+ // Output starts here
+ $id=$this->getName().$block_id;
+ $title='';
+ if ($ctype=="gedcom" && WT_USER_GEDCOM_ADMIN || $ctype=="user" && WT_USER_ID) {
+ $title.="<a href=\"javascript: configure block\" onclick=\"window.open('index_edit.php?action=configure&amp;ctype={$ctype}&amp;block_id={$block_id}', '_blank', 'top=50,left=50,width=600,height=350,scrollbars=1,resizable=1'); return false;\">";
+ $title.="<img class=\"adminicon\" src=\"$WT_IMAGE_DIR/".$WT_IMAGES["admin"]["small"]."\" width=\"15\" height=\"15\" border=\"0\" alt=\"".i18n::translate('Configure')."\" /></a>";
+ }
+ $title.=i18n::translate('Upcoming Events').help_link('index_events');
+
+ $content = "";
+ switch ($infoStyle) {
+ case "list":
+ // Output style 1: Old format, no visible tables, much smaller text. Better suited to right side of page.
+ $content.=print_events_list($startjd, $endjd, $onlyBDM?'BIRT MARR DEAT':'', $filter, 'style1');
+ break;
+ case "table":
+ // Style 2: New format, tables, big text, etc. Not too good on right side of page
+ ob_start();
+ $content.=print_events_table($startjd, $endjd, $onlyBDM?'BIRT MARR DEAT':'', $filter, $allowDownload, 'style2');
+ $content.=ob_get_clean();
+ break;
+ }
+
+ $block=get_block_setting($block_id, 'block', true);
+ if ($block) {
+ require $THEME_DIR.'templates/block_small_temp.php';
+ } else {
+ require $THEME_DIR.'templates/block_main_temp.php';
+ }
+ }
+
+ // Implement class WT_Module_Block
+ public function canLoadAjax() {
+ return true;
+ }
+
+ // Implement class WT_Module_Block
+ public function isUserBlock() {
+ return true;
}
// Implement class WT_Module_Block
- public function configureBlock() {
- // Create an edit form, and respond to the result
+ public function isGedcomBlock() {
+ return true;
+ }
+
+ // Implement class WT_Module_Block
+ public function configureBlock($block_id) {
+ global $DAYS_TO_SHOW_LIMIT;
+
+ if (safe_POST_bool('save')) {
+ set_block_setting($block_id, 'days', safe_POST_integer('days', 1, $DAYS_TO_SHOW_LIMIT, $DAYS_TO_SHOW_LIMIT));
+ set_block_setting($block_id, 'filter', safe_POST_bool('filter'));
+ set_block_setting($block_id, 'onlyBDM', safe_POST_bool('onlyBDM'));
+ set_block_setting($block_id, 'infoStyle', safe_POST('infoStyle', array('list', 'table'), 'table'));
+ set_block_setting($block_id, 'sortStyle', safe_POST('sortStyle', array('alpha', 'anniv'), 'alpha'));
+ set_block_setting($block_id, 'allowDownload', safe_POST_bool('allowDownload'));
+ echo WT_JS_START, 'window.opener.location.href=window.opener.location.href;window.close();', WT_JS_END;
+ exit;
+ }
+
+ require_once WT_ROOT.'includes/functions/functions_edit.php';
+
+ $days=get_block_setting($block_id, 'days', $DAYS_TO_SHOW_LIMIT);
+ echo '<tr><td class="descriptionbox wrap width33">';
+ echo i18n::translate('Number of days to show'), help_link('days_to_show');
+ echo '</td><td class="optionbox">';
+ echo '<input type="text" name="days" size="2" value="', $days, '" />';
+ echo '</td></tr>';
+
+ $filter=get_block_setting($block_id, 'filter', true);
+ echo '<tr><td class="descriptionbox wrap width33">';
+ echo i18n::translate('Show only events of living people?');
+ echo '</td><td class="optionbox">';
+ echo edit_field_yes_no('filter', $filter);
+ echo '</td></tr>';
+
+ $onlyBDM=get_block_setting($block_id, 'onlyBDM', false);
+ echo '<tr><td class="descriptionbox wrap width33">';
+ echo i18n::translate('Show only Births, Deaths, and Marriages?'), help_link('basic_or_all');
+ echo '</td><td class="optionbox">';
+ echo edit_field_yes_no('onlyBDM', $onlyBDM);
+ echo '</td></tr>';
+
+ $infoStyle=get_block_setting($block_id, 'infoStyle', 'table');
+ echo '<tr><td class="descriptionbox wrap width33">';
+ echo i18n::translate('Presentation Style'), help_link('style');
+ echo '</td><td class="optionbox">';
+ echo select_edit_control('infoStyle', array('list'=>i18n::translate('List'), 'table'=>i18n::translate('Table')), null, $infoStyle, '');
+ echo '</td></tr>';
+
+ $sortStyle=get_block_setting($block_id, 'sortStyle', 'alpha');
+ echo '<tr><td class="descriptionbox wrap width33">';
+ echo i18n::translate('Sort Style'), help_link('sort_style');
+ echo '</td><td class="optionbox">';
+ echo select_edit_control('sortStyle', array('alpha'=>i18n::translate('Alphabetically'), 'anniv'=>i18n::translate('By Anniversary')), null, $sortStyle, '');
+ echo '</td></tr>';
+
+ $allowDownload=get_block_setting($block_id, 'allowDownload', true);
+ echo '<tr><td class="descriptionbox wrap width33">';
+ echo i18n::translate('Allow calendar events download?'), help_link('cal_dowload');
+ echo '</td><td class="optionbox">';
+ echo edit_field_yes_no('allowDownload', $allowDownload);
+ echo '</td></tr>';
}
}
diff --git a/modules/user_blog/module.php b/modules/user_blog/module.php
index e9e80aedee..6ed03f5ba7 100644
--- a/modules/user_blog/module.php
+++ b/modules/user_blog/module.php
@@ -22,8 +22,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * @package webtrees
- * @subpackage Modules
* @version $Id: class_media.php 5451 2009-05-05 22:15:34Z fisharebest $
*/
@@ -46,12 +44,67 @@ class user_blog_WT_Module extends WT_Module implements WT_Module_Block {
}
// Implement class WT_Module_Block
- public function getBlock($block, $config, $side, $index) {
- // Generate the block contents
+ public function getBlock($block_id) {
+ global $ctype, $WT_IMAGE_DIR, $WT_IMAGES, $TEXT_DIRECTION, $THEME_DIR;
+
+ switch (safe_GET('action')) {
+ case 'deletenews':
+ $news_id=safe_GET('news_id');
+ if ($news_id) {
+ deleteNews($news_id);
+ }
+ break;
+ }
+
+ $usernews = getUserNews(WT_USER_ID);
+
+ $id=$this->getName().$block_id;
+ $title=i18n::translate('My Journal').help_link('mygedview_myjournal');
+ $content = "";
+ if (count($usernews)==0) {
+ $content .= i18n::translate('You have not created any Journal items.').' ';
+ }
+ foreach($usernews as $key=>$news) {
+ $day = date("j", $news["date"]);
+ $mon = date("M", $news["date"]);
+ $year = date("Y", $news["date"]);
+ $content .= "<div class=\"person_box\">";
+ $content .= "<span class=\"news_title\">".embed_globals($news["title"])."</span><br />";
+ $content .= "<span class=\"news_date\">".format_timestamp($news["date"])."</span><br /><br />";
+ $news["text"] = nl2br($news["text"], embed_globals($news["text"]));
+ $content .= PrintReady($news["text"])."<br /><br />";
+ $content .= "<a href=\"javascript:;\" onclick=\"editnews('$key'); return false;\">".i18n::translate('Edit')."</a> | ";
+ $content .= "<a href=\"".encode_url("index.php?action=deletenews&news_id={$key}&ctype={$ctype}")."\" onclick=\"return confirm('".i18n::translate('Are you sure you want to delete this Journal entry?')."');\">".i18n::translate('Delete')."</a><br />";
+ $content .= "</div><br />";
+ }
+ if (WT_USER_ID) {
+ $content .= "<br /><a href=\"javascript:;\" onclick=\"addnews('".WT_USER_ID."'); return false;\">".i18n::translate('Add a new Journal entry')."</a>";
+ }
+
+ $block=get_block_setting($block_id, 'block', true);
+ if ($block) {
+ require $THEME_DIR.'templates/block_small_temp.php';
+ } else {
+ require $THEME_DIR.'templates/block_main_temp.php';
+ }
+ }
+
+ // Implement class WT_Module_Block
+ public function canLoadAjax() {
+ return false;
+ }
+
+ // Implement class WT_Module_Block
+ public function isUserBlock() {
+ return true;
+ }
+
+ // Implement class WT_Module_Block
+ public function isGedcomBlock() {
+ return false;
}
// Implement class WT_Module_Block
- public function configureBlock() {
- // Create an edit form, and respond to the result
+ public function configureBlock($block_id) {
}
}
diff --git a/modules/user_favorites/module.php b/modules/user_favorites/module.php
index 4b2073c89e..2f9a6c8f65 100644
--- a/modules/user_favorites/module.php
+++ b/modules/user_favorites/module.php
@@ -22,8 +22,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * @package webtrees
- * @subpackage Modules
* @version $Id: class_media.php 5451 2009-05-05 22:15:34Z fisharebest $
*/
@@ -46,12 +44,240 @@ class user_favorites_WT_Module extends WT_Module implements WT_Module_Block {
}
// Implement class WT_Module_Block
- public function getBlock($block, $config, $side, $index) {
- // Generate the block contents
+ public function getBlock($block_id) {
+ global $WT_IMAGE_DIR, $WT_IMAGES, $GEDCOM, $TEXT_DIRECTION, $INDEX_DIRECTORY, $MEDIA_DIRECTORY, $MULTI_MEDIA, $MEDIA_DIRECTORY_LEVELS, $ctype;
+ global $show_full, $PEDIGREE_FULL_DETAILS, $BROWSERTYPE, $ENABLE_AUTOCOMPLETE;
+
+ $action=safe_GET('action');
+ switch ($action) {
+ case 'deletefav':
+ $fv_id=safe_GET('fv_id');
+ if ($fv_id) {
+ deleteFavorite($fv_id);
+ }
+ break;
+ case 'addfav':
+ $gid =safe_GET('gid');
+ $favnote =safe_GET('favnote');
+ $favtype =safe_GET('favtype');
+ $url =safe_GET('url', WT_REGEX_URL);
+ $favtitle=safe_GET('favtitle');
+
+ if ($gid) {
+ $indirec = find_gedcom_record($gid, WT_GED_ID);
+ $ct = preg_match('/0 @(.*)@ (.*)/', $indirec, $match);
+ if ($indirec && $ct>0) {
+ $favorite = array();
+ if (empty($favtype)) {
+ if ($ctype=='user') $favtype = 'user';
+ else $favtype = 'gedcom';
+ }
+ if ($favtype=='gedcom') {
+ $favtype = $GEDCOM;
+ $_SESSION['clearcache'] = true;
+ }
+ else $favtype=WT_USER_NAME;
+ $favorite['username'] = $favtype;
+ $favorite['gid'] = $gid;
+ $favorite['type'] = trim($match[2]);
+ $favorite['file'] = $GEDCOM;
+ $favorite['url'] = '';
+ $favorite['note'] = $favnote;
+ $favorite['title'] = '';
+ addFavorite($favorite);
+ }
+ }
+ $url=safe_GET('url');
+ if ($url) {
+ if (empty($favtitle)) $favtitle = $url;
+ $favorite = array();
+ if (!isset($favtype)) {
+ if ($ctype=='user') $favtype = 'user';
+ else $favtype = 'gedcom';
+ }
+ if ($favtype=='gedcom') {
+ $favtype = $GEDCOM;
+ $_SESSION['clearcache'] = true;
+ }
+ else $favtype=WT_USER_NAME;
+ $favorite['username'] = $favtype;
+ $favorite['gid'] = '';
+ $favorite['type'] = 'URL';
+ $favorite['file'] = $GEDCOM;
+ $favorite['url'] = $url;
+ $favorite['note'] = $favnote;
+ $favorite['title'] = $favtitle;
+ addFavorite($favorite);
+ }
+ break;
+ }
+
+ $block=get_block_setting($block_id, 'block', false);
+
+ // Override GEDCOM configuration temporarily
+ if (isset($show_full)) $saveShowFull = $show_full;
+ $savePedigreeFullDetails = $PEDIGREE_FULL_DETAILS;
+ $show_full = 1;
+ $PEDIGREE_FULL_DETAILS = 1;
+
+ $userfavs = getUserFavorites(WT_USER_NAME);
+ if (!is_array($userfavs)) $userfavs = array();
+
+ $id=$this->getName().$block_id;
+ $title=i18n::translate('My Favorites').help_link('mygedview_favorites');
+ if ($TEXT_DIRECTION=="rtl") $title .= getRLM();
+ $title .= "(".count($userfavs).")";
+ if ($TEXT_DIRECTION=="rtl") $title .= getRLM();
+
+ if ($ENABLE_AUTOCOMPLETE) {
+ $content = '<script type="text/javascript" src="js/jquery/jquery.min.js"></script>
+ <script type="text/javascript" src="js/jquery/jquery.autocomplete.js"></script>
+ <script type="text/javascript" src="js/jquery/jquery.ajaxQueue.js"></script>
+ <script type="text/javascript">
+ jQuery.noConflict(); // @see http://docs.jquery.com/Using_jQuery_with_Other_Libraries/
+ jQuery(document).ready(function($){
+ $("input[name^=gid]").autocomplete("autocomplete.php", {
+ extraParams: {field:"IFSRO"},
+ formatItem: function(row, i) {
+ return row[0] + " (" + row[1] + ")";
+ },
+ formatResult: function(row) {
+ return row[1];
+ },
+ width: 400,
+ minChars: 2
+ });
+ });
+ </script>';
+ } else $content = '';
+
+ if ($block) {
+ $style = 2; // 1 means "regular box", 2 means "wide box"
+ $tableWidth = ($BROWSERTYPE=="msie") ? "95%" : "99%"; // IE needs to have room for vertical scroll bar inside the box
+ $cellSpacing = "1px";
+ } else {
+ $style = 2;
+ $tableWidth = "99%";
+ $cellSpacing = "3px";
+ }
+ if (count($userfavs)==0) {
+ $content .= i18n::translate('You have not selected any favorites.<br /><br />To add an individual, a family, or a source to your favorites, click on the <b>Add a new favorite</b> link to reveal some fields where you can enter or search for an ID number. Instead of an ID number, you can enter a URL and a title.');
+ } else {
+ $mygedcom = $GEDCOM;
+ $current_gedcom = $GEDCOM;
+ $content .= "<table width=\"{$tableWidth}\" style=\"border:none\" cellspacing=\"{$cellSpacing}\" class=\"center $TEXT_DIRECTION\">";
+ foreach($userfavs as $key=>$favorite) {
+ if (isset($favorite["id"])) $key=$favorite["id"];
+ $removeFavourite = "<a class=\"font9\" href=\"".encode_url("index.php?ctype={$ctype}&action=deletefav&fv_id={$key}")."\" onclick=\"return confirm('".i18n::translate('Are you sure you want to remove this item from your list of Favorites?')."');\">".i18n::translate('Remove')."</a><br />";
+ $current_gedcom = $GEDCOM;
+ $GEDCOM = $favorite["file"];
+ $content .= "<tr><td>";
+ if ($favorite["type"]=="URL") {
+ $content .= "<div id=\"boxurl".$key.".0\" class=\"person_box\">";
+ if ($ctype=="user" || WT_USER_IS_ADMIN) $content .= $removeFavourite;
+ $content .= "<a href=\"".$favorite["url"]."\">".PrintReady($favorite["title"])."</a>";
+ $content .= "<br />".PrintReady($favorite["note"]);
+ } else {
+ require $INDEX_DIRECTORY.$GEDCOM.'_conf.php';
+ $indirec = find_gedcom_record($favorite["gid"], WT_GED_ID);
+ if ($favorite["type"]=="INDI") {
+ $content .= "<div id=\"box".$favorite["gid"].".0\" class=\"person_box";
+ if (strpos($indirec, "\n1 SEX F")!==false) $content .= "F";
+ elseif (strpos($indirec, "\n1 SEX M")!==false) $content .= "";
+ else $content .= "NN";
+ $content .= "\">";
+ if ($ctype=="user" || WT_USER_IS_ADMIN) $content .= $removeFavourite;
+ ob_start();
+ print_pedigree_person($favorite["gid"], $style, 1, $key);
+ $content .= ob_get_clean();
+ $content .= PrintReady($favorite["note"]);
+ } else {
+ $record=GedcomRecord::getInstance($favorite['gid']);
+ $content .= "<div id=\"box".$favorite["gid"].".0\" class=\"person_box\">";
+ if ($ctype=="user" || WT_USER_IS_ADMIN) $content .= $removeFavourite;
+ if ($record) {
+ $content.=$record->format_list('span');
+ } else {
+ $content.=i18n::translate('No such ID exists in this GEDCOM file.');
+ }
+ $content .= "<br />".PrintReady($favorite["note"]);
+ }
+ }
+ $content .= "</div>";
+ $content .= "</td></tr>";
+ $GEDCOM = $mygedcom;
+ require $INDEX_DIRECTORY.$GEDCOM.'_conf.php';
+ }
+ $content .= "</table>";
+ }
+ $content .= '
+ <script language="JavaScript" type="text/javascript">
+ var pastefield;
+ function paste_id(value) {
+ pastefield.value=value;
+ }
+ </script>
+ <br />
+ ';
+ $uniqueID = floor(microtime() * 1000000);
+ $content .= "<b><a href=\"javascript: ".i18n::translate('Add a new favorite')." \" onclick=\"expand_layer('add_user_fav'); return false;\"><img id=\"add_user_fav_img\" src=\"".$WT_IMAGE_DIR."/".$WT_IMAGES["plus"]["other"]."\" border=\"0\" alt=\"\" />&nbsp;".i18n::translate('Add a new favorite')."</a></b>";
+ $content .= help_link('index_add_favorites');
+ $content .= "<br /><div id=\"add_user_fav\" style=\"display: none;\">";
+ $content .= "<form name=\"addufavform\" method=\"get\" action=\"index.php\">";
+ $content .= "<input type=\"hidden\" name=\"action\" value=\"addfav\" />";
+ $content .= "<input type=\"hidden\" name=\"ctype\" value=\"$ctype\" />";
+ $content .= "<input type=\"hidden\" name=\"favtype\" value=\"user\" />";
+ $content .= "<input type=\"hidden\" name=\"ged\" value=\"$GEDCOM\" />";
+ $content .= "<table width=\"{$tableWidth}\" style=\"border:none\" cellspacing=\"{$cellSpacing}\" class=\"center $TEXT_DIRECTION\">";
+ $content .= "<tr><td>".i18n::translate('Enter a Person, Family, or Source ID')." <br />";
+ $content .= "<input class=\"pedigree_form\" type=\"text\" name=\"gid\" id=\"gid{$uniqueID}\" size=\"5\" value=\"\" />";
+
+ $content .= print_findindi_link("gid{$uniqueID}",'',true)."\n";
+ $content .= print_findfamily_link("gid{$uniqueID}",'',true)."\n";
+ $content .= print_findsource_link("gid{$uniqueID}",'',true)."\n";
+ $content .= print_findrepository_link("gid{$uniqueID}",'',true)."\n";
+ $content .= print_findnote_link("gid{$uniqueID}",'',true)."\n";
+ $content .= print_findmedia_link("gid{$uniqueID}",'1','',true)."\n";
+
+ $content .= "<br />".i18n::translate('OR<br />Enter a URL and a title');
+ $content .= "<table><tr><td>".translate_fact('URL')."</td><td><input type=\"text\" name=\"url\" size=\"40\" value=\"\" /></td></tr>";
+ $content .= "<tr><td>".i18n::translate('Title:')."</td><td><input type=\"text\" name=\"favtitle\" size=\"40\" value=\"\" /></td></tr></table>";
+ if ($block) $content .= "\n</td></tr><tr><td><br />";
+ else $content .= "\n</td><td>";
+ $content .= i18n::translate('Enter an optional note about this favorite');
+ $content .= "<br /><textarea name=\"favnote\" rows=\"6\" cols=\"50\"></textarea>";
+ $content .= "</td></tr></table>";
+ $content .= "<br /><input type=\"submit\" value=\"".i18n::translate('Add')."\" style=\"font-size: 8pt; \" />";
+ $content .= "</form></div>";
+
+ global $THEME_DIR;
+ if ($block) {
+ require $THEME_DIR.'templates/block_small_temp.php';
+ } else {
+ require $THEME_DIR.'templates/block_main_temp.php';
+ }
+ // Restore GEDCOM configuration
+ unset($show_full);
+ if (isset($saveShowFull)) $show_full = $saveShowFull;
+ $PEDIGREE_FULL_DETAILS = $savePedigreeFullDetails;
+ }
+
+ // Implement class WT_Module_Block
+ public function canLoadAjax() {
+ return false;
+ }
+
+ // Implement class WT_Module_Block
+ public function isUserBlock() {
+ return true;
+ }
+
+ // Implement class WT_Module_Block
+ public function isGedcomBlock() {
+ return false;
}
// Implement class WT_Module_Block
- public function configureBlock() {
- // Create an edit form, and respond to the result
+ public function configureBlock($block_id) {
}
}
diff --git a/modules/user_messages/module.php b/modules/user_messages/module.php
index d3fd32ea53..2a6e417429 100644
--- a/modules/user_messages/module.php
+++ b/modules/user_messages/module.php
@@ -22,8 +22,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * @package webtrees
- * @subpackage Modules
* @version $Id: class_media.php 5451 2009-05-05 22:15:34Z fisharebest $
*/
@@ -46,12 +44,154 @@ class user_messages_WT_Module extends WT_Module implements WT_Module_Block {
}
// Implement class WT_Module_Block
- public function getBlock($block, $config, $side, $index) {
- // Generate the block contents
+ public function getBlock($block_id) {
+ global $ctype, $WT_IMAGE_DIR, $TEXT_DIRECTION, $WT_IMAGES, $THEME_DIR;
+
+ require_once WT_ROOT.'includes/functions/functions_print_facts.php';
+
+ // Block actions
+ $action=safe_GET('action');
+ $message_id=safe_GET('message_id');
+ if ($action=='deletemessage') {
+ if (is_array($message_id)) {
+ foreach ($message_id as $msg_id) {
+ deleteMessage($msg_id);
+ }
+ } else {
+ deleteMessage($message_id);
+ }
+ }
+
+ $usermessages = getUserMessages(WT_USER_NAME);
+
+ $id=$this->getName().$block_id;
+ $title=i18n::translate('My Messages').help_link('mygedview_message');
+ if ($TEXT_DIRECTION=="rtl") $title .= getRLM();
+ $title .= "(".count($usermessages).")";
+ if ($TEXT_DIRECTION=="rtl") $title .= getRLM();
+
+ $content = "";
+ $content .= "<form name=\"messageform\" action=\"index.php?ctype={$ctype}\" method=\"get\" onsubmit=\"return confirm('".i18n::translate('Are you sure you want to delete this message? It cannot be retrieved later.')."');\">";
+ if (count($usermessages)==0) {
+ $content .= i18n::translate('You have no pending messages.')."<br />";
+ } else {
+ $content .= '
+ <script language="JavaScript" type="text/javascript">
+ <!--
+ function select_all() {
+ ';
+ foreach($usermessages as $key=>$message) {
+ if (isset($message["id"])) $key = $message["id"];
+ $content .= '
+ var cb = document.getElementById("cb_message'.$key.'");
+ if (cb) {
+ if (!cb.checked) cb.checked = true;
+ else cb.checked = false;
+ }
+ ';
+ }
+ $content .= '
+ return false;
+ }
+ //-->
+ </script>
+ ';
+ $content .= "<input type=\"hidden\" name=\"action\" value=\"deletemessage\" />";
+ $content .= "<table class=\"list_table\"><tr>";
+ $content .= "<td class=\"list_label\">".i18n::translate('Delete')."<br /><a href=\"javascript:;\" onclick=\"return select_all();\">".i18n::translate('All')."</a></td>";
+ $content .= "<td class=\"list_label\">".i18n::translate('Subject:')."</td>";
+ $content .= "<td class=\"list_label\">".i18n::translate('Date Sent:')."</td>";
+ $content .= "<td class=\"list_label\">".i18n::translate('Email Address:')."</td>";
+ $content .= "</tr>";
+ foreach($usermessages as $key=>$message) {
+ if (isset($message["id"])) $key = $message["id"];
+ $content .= "<tr>";
+ $content .= "<td class=\"list_value_wrap\"><input type=\"checkbox\" id=\"cb_message$key\" name=\"message_id[]\" value=\"$key\" /></td>";
+ $showmsg=preg_replace("/(\w)\/(\w)/","\$1/<span style=\"font-size:1px;\"> </span>\$2",PrintReady($message["subject"]));
+ $showmsg=str_replace("@","@<span style=\"font-size:1px;\"> </span>",$showmsg);
+ $content .= "<td class=\"list_value_wrap\"><a href=\"javascript:;\" onclick=\"expand_layer('message{$key}'); return false;\"><img id=\"message{$key}_img\" src=\"".$WT_IMAGE_DIR."/".$WT_IMAGES["plus"]["other"]."\" border=\"0\" alt=\"".i18n::translate('Show Details')."\" title=\"".i18n::translate('Show Details')."\" /> <b>".$showmsg."</b></a></td>";
+ if (!empty($message["created"])) {
+ $time = strtotime($message["created"]);
+ } else {
+ $time = time();
+ }
+ $content .= "<td class=\"list_value_wrap\">".format_timestamp($time)."</td>";
+ $content .= "<td class=\"list_value_wrap\">";
+ $user_id=get_user_id($message["from"]);
+ if ($user_id) {
+ $content .= PrintReady(getUserFullName($user_id));
+ if ($TEXT_DIRECTION=="ltr") {
+ $content .= " " . getLRM() . " - ".htmlspecialchars($user_id,ENT_COMPAT,'UTF-8') . getLRM();
+ } else {
+ $content .= " " . getRLM() . " - ".htmlspecialchars($user_id,ENT_COMPAT,'UTF-8') . getRLM();
+ }
+ } else {
+ $content .= "<a href=\"mailto:".$message["from"]."\">".str_replace("@","@<span style=\"font-size:1px;\"> </span>",$message["from"])."</a>";
+ }
+ $content .= "</td>";
+ $content .= "</tr>";
+ $content .= "<tr><td class=\"list_value_wrap\" colspan=\"5\"><div id=\"message$key\" style=\"display: none;\">";
+ $message["body"] = nl2br(htmlspecialchars($message["body"],ENT_COMPAT,'UTF-8'));
+ $message["body"] = expand_urls($message["body"]);
+
+ $content .= PrintReady($message["body"])."<br /><br />";
+ if (strpos($message["subject"], "RE:")===false) {
+ $message["subject"]="RE:".$message["subject"];
+ }
+ if ($user_id) {
+ $content .= "<a href=\"javascript:;\" onclick=\"reply('".$user_id."', '".$message["subject"]."'); return false;\">".i18n::translate('Reply')."</a> | ";
+ }
+ $content .= "<a href=\"".encode_url("index.php?action=deletemessage&message_id={$key}")."\" onclick=\"return confirm('".i18n::translate('Are you sure you want to delete this message? It cannot be retrieved later.')."');\">".i18n::translate('Delete')."</a></div></td></tr>";
+ }
+ $content .= "</table>";
+ $content .= "<input type=\"submit\" value=\"".i18n::translate('Delete Selected Messages')."\" /><br /><br />";
+ }
+ if (get_user_count()>1) {
+ $content .= i18n::translate('Send Message')." <select name=\"touser\">";
+ if (WT_USER_IS_ADMIN) {
+ $content .= "<option value=\"all\">".i18n::translate('Broadcast to all users')."</option>";
+ $content .= "<option value=\"never_logged\">".i18n::translate('Send message to users who have never logged in')."</option>";
+ $content .= "<option value=\"last_6mo\">".i18n::translate('Send message to users who have not logged in for 6 months')."</option>";
+ }
+ foreach (get_all_users() as $user_id=>$user_name) {
+ if ($user_id!=WT_USER_ID && get_user_setting($user_id, 'verified_by_admin')=='yes' && get_user_setting($user_id, 'contactmethod')!='none') {
+ $content .= "<option value=\"".$user_name."\">".PrintReady(getUserFullName($user_id))." ";
+ if ($TEXT_DIRECTION=="ltr") {
+ $content .= stripLRMRLM(getLRM()." - ".$user_name.getLRM());
+ } else {
+ $content .= stripLRMRLM(getRLM()." - ".$user_name.getRLM());
+ }
+ $content .= "</option>";
+ }
+ }
+ $content .= "</select><input type=\"button\" value=\"".i18n::translate('Send')."\" onclick=\"message(document.messageform.touser.options[document.messageform.touser.selectedIndex].value, 'messaging2', ''); return false;\" />";
+ }
+ $content .= "</form>";
+
+ $block=get_block_setting($block_id, 'block', true);
+ if ($block) {
+ require $THEME_DIR.'templates/block_small_temp.php';
+ } else {
+ require $THEME_DIR.'templates/block_main_temp.php';
+ }
+ }
+
+ // Implement class WT_Module_Block
+ public function canLoadAjax() {
+ return false;
+ }
+
+ // Implement class WT_Module_Block
+ public function isUserBlock() {
+ return true;
+ }
+
+ // Implement class WT_Module_Block
+ public function isGedcomBlock() {
+ return false;
}
// Implement class WT_Module_Block
- public function configureBlock() {
- // Create an edit form, and respond to the result
+ public function configureBlock($block_id) {
}
}
diff --git a/modules/user_welcome/module.php b/modules/user_welcome/module.php
index 254c03f9bc..adb5b07624 100644
--- a/modules/user_welcome/module.php
+++ b/modules/user_welcome/module.php
@@ -22,8 +22,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * @package webtrees
- * @subpackage Modules
* @version $Id: class_media.php 5451 2009-05-05 22:15:34Z fisharebest $
*/
@@ -46,10 +44,46 @@ class user_welcome_WT_Module extends WT_Module implements WT_Module_Block {
}
// Implement class WT_Module_Block
- public function getBlock($block, $config="", $side, $index) {
+ public function getBlock($block_id) {
+ global $WT_IMAGE_DIR, $WT_IMAGES, $THEME_DIR;
+
+ $id=$this->getName().$block_id;
+ $title=i18n::translate('Welcome')." ".getUserFullName(WT_USER_ID);
+
+ $content = "<table class=\"blockcontent\" cellspacing=\"0\" cellpadding=\"0\" style=\" width: 100%; direction:ltr;\"><tr>";
+ $content .= "<td class=\"tab_active_bottom\" colspan=\"3\" ></td></tr><tr>";
+ if (get_user_setting(WT_USER_ID, 'editaccount')=='Y') {
+ $content .= "<td class=\"center details2\" style=\" width: 33%; clear: none; vertical-align: top; margin-top: 2px;\"><a href=\"edituser.php\"><img src=\"".$WT_IMAGE_DIR."/".$WT_IMAGES["mygedview"]["small"]."\" border=\"0\" alt=\"".i18n::translate('My Account')."\" title=\"".i18n::translate('My Account')."\" /><br />".i18n::translate('My Account')."</a></td>";
+ }
+ if (WT_USER_GEDCOM_ID) {
+ $content .= "<td class=\"center details2\" style=\" width: 33%; clear: none; vertical-align: top; margin-top: 2px;\"><a href=\"".encode_url("pedigree.php?rootid=".WT_USER_GEDCOM_ID)."\"><img src=\"".$WT_IMAGE_DIR."/".$WT_IMAGES["pedigree"]["small"]."\" border=\"0\" alt=\"".i18n::translate('My Pedigree')."\" title=\"".i18n::translate('My Pedigree')."\" /><br />".i18n::translate('My Pedigree')."</a></td>";
+ $content .= "<td class=\"center details2\" style=\" width: 33%; clear: none; vertical-align: top; margin-top: 2px;\"><a href=\"".encode_url("individual.php?pid=".WT_USER_GEDCOM_ID)."\"><img src=\"".$WT_IMAGE_DIR."/".$WT_IMAGES["indis"]["small"]."\" border=\"0\" alt=\"".i18n::translate('My Individual Record')."\" title=\"".i18n::translate('My Individual Record')."\" /><br />".i18n::translate('My Individual Record')."</a></td>";
+ }
+ $content .= "</tr><tr><td class=\"center\" colspan=\"3\">";
+ $content .= "<a href=\"javascript:;\" onclick=\"window.open('".encode_url("index_edit.php?name=".WT_USER_NAME."&ctype=user")."', '_blank', 'top=50,left=10,width=705,height=355,scrollbars=1,resizable=1');\">".i18n::translate('Customize My Page')."</a>";
+ $content .= help_link('mygedview_customize');
+ $content .= "<br />".format_timestamp(client_time());
+ $content .= "</td></tr></table>";
+
+ require $THEME_DIR.'templates/block_main_temp.php';
+ }
+
+ // Implement class WT_Module_Block
+ public function canLoadAjax() {
+ return false;
+ }
+
+ // Implement class WT_Module_Block
+ public function isUserBlock() {
+ return true;
+ }
+
+ // Implement class WT_Module_Block
+ public function isGedcomBlock() {
+ return false;
}
// Implement class WT_Module_Block
- public function configureBlock() {
+ public function configureBlock($block_id) {
}
}
diff --git a/modules/yahrzeit/module.php b/modules/yahrzeit/module.php
index 36df42d04b..baf35f0ed4 100644
--- a/modules/yahrzeit/module.php
+++ b/modules/yahrzeit/module.php
@@ -22,8 +22,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * @package webtrees
- * @subpackage Modules
* @version $Id: class_media.php 5451 2009-05-05 22:15:34Z fisharebest $
*/
@@ -46,12 +44,232 @@ class yahrzeit_WT_Module extends WT_Module implements WT_Module_Block {
}
// Implement class WT_Module_Block
- public function getBlock($block, $config, $side, $index) {
- // Generate the block contents
+ public function getBlock($block_id) {
+ global $ctype, $SHOW_ID_NUMBERS, $TEXT_DIRECTION, $WT_IMAGE_DIR, $WT_IMAGES, $WT_BLOCKS, $DAYS_TO_SHOW_LIMIT, $SHOW_MARRIED_NAMES, $SERVER_URL, $THEME_DIR;
+
+ $days=get_block_setting($block_id, 'days', $DAYS_TO_SHOW_LIMIT);
+ $infoStyle=get_block_setting($block_id, 'infoStyle', 'table');
+ $allowDownload=WT_USER_ID && get_block_setting($block_id, 'allowDownload', true);
+ $block=get_block_setting($block_id, 'block', true);
+
+ $startjd=server_jd();
+ $endjd=$startjd+$days-1;
+
+ $id=$this->getName().$block_id;
+ if ($ctype='gedcom' && WT_USER_GEDCOM_ADMIN || $ctype=='user' && WT_USER_ID) {
+ $title='<a href="javascript: configure block" onclick="window.open(\'index_edit.php?action=configure&amp;ctype={$ctype}&amp;block_id='.$block_id.'\'), \'_blank\', \'top=50,left=50,width=600,height=350,scrollbars=1,resizable=1\'); return false;">';
+ $title.='<img class="adminicon" src="'.$WT_IMAGE_DIR.'/'.$WT_IMAGES['admin']['small'].'" width="15" height="15" border="0" alt="'.i18n::translate('Configure').'" /></a>';
+ } else {
+ $title='';
+ }
+ $title.= i18n::translate('Upcoming Yahrzeiten').help_link('yahrzeit');
+ $content='';
+
+ // The standard anniversary rules cover most of the Yahrzeit rules, we just
+ // need to handle a few special cases.
+ // Fetch normal anniversaries...
+ $yahrzeits=array();
+ $hidden=0;
+ for ($jd=$startjd-1; $jd<=$endjd+30;++$jd) {
+ foreach (get_anniversary_events($jd, 'DEAT _YART') as $fact) {
+ // Extract hebrew dates only
+ if ($fact['date']->date1->CALENDAR_ESCAPE()=='@#DHEBREW@' && $fact['date']->MinJD()==$fact['date']->MaxJD()) {
+ // Apply privacy
+ if (displayDetailsById($fact['id']) && showFactDetails($fact['fact'], $fact['id']) && !FactViewRestricted($fact['id'], $fact['factrec'])) {
+ $yahrzeits[]=$fact;
+ } else {
+ ++$hidden;
+ }
+ }
+ }
+ }
+
+ // ...then adjust dates
+ foreach ($yahrzeits as $key=>$yahrzeit) {
+ if (strpos('1 DEAT', $yahrzeit['factrec'])!==false) { // Just DEAT, not _YART
+ $today=new JewishDate($yahrzeit['jd']);
+ $hd=$yahrzeit['date']->MinDate();
+ $hd1=new JewishDate($hd);
+ $hd1->y+=1;
+ $hd1->SetJDFromYMD();
+ // Special rules. See http://www.hebcal.com/help/anniv.html
+ // Everything else is taken care of by our standard anniversary rules.
+ if ($hd->d==30 && $hd->m==2 && $hd->y!=0 && $hd1->DaysInMonth()<30) { // 30 CSH
+ // Last day in CSH
+ $yahrzeit[$key]['jd']=JewishDate::YMDtoJD($today->y, 3, 1)-1;
+ }
+ if ($hd->d==30 && $hd->m==3 && $hd->y!=0 && $hd1->DaysInMonth()<30) { // 30 KSL
+ // Last day in KSL
+ $yahrzeit[$key]['jd']=JewishDate::YMDtoJD($today->y, 4, 1)-1;
+ }
+ if ($hd->d==30 && $hd->m==6 && $hd->y!=0 && $today->DaysInMonth()<30 && !$today->IsLeapYear()) { // 30 ADR
+ // Last day in SHV
+ $yahrzeit[$key]['jd']=JewishDate::YMDtoJD($today->y, 6, 1)-1;
+ }
+ }
+ }
+
+ switch ($infoStyle) {
+ case 'list':
+ foreach ($yahrzeits as $yahrzeit)
+ if ($yahrzeit['jd']>=$startjd && $yahrzeit['jd']<$startjd+$days) {
+ $ind=person::GetInstance($yahrzeit['id']);
+ $content .= "<a href=\"".encode_url($ind->getLinkUrl())."\" class=\"list_item name2\">".$ind->getFullName()."</a>".$ind->getSexImage();
+ $content .= "<div class=\"indent\">";
+ $content .= $yahrzeit['date']->Display(true);
+ $content .= ', '.i18n::translate('%s year anniversary', $yahrzeit['anniv']);
+ $content .= "</div>";
+ }
+ break;
+ case 'table':
+ default:
+ require_once WT_ROOT.'js/sorttable.js.htm';
+ require_once WT_ROOT.'includes/classes/class_gedcomrecord.php';
+ $table_id = "ID".floor(microtime()*1000000); // sorttable requires a unique ID
+ $content .= "<table id=\"{$table_id}\" class=\"sortable list_table center\">";
+ $content .= "<tr>";
+ $content .= "<th class=\"list_label\">".translate_fact('NAME')."</th>";
+ $content .= "<th style=\"display:none\">GIVN</th>";
+ $content .= "<th class=\"list_label\">".translate_fact('DATE')."</th>";
+ $content .= "<th class=\"list_label\"><img src=\"./images/reminder.gif\" alt=\"".i18n::translate('Anniversary')."\" title=\"".i18n::translate('Anniversary')."\" border=\"0\" /></th>";
+ $content .= "<th class=\"list_label\">".translate_fact('_YART')."</th>";
+ $content .= "</tr>";
+
+ $count=0;
+ foreach ($yahrzeits as $yahrzeit) {
+ if ($yahrzeit['jd']>=$startjd && $yahrzeit['jd']<$startjd+$days) {
+ ++$count;
+ $ind=person::GetInstance($yahrzeit['id']);
+ $content .= "<tr class=\"vevent\">"; // hCalendar:vevent
+ // Record name(s)
+ $name=$ind->getFullName();
+ $url=$ind->getLinkUrl();
+ $content .= "<td class=\"list_value_wrap\" align=\"".get_align($name)."\">";
+ $content .= "<a href=\"".encode_url($ind->getLinkUrl())."\" class=\"list_item name2\" dir=\"".$TEXT_DIRECTION."\">".PrintReady($name)."</a>";
+ $content .= $ind->getSexImage();
+ $addname=$ind->getAddName();
+ if ($addname) {
+ $content .= "<br /><a href=\"".encode_url($url)."\" class=\"list_item\">".PrintReady($addname)."</a>";
+ }
+ $content .= "</td>";
+
+ // GIVN for sorting
+ $content .= "<td style=\"display:none\">";
+ $exp = explode(",", str_replace('<', ',', $name).",");
+ $content .= $exp[1];
+ $content .= "</td>";
+
+ $today=new JewishDate($yahrzeit['jd']);
+ $td=new GedcomDate($today->Format('%@ %A %O %E'));
+
+ // death/yahrzeit event date
+ $content .= "<td class=\"list_value_wrap\">";
+ $content .= "<a name='{$yahrzeit['jd']}'>".$yahrzeit['date']->Display(true, NULL, array())."</a>";
+ $content .= "</td>";
+
+ // Anniversary
+ $content .= "<td class=\"list_value_wrap rela\">";
+ $anniv = $yahrzeit['anniv'];
+ if ($anniv==0) {
+ $content .= '<a name="0">&nbsp;</a>';
+ } else {
+ $content .= "<a name=\"{$anniv}\">{$anniv}</a>";
+ }
+ if ($allowDownload) {
+ // hCalendar:dtstart and hCalendar:summary
+ //TODO does this work??
+ $content .= "<abbr class=\"dtstart\" title=\"".strip_tags($yahrzeit['date']->Display(false,'Ymd',array()))."\"></abbr>";
+ $content .= "<abbr class=\"summary\" title=\"".i18n::translate('Anniversary')." #$anniv ".i18n::translate($yahrzeit['fact'])." : ".PrintReady(strip_tags($ind->getFullName()))."\"></abbr>";
+ }
+
+ // upcomming yahrzeit dates
+ $content .= "<td class=\"list_value_wrap\">";
+ $content .= "<a href=\"".$url."\" class=\"list_item url\">".$td->Display(true, NULL, array('gregorian'))."</a>"; // hCalendar:url
+ $content .= "&nbsp;</td>";
+
+ $content .= "</tr>";
+ }
+ }
+
+ // table footer
+ $content .= "<tr class=\"sortbottom\">";
+ $content .= "<td class=\"list_label\">";
+ $content .= '<a href="javascript:;" onclick="sortByOtherCol(this,1)"><img src="images/topdown.gif" alt="" border="0" /> '.translate_fact('GIVN').'</a><br />';
+ $content .= i18n::translate('Total Names').": ".$count;
+ if ($hidden) {
+ $content .= "<br /><span class=\"warning\">".i18n::translate('Hidden')." : {$hidden}</span>";
+ }
+ $content .= "</td>";
+ $content .= "<td style=\"display:none\">GIVN</td>";
+ $content .= "<td>";
+ if ($allowDownload) {
+ $uri = $SERVER_URL.basename($_SERVER['REQUEST_URI']);
+ $alt = i18n::translate('Download file %s', 'hCal-events.ics');
+ if (count($yahrzeits)) {
+ $content .= "<a href=\"http://feeds.technorati.com/events/{$uri}\"><img src=\"images/hcal.png\" border=\"0\" alt=\"{$alt}\" title=\"{$alt}\" /></a>";
+ }
+ }
+ $content .= '</td><td>&nbsp;</td><td>&nbsp;</td></tr>';
+ $content .= '</table>';
+ break;
+ }
+
+ $block=get_block_setting($block_id, 'block', true);
+ if ($block) {
+ require $THEME_DIR.'templates/block_small_temp.php';
+ } else {
+ require $THEME_DIR.'templates/block_main_temp.php';
+ }
}
// Implement class WT_Module_Block
- public function configureBlock() {
- // Create an edit form, and respond to the result
+ public function canLoadAjax() {
+ return true;
+ }
+
+ // Implement class WT_Module_Block
+ public function isUserBlock() {
+ return true;
+ }
+
+ // Implement class WT_Module_Block
+ public function isGedcomBlock() {
+ return true;
+ }
+
+ // Implement class WT_Module_Block
+ public function configureBlock($block_id) {
+ global $DAYS_TO_SHOW_LIMIT;
+
+ if (safe_POST_bool('save')) {
+ set_block_setting($block_id, 'days', safe_POST_integer('days', 1, $DAYS_TO_SHOW_LIMIT, $DAYS_TO_SHOW_LIMIT));
+ set_block_setting($block_id, 'infoStyle', safe_POST('infoStyle', array('list', 'table'), 'table'));
+ set_block_setting($block_id, 'allowDownload', safe_POST_bool('allowDownload'));
+ echo WT_JS_START, 'window.opener.location.href=window.opener.location.href;window.close();', WT_JS_END;
+ exit;
+ }
+
+ require_once WT_ROOT.'includes/functions/functions_edit.php';
+
+ $days=get_block_setting($block_id, 'days', $DAYS_TO_SHOW_LIMIT);
+ echo '<tr><td class="descriptionbox wrap width33">';
+ echo i18n::translate('Number of days to show'), help_link('days_to_show');
+ echo '</td><td class="optionbox">';
+ echo '<input type="text" name="days" size="2" value="'.$days.'" />';
+ echo '</td></tr>';
+
+ $infoStyle=get_block_setting($block_id, 'infoStyle', 'style2');
+ echo '<tr><td class="descriptionbox wrap width33">';
+ echo i18n::translate('Presentation Style'), help_link('style');
+ echo '</td><td class="optionbox">';
+ echo select_edit_control('infoStyle', array('list'=>i18n::translate('List'), 'table'=>i18n::translate('Table')), null, $infoStyle, '');
+ echo '</td></tr>';
+
+ $allowDownload=get_block_setting($block_id, 'allowDownload', true);
+ echo '<tr><td class="descriptionbox wrap width33">';
+ echo i18n::translate('Allow calendar events download?'), help_link('cal_dowload');
+ echo '</td><td class="optionbox">';
+ echo edit_field_yes_no('allowDownload', $allowDownload);
+ echo '</td></tr>';
}
}
diff --git a/setup.php b/setup.php
index 4a03a56243..9b7b69fb13 100644
--- a/setup.php
+++ b/setup.php
@@ -705,18 +705,6 @@ try {
") COLLATE utf8_unicode_ci ENGINE=InnoDB"
);
$dbh->exec(
- "CREATE TABLE IF NOT EXISTS {$TBLPREFIX}blocks (".
- " b_id INTEGER AUTO_INCREMENT NOT NULL,".
- " b_username VARCHAR(100) NOT NULL,".
- " b_location VARCHAR(30) NOT NULL,".
- " b_order INTEGER NOT NULL,".
- " b_name VARCHAR(255) NOT NULL,".
- " b_config TEXT NOT NULL,".
- " PRIMARY KEY (b_id),".
- " KEY ix1 (b_username)".
- ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
- );
- $dbh->exec(
"CREATE TABLE IF NOT EXISTS {$TBLPREFIX}news (".
" n_id INTEGER AUTO_INCREMENT NOT NULL,".
" n_username VARCHAR(100) NOT NULL,".
@@ -927,6 +915,29 @@ try {
") COLLATE utf8_unicode_ci ENGINE=InnoDB"
);
$dbh->exec(
+ "CREATE TABLE IF NOT EXISTS {$TBLPREFIX}block (".
+ " block_id INTEGER AUTO_INCREMENT NOT NULL,".
+ " gedcom_id INTEGER NULL,".
+ " user_id INTEGER NULL,".
+ " location ENUM('faq', 'main','side') NOT NULL,".
+ " block_order INTEGER NOT NULL,".
+ " module_name VARCHAR(32) NOT NULL,".
+ " PRIMARY KEY (block_id),".
+ " FOREIGN KEY fk1 (gedcom_id ) REFERENCES {$TBLPREFIX}gedcom (gedcom_id ), /* ON DELETE CASCADE */".
+ " FOREIGN KEY fk2 (user_id ) REFERENCES {$TBLPREFIX}user (user_id ), /* ON DELETE CASCADE */".
+ " FOREIGN KEY fk3 (module_name) REFERENCES {$TBLPREFIX}module (module_name) /* ON DELETE CASCADE */".
+ ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
+ );
+ $dbh->exec(
+ "CREATE TABLE IF NOT EXISTS {$TBLPREFIX}block_setting (".
+ " block_id INTEGER NOT NULL,".
+ " setting_name VARCHAR(32) NOT NULL,".
+ " setting_value TEXT NOT NULL,".
+ " PRIMARY KEY (block_id, setting_name),".
+ " FOREIGN KEY fk1 (block_id) REFERENCES {$TBLPREFIX}block (block_id) /* ON DELETE CASCADE */".
+ ") COLLATE utf8_unicode_ci ENGINE=InnoDB"
+ );
+ $dbh->exec(
"CREATE TABLE IF NOT EXISTS {$TBLPREFIX}hit_counter (".
" gedcom_id INTEGER NOT NULL,".
" page_name VARCHAR(32) NOT NULL,".