diff options
52 files changed, 770 insertions, 229 deletions
diff --git a/ancestry.php b/ancestry.php index 97631940c8..f307d3b3ca 100644 --- a/ancestry.php +++ b/ancestry.php @@ -35,6 +35,7 @@ $MAX_PEDIGREE_GENERATIONS = $WT_TREE->getPreference('MAX_PEDIGREE_GENERATIONS'); $controller = new AncestryController; $controller + ->restrictAccess(Module::isActiveChart($WT_TREE, 'ancestors_chart')) ->pageHeader() ->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL) ->addInlineJavascript('autocomplete();'); diff --git a/app/Controller/FanchartController.php b/app/Controller/FanchartController.php index a26c7802d5..2744e07d8d 100644 --- a/app/Controller/FanchartController.php +++ b/app/Controller/FanchartController.php @@ -341,7 +341,6 @@ class FanchartController extends ChartController { // add action url $pid = $person->getXref(); $imagemap .= '" href="#' . $pid . '"'; - $tempURL = 'fanchart.php?rootid=' . $pid . '&generations=' . $this->generations . '&fan_width=' . $this->fan_width . '&fan_style=' . $this->fan_style . '&ged=' . $person->getTree()->getNameUrl(); $html .= '<div id="' . $pid . '" class="fan_chart_menu">'; $html .= '<div class="person_box"><div class="details1">'; $html .= '<a href="' . $person->getHtmlUrl() . '" class="name1">' . $name; @@ -350,55 +349,10 @@ class FanchartController extends ChartController { } $html .= '</a>'; $html .= '<ul class="charts">'; - $html .= '<li><a href="pedigree.php?rootid=' . $pid . '&ged=' . $person->getTree()->getNameUrl() . '" >' . I18N::translate('Pedigree') . '</a></li>'; - if (Module::getModuleByName('googlemap')) { - $html .= '<li><a href="module.php?mod=googlemap&mod_action=pedigree_map&rootid=' . $pid . '&ged=' . $person->getTree()->getNameUrl() . '">' . I18N::translate('Pedigree map') . '</a></li>'; - } - $gedcomid = $person->getTree()->getUserPreference(Auth::user(), 'gedcomid'); - if ($gedcomid && $gedcomid != $pid) { - $html .= '<li><a href="relationship.php?pid1=' . $gedcomid . '&pid2=' . $pid . '&ged=' . $person->getTree()->getNameUrl() . '">' . I18N::translate('Relationship to me') . '</a></li>'; - } - $html .= '<li><a href="descendancy.php?rootid=' . $pid . '&ged=' . $person->getTree()->getNameUrl() . '" >' . I18N::translate('Descendants') . '</a></li>'; - $html .= '<li><a href="ancestry.php?rootid=' . $pid . '&ged=' . $person->getTree()->getNameUrl() . '">' . I18N::translate('Ancestors') . '</a></li>'; - $html .= '<li><a href="compact.php?rootid=' . $pid . '&ged=' . $person->getTree()->getNameUrl() . '">' . I18N::translate('Compact tree') . '</a></li>'; - $html .= '<li><a href="' . $tempURL . '">' . I18N::translate('Fan chart') . '</a></li>'; - $html .= '<li><a href="hourglass.php?rootid=' . $pid . '&ged=' . $person->getTree()->getNameUrl() . '">' . I18N::translate('Hourglass chart') . '</a></li>'; - if (Module::getModuleByName('tree')) { - $html .= '<li><a href="module.php?mod=tree&mod_action=treeview&ged=' . $person->getTree()->getNameUrl() . '&rootid=' . $pid . '">' . I18N::translate('Interactive tree') . '</a></li>'; + foreach (Theme::theme()->individualBoxMenu($person) as $menu) { + $html .= '<li><a href="' . $menu->getLink() . '">' . $menu->getLabel() . '</a></li>'; } $html .= '</ul>'; - // spouse(s) and children - foreach ($person->getSpouseFamilies() as $family) { - $spouse = $family->getSpouse($person); - if ($spouse) { - $html .= '<a href="' . $spouse->getHtmlUrl() . '" class="name1">' . $spouse->getFullName() . '</a>'; - $kids = $family->getChildren(); - if ($kids) { - $html .= '<ul class="children">'; - foreach ($kids as $child) { - $html .= '<li><a href="' . $child->getHtmlUrl() . '" class="name1">' . $child->getFullName() . '</a></li>'; - } - $html .= '</ul>'; - } - } - } - // siblings - foreach ($person->getChildFamilies() as $family) { - $children = $family->getChildren(); - if ($children) { - $html .= '<div class="name1">'; - // With two children in a family, you have only one sibling. - $html .= count($children) > 2 ? I18N::translate('Siblings') : I18N::translate('Sibling'); - $html .= '</div>'; - $html .= '<ul class="siblings">'; - foreach ($children as $sibling) { - if ($sibling !== $person) { - $html .= '<li><a href="' . $sibling->getHtmlUrl() . '" class="name1"> ' . $sibling->getFullName() . '</a></li>'; - } - } - $html .= '</ul>'; - } - } $html .= '</div></div>'; $html .= '</div>'; $imagemap .= ' alt="' . strip_tags($person->getFullName()) . '" title="' . strip_tags($person->getFullName()) . '">'; diff --git a/app/Module.php b/app/Module.php index bd8725cdd1..22a17f81b4 100644 --- a/app/Module.php +++ b/app/Module.php @@ -170,6 +170,18 @@ class Module { } /** + * Get a list of modules which (a) provide a chart and (b) we have permission to see. + * + * @param Tree $tree + * @param string $module + * + * @return bool + */ + public static function isActiveChart(Tree $tree, $module) { + return array_key_exists($module, self::getActiveModulesByComponent($tree, 'chart')); + } + + /** * Get a list of modules which (a) provide a menu and (b) we have permission to see. * * @param Tree $tree diff --git a/app/Module/AncestorsChartModule.php b/app/Module/AncestorsChartModule.php index 58dacde50f..c75b4073b5 100644 --- a/app/Module/AncestorsChartModule.php +++ b/app/Module/AncestorsChartModule.php @@ -56,19 +56,22 @@ class AncestorsChartModule extends AbstractModule implements ModuleChartInterfac /** * Return a menu item for this chart. * - * @return Menu + * @return Menu|null */ public function getChartMenu(Individual $individual) { - global $controller, $WT_TREE; - return new Menu( $this->getTitle(), - 'ancestry.php?rootid=' . $individual->getXref() . '&ged=' . $WT_TREE->getNameUrl(), + 'ancestry.php?rootid=' . $individual->getXref() . '&ged=' . $individual->getTree()->getNameUrl(), 'menu-chart-ancestry', array('rel' => 'nofollow') ); } + /** + * Return a menu item for this chart - for use in individual boxes. + * + * @return Menu|null + */ public function getBoxChartMenu(Individual $individual) { return $this->getChartMenu($individual); } diff --git a/app/Module/CompactTreeChartModule.php b/app/Module/CompactTreeChartModule.php index 6b5499af63..f8328ee0ff 100644 --- a/app/Module/CompactTreeChartModule.php +++ b/app/Module/CompactTreeChartModule.php @@ -56,19 +56,22 @@ class CompactTreeChartModule extends AbstractModule implements ModuleChartInterf /** * Return a menu item for this chart. * - * @return Menu + * @return Menu|null */ public function getChartMenu(Individual $individual) { - global $controller, $WT_TREE; - return new Menu( $this->getTitle(), - 'compact.php?rootid=' . $individual->getXref() . '&ged=' . $WT_TREE->getNameUrl(), + 'compact.php?rootid=' . $individual->getXref() . '&ged=' . $individual->getTree()->getNameUrl(), 'menu-chart-compact', array('rel' => 'nofollow') ); } + /** + * Return a menu item for this chart - for use in individual boxes. + * + * @return Menu|null + */ public function getBoxChartMenu(Individual $individual) { return $this->getChartMenu($individual); } diff --git a/app/Module/DescendancyChartModule.php b/app/Module/DescendancyChartModule.php index cb218cbad2..7412d1047f 100644 --- a/app/Module/DescendancyChartModule.php +++ b/app/Module/DescendancyChartModule.php @@ -56,19 +56,22 @@ class DescendancyChartModule extends AbstractModule implements ModuleChartInterf /** * Return a menu item for this chart. * - * @return Menu + * @return Menu|null */ public function getChartMenu(Individual $individual) { - global $controller, $WT_TREE; - return new Menu( $this->getTitle(), - 'descendancy.php?rootid=' . $individual->getXref() . '&ged=' . $WT_TREE->getNameUrl(), + 'descendancy.php?rootid=' . $individual->getXref() . '&ged=' . $individual->getTree()->getNameUrl(), 'menu-chart-descendants', array('rel' => 'nofollow') ); } + /** + * Return a menu item for this chart - for use in individual boxes. + * + * @return Menu|null + */ public function getBoxChartMenu(Individual $individual) { return $this->getChartMenu($individual); } diff --git a/app/Module/FamilyBookChartModule.php b/app/Module/FamilyBookChartModule.php index 05b1c471c2..fd44a668b1 100644 --- a/app/Module/FamilyBookChartModule.php +++ b/app/Module/FamilyBookChartModule.php @@ -56,19 +56,22 @@ class FamilyBookChartModule extends AbstractModule implements ModuleChartInterfa /** * Return a menu item for this chart. * - * @return Menu + * @return Menu|null */ public function getChartMenu(Individual $individual) { - global $controller, $WT_TREE; - return new Menu( $this->getTitle(), - 'familybook.php?rootid=' . $individual->getXref() . '&ged=' . $WT_TREE->getNameUrl(), + 'familybook.php?rootid=' . $individual->getXref() . '&ged=' . $individual->getTree()->getNameUrl(), 'menu-chart-familybook', array('rel' => 'nofollow') ); } + /** + * Return a menu item for this chart - for use in individual boxes. + * + * @return Menu|null + */ public function getBoxChartMenu(Individual $individual) { return $this->getChartMenu($individual); } diff --git a/app/Module/FamilyTreeStatisticsModule.php b/app/Module/FamilyTreeStatisticsModule.php index 76ce7b9bd3..67a19980f9 100644 --- a/app/Module/FamilyTreeStatisticsModule.php +++ b/app/Module/FamilyTreeStatisticsModule.php @@ -20,6 +20,7 @@ use Fisharebest\Webtrees\Filter; use Fisharebest\Webtrees\Functions\FunctionsDb; use Fisharebest\Webtrees\Functions\FunctionsEdit; use Fisharebest\Webtrees\I18N; +use Fisharebest\Webtrees\Module; use Fisharebest\Webtrees\Stats; use Fisharebest\Webtrees\Theme; @@ -192,7 +193,7 @@ class FamilyTreeStatisticsModule extends AbstractModule implements ModuleBlockIn $content .= '</div>'; } $content .= '</div>'; - if ($stat_link) { + if ($stat_link && Module::isActiveChart($WT_TREE, 'statistics_chart')) { $content .= '<div class="clearfloat"><a href="statistics.php?ged=' . $WT_TREE->getNameUrl() . '" rel="nofollow"><b>' . I18N::translate('View statistics as graphs') . '</b></a></div>'; } diff --git a/app/Module/FanChartModule.php b/app/Module/FanChartModule.php index 117d9c2b13..2eb6f6a2d7 100644 --- a/app/Module/FanChartModule.php +++ b/app/Module/FanChartModule.php @@ -58,15 +58,13 @@ class FanChartModule extends AbstractModule implements ModuleChartInterface { * * We can only do this if the GD2 library is installed with TrueType support. * - * @return Menu + * @return Menu|null */ public function getChartMenu(Individual $individual) { - global $controller, $WT_TREE; - if (function_exists('imagettftext')) { return new Menu( $this->getTitle(), - 'fanchart.php?rootid=' . $individual->getXref() . '&ged=' . $WT_TREE->getNameUrl(), + 'fanchart.php?rootid=' . $individual->getXref() . '&ged=' . $individual->getTree()->getNameUrl(), 'menu-chart-fanchart', array('rel' => 'nofollow') ); @@ -75,6 +73,11 @@ class FanChartModule extends AbstractModule implements ModuleChartInterface { } } + /** + * Return a menu item for this chart - for use in individual boxes. + * + * @return Menu|null + */ public function getBoxChartMenu(Individual $individual) { return $this->getChartMenu($individual); } diff --git a/app/Module/GoogleMapsModule.php b/app/Module/GoogleMapsModule.php index be926d2023..07ffb76f07 100644 --- a/app/Module/GoogleMapsModule.php +++ b/app/Module/GoogleMapsModule.php @@ -215,19 +215,22 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface, /** * Return a menu item for this chart. * - * @return Menu + * @return Menu|null */ public function getChartMenu(Individual $individual) { - global $controller, $WT_TREE; - return new Menu( I18N::translate('Pedigree map'), - 'module.php?mod=googlemap&mod_action=pedigree_map&rootid=' . $individual->getXref() . '&ged=' . $WT_TREE->getNameUrl(), + 'module.php?mod=googlemap&mod_action=pedigree_map&rootid=' . $individual->getXref() . '&ged=' . $individual->getTree()->getNameUrl(), 'menu-chart-pedigree_map', array('rel' => 'nofollow') ); } + /** + * Return a menu item for this chart - for use in individual boxes. + * + * @return Menu|null + */ public function getBoxChartMenu(Individual $individual) { return $this->getChartMenu($individual); } diff --git a/app/Module/HourglassChartModule.php b/app/Module/HourglassChartModule.php index e6797c06c2..ffcc026235 100644 --- a/app/Module/HourglassChartModule.php +++ b/app/Module/HourglassChartModule.php @@ -56,19 +56,22 @@ class HourglassChartModule extends AbstractModule implements ModuleChartInterfac /** * Return a menu item for this chart. * - * @return Menu + * @return Menu|null */ public function getChartMenu(Individual $individual) { - global $controller, $WT_TREE; - return new Menu( $this->getTitle(), - 'hourglass.php?rootid=' . $individual->getXref() . '&ged=' . $WT_TREE->getNameUrl(), + 'hourglass.php?rootid=' . $individual->getXref() . '&ged=' . $individual->getTree()->getNameUrl(), 'menu-chart-hourglass', array('rel' => 'nofollow') ); } + /** + * Return a menu item for this chart - for use in individual boxes. + * + * @return Menu|null + */ public function getBoxChartMenu(Individual $individual) { return $this->getChartMenu($individual); } diff --git a/app/Module/InteractiveTreeModule.php b/app/Module/InteractiveTreeModule.php index c7de450c6b..e0676ca79d 100644 --- a/app/Module/InteractiveTreeModule.php +++ b/app/Module/InteractiveTreeModule.php @@ -27,7 +27,7 @@ use Fisharebest\Webtrees\Menu; * Class InteractiveTreeModule * Tip : you could change the number of generations loaded before ajax calls both in individual page and in treeview page to optimize speed and server load */ -class InteractiveTreeModule extends AbstractModule implements ModuleTabInterface,ModuleChartInterface { +class InteractiveTreeModule extends AbstractModule implements ModuleTabInterface, ModuleChartInterface { /** {@inheritdoc} */ public function getTitle() { return /* I18N: Name of a module */ I18N::translate('Interactive tree'); @@ -75,19 +75,22 @@ class InteractiveTreeModule extends AbstractModule implements ModuleTabInterface /** * Return a menu item for this chart. * - * @return Menu + * @return Menu|null */ public function getChartMenu(Individual $individual) { - global $controller, $WT_TREE; - return new Menu( $this->getTitle(), - 'module.php?mod=tree&mod_action=treeview&rootid=' . $individual->getXref() . '&ged=' . $WT_TREE->getNameUrl(), + 'module.php?mod=tree&mod_action=treeview&rootid=' . $individual->getXref() . '&ged=' . $individual->getTree()->getNameUrl(), 'menu-chart-tree', array('rel' => 'nofollow') ); } + /** + * Return a menu item for this chart - for use in individual boxes. + * + * @return Menu|null + */ public function getBoxChartMenu(Individual $individual) { return $this->getChartMenu($individual); } diff --git a/app/Module/LifespansChartModule.php b/app/Module/LifespansChartModule.php index 29dd3d3bf5..938f98d598 100644 --- a/app/Module/LifespansChartModule.php +++ b/app/Module/LifespansChartModule.php @@ -56,11 +56,9 @@ class LifespansChartModule extends AbstractModule implements ModuleChartInterfac /** * Return a menu item for this chart. * - * @return Menu + * @return Menu|null */ public function getChartMenu(Individual $individual) { - global $controller, $WT_TREE; - return new Menu( $this->getTitle(), 'lifespan.php', @@ -69,6 +67,11 @@ class LifespansChartModule extends AbstractModule implements ModuleChartInterfac ); } + /** + * Return a menu item for this chart - for use in individual boxes. + * + * @return Menu|null + */ public function getBoxChartMenu(Individual $individual) { return null; } diff --git a/app/Module/ModuleChartInterface.php b/app/Module/ModuleChartInterface.php index 2c278a1831..ab7a84ad3f 100644 --- a/app/Module/ModuleChartInterface.php +++ b/app/Module/ModuleChartInterface.php @@ -16,6 +16,7 @@ namespace Fisharebest\Webtrees\Module; use Fisharebest\Webtrees\Individual; +use Fisharebest\Webtrees\Menu; /** * Interface ModuleChartInterface - Classes and libraries for module system @@ -25,14 +26,14 @@ interface ModuleChartInterface { /** * Return a menu item for this chart. * - * @return Menu + * @return Menu|null */ public function getChartMenu(Individual $individual); - + /** * Return a menu item for this chart (for menu in individual box). * - * @return Menu or null if not applicable in box + * @return Menu|null */ public function getBoxChartMenu(Individual $individual); } diff --git a/app/Module/PedigreeChartModule.php b/app/Module/PedigreeChartModule.php index 8bc657f824..4cb86985be 100644 --- a/app/Module/PedigreeChartModule.php +++ b/app/Module/PedigreeChartModule.php @@ -56,19 +56,22 @@ class PedigreeChartModule extends AbstractModule implements ModuleChartInterface /** * Return a menu item for this chart. * - * @return Menu + * @return Menu|null */ public function getChartMenu(Individual $individual) { - global $controller, $WT_TREE; - return new Menu( $this->getTitle(), - 'pedigree.php?rootid=' . $individual->getXref() . '&ged=' . $WT_TREE->getNameUrl(), + 'pedigree.php?rootid=' . $individual->getXref() . '&ged=' . $individual->getTree()->getNameUrl(), 'menu-chart-pedigree', array('rel' => 'nofollow') ); } + /** + * Return a menu item for this chart - for use in individual boxes. + * + * @return Menu|null + */ public function getBoxChartMenu(Individual $individual) { return $this->getChartMenu($individual); } diff --git a/app/Module/RelationshipsChartModule.php b/app/Module/RelationshipsChartModule.php index 79c1c3f7ad..590aef19ac 100644 --- a/app/Module/RelationshipsChartModule.php +++ b/app/Module/RelationshipsChartModule.php @@ -52,34 +52,38 @@ class RelationshipsChartModule extends AbstractModule implements ModuleChartInte public function defaultAccessLevel() { return Auth::PRIV_PRIVATE; } - + /** * Return a menu item for this chart. * - * @return Menu + * @return Menu|null */ public function getChartMenu(Individual $individual) { - global $controller, $WT_TREE; - - $gedcomid = $WT_TREE->getUserPreference(Auth::user(), 'gedcomid'); + $tree = $individual->getTree(); + $gedcomid = $tree->getUserPreference(Auth::user(), 'gedcomid'); - if ($gedcomid && $individual->getXref()) { + if ($gedcomid) { return new Menu( - I18N::translate('Relationship to me'), - 'relationship.php?pid1=' . $gedcomid . '&pid2=' . $individual->getXref() . '&ged=' . $WT_TREE->getNameUrl(), - 'menu-chart-relationship', + I18N::translate('Relationship to me'), + 'relationship.php?pid1=' . $gedcomid . '&pid2=' . $individual->getXref() . '&ged=' . $tree->getNameUrl(), + 'menu-chart-relationship', array('rel' => 'nofollow') ); } else { return new Menu( - I18N::translate('Relationships'), - 'relationship.php?pid1=' . $individual->getXref() . '&ged=' . $WT_TREE->getNameUrl(), - 'menu-chart-relationship', + I18N::translate('Relationships'), + 'relationship.php?pid1=' . $individual->getXref() . '&ged=' . $tree->getNameUrl(), + 'menu-chart-relationship', array('rel' => 'nofollow') ); } } - + + /** + * Return a menu item for this chart - for use in individual boxes. + * + * @return Menu|null + */ public function getBoxChartMenu(Individual $individual) { return $this->getChartMenu($individual); } diff --git a/app/Module/StatisticsChartModule.php b/app/Module/StatisticsChartModule.php index d3e9c3c3ca..6e8777b794 100644 --- a/app/Module/StatisticsChartModule.php +++ b/app/Module/StatisticsChartModule.php @@ -56,19 +56,22 @@ class StatisticsChartModule extends AbstractModule implements ModuleChartInterfa /** * Return a menu item for this chart. * - * @return Menu + * @return Menu|null */ public function getChartMenu(Individual $individual) { - global $controller, $WT_TREE; - return new Menu( $this->getTitle(), - 'statistics.php?ged=' . $WT_TREE->getNameUrl(), + 'statistics.php?ged=' . $individual->getTree()->getNameUrl(), 'menu-chart-statistics', array('rel' => 'nofollow') ); } + /** + * Return a menu item for this chart - for use in individual boxes. + * + * @return Menu|null + */ public function getBoxChartMenu(Individual $individual) { return null; } diff --git a/app/Module/TimelineChartModule.php b/app/Module/TimelineChartModule.php index 286704ddf3..60ef02a9a2 100644 --- a/app/Module/TimelineChartModule.php +++ b/app/Module/TimelineChartModule.php @@ -52,23 +52,26 @@ class TimelineChartModule extends AbstractModule implements ModuleChartInterface public function defaultAccessLevel() { return Auth::PRIV_PRIVATE; } - + /** * Return a menu item for this chart. * - * @return Menu + * @return Menu|null */ public function getChartMenu(Individual $individual) { - global $controller, $WT_TREE; - return new Menu( - $this->getTitle(), - 'timeline.php?pids%5B%5D=' . $individual->getXref() . '&ged=' . $WT_TREE->getNameUrl(), - 'menu-chart-timeline', + $this->getTitle(), + 'timeline.php?pids%5B%5D=' . $individual->getXref() . '&ged=' . $individual->getTree()->getNameUrl(), + 'menu-chart-timeline', array('rel' => 'nofollow') ); } - + + /** + * Return a menu item for this chart - for use in individual boxes. + * + * @return Menu|null + */ public function getBoxChartMenu(Individual $individual) { return null; } diff --git a/app/Module/UserWelcomeModule.php b/app/Module/UserWelcomeModule.php index 1135445ada..92613b485e 100644 --- a/app/Module/UserWelcomeModule.php +++ b/app/Module/UserWelcomeModule.php @@ -17,6 +17,7 @@ namespace Fisharebest\Webtrees\Module; use Fisharebest\Webtrees\Auth; use Fisharebest\Webtrees\I18N; +use Fisharebest\Webtrees\Module; use Fisharebest\Webtrees\Theme; /** @@ -52,7 +53,7 @@ class UserWelcomeModule extends AbstractModule implements ModuleBlockInterface { $content .= '<td><a href="edituser.php"><i class="icon-mypage"></i><br>' . I18N::translate('My account') . '</a></td>'; $gedcomid = $WT_TREE->getUserPreference(Auth::user(), 'gedcomid'); - if ($gedcomid) { + if ($gedcomid && Module::isActiveChart($WT_TREE, 'pedigree_chart')) { $content .= '<td><a href="pedigree.php?rootid=' . $gedcomid . '&ged=' . $WT_TREE->getNameUrl() . '"><i class="icon-pedigree"></i><br>' . I18N::translate('My pedigree') . '</a></td>'; $content .= '<td><a href="individual.php?pid=' . $gedcomid . '&ged=' . $WT_TREE->getNameUrl() . '"><i class="icon-indis"></i><br>' . I18N::translate('My individual record') . '</a></td>'; } diff --git a/app/Module/WelcomeBlockModule.php b/app/Module/WelcomeBlockModule.php index 909ee1710e..684a6f2049 100644 --- a/app/Module/WelcomeBlockModule.php +++ b/app/Module/WelcomeBlockModule.php @@ -17,6 +17,7 @@ namespace Fisharebest\Webtrees\Module; use Fisharebest\Webtrees\Auth; use Fisharebest\Webtrees\I18N; +use Fisharebest\Webtrees\Module; use Fisharebest\Webtrees\Site; use Fisharebest\Webtrees\Theme; @@ -51,7 +52,9 @@ class WelcomeBlockModule extends AbstractModule implements ModuleBlockInterface $class = $this->getName() . '_block'; $title = $WT_TREE->getTitleHtml(); $content = '<table><tr>'; - $content .= '<td><a href="pedigree.php?rootid=' . $indi_xref . '&ged=' . $WT_TREE->getNameUrl() . '"><i class="icon-pedigree"></i><br>' . I18N::translate('Default chart') . '</a></td>'; + if (Module::isActiveChart($WT_TREE, 'pedigree_chart')) { + $content .= '<td><a href="pedigree.php?rootid=' . $indi_xref . '&ged=' . $WT_TREE->getNameUrl() . '"><i class="icon-pedigree"></i><br>' . I18N::translate('Default chart') . '</a></td>'; + } $content .= '<td><a href="individual.php?pid=' . $indi_xref . '&ged=' . $WT_TREE->getNameUrl() . '"><i class="icon-indis"></i><br>' . I18N::translate('Default individual') . '</a></td>'; if (Site::getPreference('USE_REGISTRATION_MODULE') && !Auth::check()) { $content .= '<td><a href="' . WT_LOGIN_URL . '?action=register"><i class="icon-user_add"></i><br>' . I18N::translate('Request new user account') . '</a></td>'; diff --git a/app/Theme/AbstractTheme.php b/app/Theme/AbstractTheme.php index 213adc2462..50cc9dde5f 100644 --- a/app/Theme/AbstractTheme.php +++ b/app/Theme/AbstractTheme.php @@ -29,26 +29,25 @@ use Fisharebest\Webtrees\I18N; use Fisharebest\Webtrees\Individual; use Fisharebest\Webtrees\Menu; use Fisharebest\Webtrees\Module; -use Fisharebest\Webtrees\Module\FamilyTreeFavoritesModule; -use Fisharebest\Webtrees\Module\UserFavoritesModule; -use Fisharebest\Webtrees\Site; -use Fisharebest\Webtrees\Theme; -use Fisharebest\Webtrees\Tree; -use Fisharebest\Webtrees\User; use Fisharebest\Webtrees\Module\AncestorsChartModule; use Fisharebest\Webtrees\Module\CompactTreeChartModule; use Fisharebest\Webtrees\Module\DescendancyChartModule; use Fisharebest\Webtrees\Module\FamilyBookChartModule; +use Fisharebest\Webtrees\Module\FamilyTreeFavoritesModule; use Fisharebest\Webtrees\Module\FanChartModule; -use Fisharebest\Webtrees\Module\InteractiveTreeModule; +use Fisharebest\Webtrees\Module\GoogleMapsModule; use Fisharebest\Webtrees\Module\HourglassChartModule; +use Fisharebest\Webtrees\Module\InteractiveTreeModule; use Fisharebest\Webtrees\Module\LifespansChartModule; use Fisharebest\Webtrees\Module\PedigreeChartModule; -use Fisharebest\Webtrees\Module\GoogleMapsModule; use Fisharebest\Webtrees\Module\RelationshipsChartModule; use Fisharebest\Webtrees\Module\StatisticsChartModule; use Fisharebest\Webtrees\Module\TimelineChartModule; - +use Fisharebest\Webtrees\Module\UserFavoritesModule; +use Fisharebest\Webtrees\Site; +use Fisharebest\Webtrees\Theme; +use Fisharebest\Webtrees\Tree; +use Fisharebest\Webtrees\User; /** * Common functions for all themes. @@ -339,7 +338,8 @@ abstract class AbstractTheme { if ( empty($_SERVER['HTTP_DNT']) && empty($_COOKIE['cookie']) && - (Site::getPreference('GOOGLE_ANALYTICS_ID') || Site::getPreference('PIWIK_SITE_ID') || Site::getPreference('STATCOUNTER_PROJECT_ID'))) { + (Site::getPreference('GOOGLE_ANALYTICS_ID') || Site::getPreference('PIWIK_SITE_ID') || Site::getPreference('STATCOUNTER_PROJECT_ID')) + ) { return '<div class="cookie-warning">' . I18N::translate('Cookies') . ' - ' . @@ -480,7 +480,7 @@ abstract class AbstractTheme { return '<div class="page-views">' . I18N::plural('This page has been viewed %s time.', 'This page has been viewed %s times.', $count, - '<span class="odometer">' . I18N::digits($count) . '</span>') . + '<span class="odometer">' . I18N::digits($count) . '</span>') . '</div>'; } else { return ''; @@ -746,12 +746,12 @@ abstract class AbstractTheme { } $content = '<span class="namedef name1">' . $individual->getFullName() . '</span>'; - $icons = ''; + $icons = ''; if ($individual->canShowName()) { $content = '<a href="' . $individual->getHtmlUrl() . '">' . $content . '</a>' . '<div class="namedef name1">' . $individual->getAddName() . '</div>'; - $icons = + $icons = '<div class="noprint icons">' . '<span class="iconz icon-zoomin" title="' . I18N::translate('Zoom in/out on this box.') . '"></span>' . '<div class="itr"><i class="icon-pedigree"></i><div class="popup">' . @@ -803,7 +803,7 @@ abstract class AbstractTheme { $content = '<a href="' . $individual->getHtmlUrl() . '">' . $content . '</a>' . '<div class="namedef name2">' . $individual->getAddName() . '</div>'; - $icons = + $icons = '<div class="noprint icons">' . '<span class="iconz icon-zoomin" title="' . I18N::translate('Zoom in/out on this box.') . '"></span>' . '<div class="itr"><i class="icon-pedigree"></i><div class="popup">' . @@ -948,7 +948,7 @@ abstract class AbstractTheme { * * @return Menu[] */ - protected function individualBoxMenu(Individual $individual) { + public function individualBoxMenu(Individual $individual) { $menus = array_merge( $this->individualBoxMenuCharts($individual), $this->individualBoxMenuFamilyLinks($individual) @@ -970,18 +970,14 @@ abstract class AbstractTheme { $menu = $chart->getBoxChartMenu($individual); if ($menu) { $menus[] = $menu; - } + } } - - if ($menus) { - usort($menus, function (Menu $x, Menu $y) { - return I18N::strcasecmp($x->getLabel(), $y->getLabel()); - }); - return $menus; - } else { - return null; - } + usort($menus, function (Menu $x, Menu $y) { + return I18N::strcasecmp($x->getLabel(), $y->getLabel()); + }); + + return $menus; } /** @@ -1092,7 +1088,7 @@ abstract class AbstractTheme { * * @param Individual $individual * - * @return Menu + * @return Menu|null */ protected function menuChart(Individual $individual) { $submenus = array(); @@ -1102,7 +1098,7 @@ abstract class AbstractTheme { $submenus[] = $menu; } } - + if ($submenus) { usort($submenus, function (Menu $x, Menu $y) { return I18N::strcasecmp($x->getLabel(), $y->getLabel()); @@ -1111,115 +1107,206 @@ abstract class AbstractTheme { return new Menu(I18N::translate('Charts'), '#', 'menu-chart', array('rel' => 'nofollow'), $submenus); } else { return null; - } + } } /** - * @deprecated + * Generate a menu item for the ancestors chart. + * + * @param Individual $individual + * + * @return Menu|null + * + * @deprecated */ protected function menuChartAncestors(Individual $individual) { - $chart = new AncestorsChartModule(__DIR__); - return $chart->getChartMenu($individual); + $chart = new AncestorsChartModule(WT_ROOT . WT_MODULES_DIR . 'ancestors_chart'); + + return $chart->getChartMenu($individual); } /** - * @deprecated + * Generate a menu item for the compact tree. + * + * @param Individual $individual + * + * @return Menu|null + * + * @deprecated */ protected function menuChartCompact(Individual $individual) { - $chart = new CompactTreeChartModule(__DIR__); - return $chart->getChartMenu($individual); + $chart = new CompactTreeChartModule(WT_ROOT . WT_MODULES_DIR . 'compact_tree_chart'); + + return $chart->getChartMenu($individual); } /** - * @deprecated + * Generate a menu item for the descendants chart. + * + * @param Individual $individual + * + * @return Menu|null + * + * @deprecated */ protected function menuChartDescendants(Individual $individual) { - $chart = new DescendancyChartModule(__DIR__); - return $chart->getChartMenu($individual); + $chart = new DescendancyChartModule(WT_ROOT . WT_MODULES_DIR . 'descendancy_chart'); + + return $chart->getChartMenu($individual); } /** - * @deprecated + * Generate a menu item for the family-book chart. + * + * @param Individual $individual + * + * @return Menu|null + * + * @deprecated */ protected function menuChartFamilyBook(Individual $individual) { - $chart = new FamilyBookChartModule(__DIR__); - return $chart->getChartMenu($individual); + $chart = new FamilyBookChartModule(WT_ROOT . WT_MODULES_DIR . 'family_book_chart'); + + return $chart->getChartMenu($individual); } /** - * @deprecated + * Generate a menu item for the fan chart. + * + * We can only do this if the GD2 library is installed with TrueType support. + * + * @param Individual $individual + * + * @return Menu|null + * + * @deprecated */ protected function menuChartFanChart(Individual $individual) { - $chart = new FanChartModule(__DIR__); - return $chart->getChartMenu($individual); + $chart = new FanChartModule(WT_ROOT . WT_MODULES_DIR . 'fan_chart'); + + return $chart->getChartMenu($individual); } /** - * @deprecated + * Generate a menu item for the interactive tree. + * + * @param Individual $individual + * + * @return Menu|null + * + * @deprecated */ protected function menuChartInteractiveTree(Individual $individual) { - $chart = new InteractiveTreeModule(__DIR__); - return $chart->getChartMenu($individual); + $chart = new InteractiveTreeModule(WT_ROOT . WT_MODULES_DIR . 'tree'); + + return $chart->getChartMenu($individual); } /** - * @deprecated + * Generate a menu item for the hourglass chart. + * + * @param Individual $individual + * + * @return Menu|null + * + * @deprecated */ protected function menuChartHourglass(Individual $individual) { - $chart = new HourglassChartModule(__DIR__); - return $chart->getChartMenu($individual); + $chart = new HourglassChartModule(WT_ROOT . WT_MODULES_DIR . 'hourglass_chart'); + + return $chart->getChartMenu($individual); } /** - * @deprecated + * Generate a menu item for the lifepsan chart. + * + * @param Individual $individual + * + * @return Menu|null + * + * @deprecated */ protected function menuChartLifespan(Individual $individual) { - $chart = new LifespansChartModule(__DIR__); - return $chart->getChartMenu($individual); + $chart = new LifespansChartModule(WT_ROOT . WT_MODULES_DIR . 'lifespans_chart'); + + return $chart->getChartMenu($individual); } /** - * @deprecated + * Generate a menu item for the pedigree chart. + * + * @param Individual $individual + * + * @return Menu|null + * + * @deprecated */ protected function menuChartPedigree(Individual $individual) { - $chart = new PedigreeChartModule(__DIR__); - return $chart->getChartMenu($individual); + $chart = new PedigreeChartModule(WT_ROOT . WT_MODULES_DIR . 'pedigree_chart'); + + return $chart->getChartMenu($individual); } /** - * @deprecated + * Generate a menu item for the pedigree map. + * + * @param Individual $individual + * + * @return Menu|null + * + * @deprecated */ protected function menuChartPedigreeMap(Individual $individual) { - $chart = new GoogleMapsModule(__DIR__); - return $chart->getChartMenu($individual); + $chart = new GoogleMapsModule(WT_ROOT . WT_MODULES_DIR . 'googlemap'); + + return $chart->getChartMenu($individual); } /** - * @deprecated + * Generate a menu item for the relationship chart. + * + * @param Individual $individual + * + * @return Menu|null + * + * @deprecated */ protected function menuChartRelationship(Individual $individual) { - $chart = new RelationshipsChartModule(__DIR__); - return $chart->getChartMenu($individual); + $chart = new RelationshipsChartModule(WT_ROOT . WT_MODULES_DIR . 'relationships_chart'); + + return $chart->getChartMenu($individual); } /** - * @deprecated + * Generate a menu item for the statistics charts. + * + * @return Menu|null + * + * @deprecated */ protected function menuChartStatistics() { - $chart = new StatisticsChartModule(__DIR__); - return $chart->getChartMenu(null); + $chart = new StatisticsChartModule(WT_ROOT . WT_MODULES_DIR . 'statistics_chart'); + + return $chart->getChartMenu(null); } /** - * @deprecated + * Generate a menu item for the timeline chart. + * + * @param Individual $individual + * + * @return Menu|null + * + * @deprecated */ protected function menuChartTimeline(Individual $individual) { - $chart = new TimelineChartModule(__DIR__); - return $chart->getChartMenu($individual); + $chart = new TimelineChartModule(WT_ROOT . WT_MODULES_DIR . 'timeline_chart'); + + return $chart->getChartMenu($individual); } - + /** - * Generate a menu item for the control panel (admin.php). + * Generate a menu item for the control panel. * * @return Menu|null */ @@ -1556,14 +1643,14 @@ abstract class AbstractTheme { } /** - * A link to the user's individual record (pedigree.php). + * A link to the user's individual record. * * @return Menu|null */ protected function menuMyPedigree() { $gedcomid = $this->tree->getUserPreference(Auth::user(), 'gedcomid'); - if ($gedcomid) { + if ($gedcomid && Module::isActiveChart($this->tree, 'pedigree_chart')) { $showFull = $this->tree->getPreference('PEDIGREE_FULL_DETAILS') ? 1 : 0; $showLayout = $this->tree->getPreference('PEDIGREE_LAYOUT') ? 1 : 0; @@ -1883,7 +1970,9 @@ abstract class AbstractTheme { * @return string */ protected function primaryMenuContent(array $menus) { - return implode('', array_map(function (Menu $menu) { return $menu->getMenuAsList(); }, $menus)); + return implode('', array_map(function (Menu $menu) { + return $menu->getMenuAsList(); + }, $menus)); } /** @@ -1922,7 +2011,9 @@ abstract class AbstractTheme { * @return string */ protected function secondaryMenuContent(array $menus) { - return implode('', array_map(function (Menu $menu) { return $menu->getMenuAsList(); }, $menus)); + return implode('', array_map(function (Menu $menu) { + return $menu->getMenuAsList(); + }, $menus)); } /** diff --git a/app/Theme/ThemeInterface.php b/app/Theme/ThemeInterface.php index c228ab2bc5..d0e096424e 100644 --- a/app/Theme/ThemeInterface.php +++ b/app/Theme/ThemeInterface.php @@ -197,6 +197,15 @@ interface ThemeInterface { public function init(Tree $tree = null); /** + * Links, to show in chart boxes; + * + * @param Individual $individual + * + * @return Menu[] + */ + public function individualBoxMenu(Individual $individual); + + /** * Themes menu. * * @return Menu|null diff --git a/compact.php b/compact.php index c99acb494a..4ae4f7233b 100644 --- a/compact.php +++ b/compact.php @@ -30,6 +30,7 @@ require './includes/session.php'; $controller = new CompactController; $controller + ->restrictAccess(Module::isActiveChart($WT_TREE, 'compact_tree_chart')) ->pageHeader() ->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL) ->addInlineJavascript('autocomplete();'); diff --git a/descendancy.php b/descendancy.php index 234eea1b85..09ff9cdd25 100644 --- a/descendancy.php +++ b/descendancy.php @@ -32,6 +32,7 @@ require './includes/session.php'; $controller = new DescendancyController; $controller + ->restrictAccess(Module::isActiveChart($WT_TREE, 'descendancy_chart')) ->pageHeader() ->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL) ->addInlineJavascript('autocomplete();'); diff --git a/familybook.php b/familybook.php index e7fb4d0551..a2b3d798b5 100644 --- a/familybook.php +++ b/familybook.php @@ -31,6 +31,7 @@ require './includes/session.php'; $controller = new FamilyBookController; $controller + ->restrictAccess(Module::isActiveChart($WT_TREE, 'family_book_chart')) ->pageHeader() ->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL) ->addInlineJavascript('autocomplete();'); diff --git a/fanchart.php b/fanchart.php index 1d23dc8beb..1f5b55ddc4 100644 --- a/fanchart.php +++ b/fanchart.php @@ -23,6 +23,7 @@ define('WT_SCRIPT_NAME', 'fanchart.php'); require './includes/session.php'; $controller = new FanchartController; +global $WT_TREE; if (Filter::getBool('img')) { header('Content-Type: image/png'); @@ -32,6 +33,7 @@ if (Filter::getBool('img')) { } $controller + ->restrictAccess(Module::isActiveChart($WT_TREE, 'fanchart')) ->pageHeader() ->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL) ->addInlineJavascript(' diff --git a/hourglass.php b/hourglass.php index 9f33eea545..8d69c207e6 100644 --- a/hourglass.php +++ b/hourglass.php @@ -15,6 +15,10 @@ */ namespace Fisharebest\Webtrees; +use Fisharebest\Webtrees\Controller\HourglassController; +use Fisharebest\Webtrees\Functions\FunctionsEdit; +use Fisharebest\Webtrees\Functions\FunctionsPrint; + /** * Defined in session.php * @@ -22,15 +26,12 @@ namespace Fisharebest\Webtrees; */ global $WT_TREE; -use Fisharebest\Webtrees\Controller\HourglassController; -use Fisharebest\Webtrees\Functions\FunctionsEdit; -use Fisharebest\Webtrees\Functions\FunctionsPrint; - define('WT_SCRIPT_NAME', 'hourglass.php'); require './includes/session.php'; $controller = new HourglassController; $controller + ->restrictAccess(Module::isActiveChart($WT_TREE, 'hourglass_chart')) ->pageHeader() ->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL) ->addInlineJavascript('autocomplete();') diff --git a/lifespan.php b/lifespan.php index 8a39977feb..c14fa67a79 100644 --- a/lifespan.php +++ b/lifespan.php @@ -21,8 +21,11 @@ use Fisharebest\Webtrees\Functions\FunctionsPrint; define('WT_SCRIPT_NAME', 'lifespan.php'); require './includes/session.php'; +global $WT_TREE; + $controller = new LifespanController; $controller + ->restrictAccess(Module::isActiveChart($WT_TREE, 'lifespans_chart')) ->pageHeader() ->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL); diff --git a/pedigree.php b/pedigree.php index eaa65fb286..ec4d7da85c 100644 --- a/pedigree.php +++ b/pedigree.php @@ -31,6 +31,7 @@ require './includes/session.php'; $controller = new PedigreeController; $controller + ->restrictAccess(Module::isActiveChart($WT_TREE, 'pedigree_chart')) ->pageHeader() ->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL) ->addInlineJavascript(' diff --git a/relationship.php b/relationship.php index 3530de351b..762b2ed691 100644 --- a/relationship.php +++ b/relationship.php @@ -40,6 +40,7 @@ $person1 = Individual::getInstance($pid1, $WT_TREE); $person2 = Individual::getInstance($pid2, $WT_TREE); $controller + ->restrictAccess(Module::isActiveChart($WT_TREE, 'relationships_chart')) ->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL) ->addInlineJavascript('autocomplete();'); diff --git a/statistics.php b/statistics.php index 84d4af94e3..445ddc5fc0 100644 --- a/statistics.php +++ b/statistics.php @@ -35,7 +35,9 @@ $ajax = Filter::getBool('ajax'); if (!$ajax) { $controller = new PageController; - $controller->setPageTitle(I18N::translate('Statistics')) + $controller + ->restrictAccess(Module::isActiveChart($WT_TREE, 'statistics_chart')) + ->setPageTitle(I18N::translate('Statistics')) ->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL) ->addInlineJavascript(' jQuery("#statistics_chart").css("visibility", "visible"); diff --git a/tests/app/Module/AbstractModuleTest.php b/tests/app/Module/AbstractModuleTest.php new file mode 100644 index 0000000000..0a86989108 --- /dev/null +++ b/tests/app/Module/AbstractModuleTest.php @@ -0,0 +1,34 @@ +<?php + +/** + * webtrees: online genealogy + * Copyright (C) 2016 webtrees development team + * 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 3 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, see <http://www.gnu.org/licenses/>. + */ + +/** + * Test harness for the class AbstractModule + */ +class AbstractModuleTest extends \PHPUnit_Framework_TestCase { + /** + * Prepare the environment for these tests + */ + public function setUp() { + } + + /** + * Test that the class exists + */ + public function testClassExists() { + $this->assertTrue(class_exists('\Fisharebest\Webtrees\Module\AbstractModule')); + } +} diff --git a/tests/app/Module/AncestorsChartModuleTest.php b/tests/app/Module/AncestorsChartModuleTest.php new file mode 100644 index 0000000000..dfdaefede4 --- /dev/null +++ b/tests/app/Module/AncestorsChartModuleTest.php @@ -0,0 +1,34 @@ +<?php + +/** + * webtrees: online genealogy + * Copyright (C) 2016 webtrees development team + * 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 3 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, see <http://www.gnu.org/licenses/>. + */ + +/** + * Test harness for the class AncestorsChartModule + */ +class AncestorsChartModuleTest extends \PHPUnit_Framework_TestCase { + /** + * Prepare the environment for these tests + */ + public function setUp() { + } + + /** + * Test that the class exists + */ + public function testClassExists() { + $this->assertTrue(class_exists('\Fisharebest\Webtrees\Module\AncestorsChartModule')); + } +} diff --git a/tests/app/Module/CompactTreeChartModuleTest.php b/tests/app/Module/CompactTreeChartModuleTest.php new file mode 100644 index 0000000000..dfe1595344 --- /dev/null +++ b/tests/app/Module/CompactTreeChartModuleTest.php @@ -0,0 +1,34 @@ +<?php + +/** + * webtrees: online genealogy + * Copyright (C) 2016 webtrees development team + * 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 3 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, see <http://www.gnu.org/licenses/>. + */ + +/** + * Test harness for the class CompactTreeChartModule + */ +class CompactTreeChartModuleTest extends \PHPUnit_Framework_TestCase { + /** + * Prepare the environment for these tests + */ + public function setUp() { + } + + /** + * Test that the class exists + */ + public function testClassExists() { + $this->assertTrue(class_exists('\Fisharebest\Webtrees\Module\CompactTreeChartModule')); + } +} diff --git a/tests/app/Module/DescendancyChartModuleTest.php b/tests/app/Module/DescendancyChartModuleTest.php new file mode 100644 index 0000000000..1f7a1d9309 --- /dev/null +++ b/tests/app/Module/DescendancyChartModuleTest.php @@ -0,0 +1,34 @@ +<?php + +/** + * webtrees: online genealogy + * Copyright (C) 2016 webtrees development team + * 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 3 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, see <http://www.gnu.org/licenses/>. + */ + +/** + * Test harness for the class DescendancyChartModule + */ +class DescendancyChartModuleTest extends \PHPUnit_Framework_TestCase { + /** + * Prepare the environment for these tests + */ + public function setUp() { + } + + /** + * Test that the class exists + */ + public function testClassExists() { + $this->assertTrue(class_exists('\Fisharebest\Webtrees\Module\DescendancyChartModule')); + } +} diff --git a/tests/app/Module/FamilyBookChartModuleTest.php b/tests/app/Module/FamilyBookChartModuleTest.php new file mode 100644 index 0000000000..313cc58d54 --- /dev/null +++ b/tests/app/Module/FamilyBookChartModuleTest.php @@ -0,0 +1,34 @@ +<?php + +/** + * webtrees: online genealogy + * Copyright (C) 2016 webtrees development team + * 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 3 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, see <http://www.gnu.org/licenses/>. + */ + +/** + * Test harness for the class FamilyBookChartModule + */ +class FamilyBookChartModuleTest extends \PHPUnit_Framework_TestCase { + /** + * Prepare the environment for these tests + */ + public function setUp() { + } + + /** + * Test that the class exists + */ + public function testClassExists() { + $this->assertTrue(class_exists('\Fisharebest\Webtrees\Module\FamilyBookChartModule')); + } +} diff --git a/tests/app/Module/FanChartModuleTest.php b/tests/app/Module/FanChartModuleTest.php new file mode 100644 index 0000000000..3ad008be79 --- /dev/null +++ b/tests/app/Module/FanChartModuleTest.php @@ -0,0 +1,34 @@ +<?php + +/** + * webtrees: online genealogy + * Copyright (C) 2016 webtrees development team + * 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 3 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, see <http://www.gnu.org/licenses/>. + */ + +/** + * Test harness for the class FanChartModule + */ +class FanChartModuleTest extends \PHPUnit_Framework_TestCase { + /** + * Prepare the environment for these tests + */ + public function setUp() { + } + + /** + * Test that the class exists + */ + public function testClassExists() { + $this->assertTrue(class_exists('\Fisharebest\Webtrees\Module\FanChartModule')); + } +} diff --git a/tests/app/Module/HourglassChartModuleTest.php b/tests/app/Module/HourglassChartModuleTest.php new file mode 100644 index 0000000000..db1cdced33 --- /dev/null +++ b/tests/app/Module/HourglassChartModuleTest.php @@ -0,0 +1,34 @@ +<?php + +/** + * webtrees: online genealogy + * Copyright (C) 2016 webtrees development team + * 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 3 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, see <http://www.gnu.org/licenses/>. + */ + +/** + * Test harness for the class HourglassChartModule + */ +class HourglassChartModuleTest extends \PHPUnit_Framework_TestCase { + /** + * Prepare the environment for these tests + */ + public function setUp() { + } + + /** + * Test that the class exists + */ + public function testClassExists() { + $this->assertTrue(class_exists('\Fisharebest\Webtrees\Module\HourglassChartModule')); + } +} diff --git a/tests/app/Module/LifespansChartModuleTest.php b/tests/app/Module/LifespansChartModuleTest.php new file mode 100644 index 0000000000..d470b5a8bb --- /dev/null +++ b/tests/app/Module/LifespansChartModuleTest.php @@ -0,0 +1,34 @@ +<?php + +/** + * webtrees: online genealogy + * Copyright (C) 2016 webtrees development team + * 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 3 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, see <http://www.gnu.org/licenses/>. + */ + +/** + * Test harness for the class LifespansChartModule + */ +class LifespansChartModuleTest extends \PHPUnit_Framework_TestCase { + /** + * Prepare the environment for these tests + */ + public function setUp() { + } + + /** + * Test that the class exists + */ + public function testClassExists() { + $this->assertTrue(class_exists('\Fisharebest\Webtrees\Module\LifespansChartModule')); + } +} diff --git a/tests/app/Module/LoginBlockModuleTest.php b/tests/app/Module/LoginBlockModuleTest.php new file mode 100644 index 0000000000..b016845238 --- /dev/null +++ b/tests/app/Module/LoginBlockModuleTest.php @@ -0,0 +1,34 @@ +<?php + +/** + * webtrees: online genealogy + * Copyright (C) 2016 webtrees development team + * 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 3 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, see <http://www.gnu.org/licenses/>. + */ + +/** + * Test harness for the class LoginBlockModule + */ +class LoginBlockModuleTest extends \PHPUnit_Framework_TestCase { + /** + * Prepare the environment for these tests + */ + public function setUp() { + } + + /** + * Test that the class exists + */ + public function testClassExists() { + $this->assertTrue(class_exists('\Fisharebest\Webtrees\Module\LoginBlockModule')); + } +} diff --git a/tests/app/Module/PedigreeChartModuleTest.php b/tests/app/Module/PedigreeChartModuleTest.php new file mode 100644 index 0000000000..3f5d1fb85d --- /dev/null +++ b/tests/app/Module/PedigreeChartModuleTest.php @@ -0,0 +1,34 @@ +<?php + +/** + * webtrees: online genealogy + * Copyright (C) 2016 webtrees development team + * 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 3 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, see <http://www.gnu.org/licenses/>. + */ + +/** + * Test harness for the class PedigreeChartModule + */ +class PedigreeChartModuleTest extends \PHPUnit_Framework_TestCase { + /** + * Prepare the environment for these tests + */ + public function setUp() { + } + + /** + * Test that the class exists + */ + public function testClassExists() { + $this->assertTrue(class_exists('\Fisharebest\Webtrees\Module\PedigreeChartModule')); + } +} diff --git a/tests/app/Module/RelationshipsChartModuleTest.php b/tests/app/Module/RelationshipsChartModuleTest.php new file mode 100644 index 0000000000..2d09a7961c --- /dev/null +++ b/tests/app/Module/RelationshipsChartModuleTest.php @@ -0,0 +1,34 @@ +<?php + +/** + * webtrees: online genealogy + * Copyright (C) 2016 webtrees development team + * 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 3 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, see <http://www.gnu.org/licenses/>. + */ + +/** + * Test harness for the class RelationshipsChartModule + */ +class RelationshipsChartModuleTest extends \PHPUnit_Framework_TestCase { + /** + * Prepare the environment for these tests + */ + public function setUp() { + } + + /** + * Test that the class exists + */ + public function testClassExists() { + $this->assertTrue(class_exists('\Fisharebest\Webtrees\Module\RelationshipsChartModule')); + } +} diff --git a/tests/app/Module/StatisticsChartModuleTest.php b/tests/app/Module/StatisticsChartModuleTest.php new file mode 100644 index 0000000000..d921b6b0c6 --- /dev/null +++ b/tests/app/Module/StatisticsChartModuleTest.php @@ -0,0 +1,34 @@ +<?php + +/** + * webtrees: online genealogy + * Copyright (C) 2016 webtrees development team + * 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 3 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, see <http://www.gnu.org/licenses/>. + */ + +/** + * Test harness for the class StatisticsChartModule + */ +class StatisticsChartModuleTest extends \PHPUnit_Framework_TestCase { + /** + * Prepare the environment for these tests + */ + public function setUp() { + } + + /** + * Test that the class exists + */ + public function testClassExists() { + $this->assertTrue(class_exists('\Fisharebest\Webtrees\Module\StatisticsChartModule')); + } +} diff --git a/tests/app/Module/TimelineChartModuleTest.php b/tests/app/Module/TimelineChartModuleTest.php new file mode 100644 index 0000000000..1f3191d382 --- /dev/null +++ b/tests/app/Module/TimelineChartModuleTest.php @@ -0,0 +1,34 @@ +<?php + +/** + * webtrees: online genealogy + * Copyright (C) 2016 webtrees development team + * 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 3 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, see <http://www.gnu.org/licenses/>. + */ + +/** + * Test harness for the class TimelineChartModule + */ +class TimelineChartModuleTest extends \PHPUnit_Framework_TestCase { + /** + * Prepare the environment for these tests + */ + public function setUp() { + } + + /** + * Test that the class exists + */ + public function testClassExists() { + $this->assertTrue(class_exists('\Fisharebest\Webtrees\Module\TimelineChartModule')); + } +} diff --git a/tests/app/Module/TopGivenNamesModuleTest.php b/tests/app/Module/TopGivenNamesModuleTest.php index ff7f83614e..fa028ffcf0 100644 --- a/tests/app/Module/TopGivenNamesModuleTest.php +++ b/tests/app/Module/TopGivenNamesModuleTest.php @@ -16,7 +16,7 @@ */ /** - * Test harness for the class TopGivenNamesModuleModule + * Test harness for the class TopGivenNamesModule */ class TopGivenNamesModuleTest extends \PHPUnit_Framework_TestCase { /** diff --git a/themes/clouds/css-1.7.5/style.css b/themes/clouds/css-1.7.5/style.css index 74fd9293c0..0189fc5af3 100644 --- a/themes/clouds/css-1.7.5/style.css +++ b/themes/clouds/css-1.7.5/style.css @@ -3360,11 +3360,6 @@ dd .deletelink { margin: 0; } -#fan_chart ul.children li:before { - content: "< "; - font-weight: bold; -} - #fan_chart_img { text-align: center; } diff --git a/themes/colors/css-1.7.5/style.css b/themes/colors/css-1.7.5/style.css index 2268910c15..c43a0361e6 100644 --- a/themes/colors/css-1.7.5/style.css +++ b/themes/colors/css-1.7.5/style.css @@ -3358,11 +3358,6 @@ dd .deletelink { margin: 0; } -#fan_chart ul.children li:before { - content: "< "; - font-weight: bold; -} - #fan_chart_img { text-align: center; } diff --git a/themes/fab/css-1.7.5/style.css b/themes/fab/css-1.7.5/style.css index d3ba868fa7..af28c8478f 100644 --- a/themes/fab/css-1.7.5/style.css +++ b/themes/fab/css-1.7.5/style.css @@ -3299,11 +3299,6 @@ dd .deletelink { margin: 0; } -#fan_chart ul.children li:before { - content: "< "; - font-weight: bold; -} - #fan_chart_img { text-align: center; } diff --git a/themes/minimal/css-1.7.5/style.css b/themes/minimal/css-1.7.5/style.css index 31cd03367f..b20a5257f4 100644 --- a/themes/minimal/css-1.7.5/style.css +++ b/themes/minimal/css-1.7.5/style.css @@ -3285,11 +3285,6 @@ dd .deletelink { margin: 0; } -#fan_chart ul.children li:before { - content: "< "; - font-weight: bold; -} - #fan_chart_img { text-align: center; } diff --git a/themes/webtrees/css-1.7.5/style.css b/themes/webtrees/css-1.7.5/style.css index cb05af4701..e011c94a16 100644 --- a/themes/webtrees/css-1.7.5/style.css +++ b/themes/webtrees/css-1.7.5/style.css @@ -3259,11 +3259,6 @@ dd .deletelink { margin: 0; } -#fan_chart ul.children li:before { - content: "< "; - font-weight: bold; -} - #fan_chart_img { text-align: center; } diff --git a/themes/xenea/css-1.7.5/style.css b/themes/xenea/css-1.7.5/style.css index 5650fb69e8..35a5cea805 100644 --- a/themes/xenea/css-1.7.5/style.css +++ b/themes/xenea/css-1.7.5/style.css @@ -3277,11 +3277,6 @@ dd .deletelink { margin: 0; } -#fan_chart ul.children li:before { - content: "< "; - font-weight: bold; -} - #fan_chart_img { text-align: center; } diff --git a/timeline.php b/timeline.php index 8e5cc822da..322af282d8 100644 --- a/timeline.php +++ b/timeline.php @@ -19,6 +19,8 @@ use Fisharebest\Webtrees\Controller\TimelineController; use Fisharebest\Webtrees\Functions\Functions; use Fisharebest\Webtrees\Functions\FunctionsPrint; +global $WT_TREE; + $basexoffset = 0; $baseyoffset = 0; @@ -27,6 +29,7 @@ require './includes/session.php'; $controller = new TimelineController; $controller + ->restrictAccess(Module::isActiveChart($WT_TREE, 'timeline_chart')) ->pageHeader() ->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL) ->addInlineJavascript('autocomplete();'); @@ -312,8 +315,8 @@ document.onmouseup = function () { <?php } ?> </tr> </table> - <br><a href="lifespan.php?ged=<?php echo $WT_TREE->getNameUrl(); ?>"><b><?php echo I18N::translate('Show lifespans'); ?></b></a> </form> +<br> <?php if (count($controller->people) > 0) { ?> |
