/** * get edit menu */ function getEditMenu() { if (!$this->record || $this->record->isOld()) { return null; } // edit menu $menu = new WT_Menu(WT_I18N::translate('Edit'), '#', 'menu-note'); if (WT_USER_CAN_EDIT) { $submenu = new WT_Menu(WT_I18N::translate('Edit note'), '#', 'menu-note-edit'); $submenu->addOnclick('return edit_note(\'' . $this->record->getXref() . '\');'); $menu->addSubmenu($submenu); } // delete if (WT_USER_CAN_EDIT) { $submenu = new WT_Menu(WT_I18N::translate('Delete'), '#', 'menu-note-del'); $submenu->addOnclick("return delete_note('" . WT_I18N::translate('Are you sure you want to delete “%s”?', strip_tags($this->record->getFullName())) . "', '" . $this->record->getXref() . "');"); $menu->addSubmenu($submenu); } // add to favorites if (array_key_exists('user_favorites', WT_Module::getActiveModules())) { $submenu = new WT_Menu(WT_I18N::translate('Add to favorites'), '#', 'menu-note-addfav'); $submenu->addOnclick("jQuery.post('module.php?mod=user_favorites&mod_action=menu-add-favorite',{xref:'" . $this->record->getXref() . "'},function(){location.reload();})"); $menu->addSubmenu($submenu); } //-- get the link for the first submenu and set it as the link for the main menu if (isset($menu->submenus[0])) { $link = $menu->submenus[0]->onclick; $menu->addOnclick($link); } return $menu; }
/** * get edit menu */ function getEditMenu() { $SHOW_GEDCOM_RECORD = get_gedcom_setting(WT_GED_ID, 'SHOW_GEDCOM_RECORD'); if (!$this->record || $this->record->isOld()) { return null; } // edit menu $menu = new WT_Menu(WT_I18N::translate('Edit'), '#', 'menu-obje'); if (WT_USER_CAN_EDIT) { $submenu = new WT_Menu(WT_I18N::translate('Edit media object'), '#', 'menu-obje-edit'); $submenu->addOnclick("window.open('addmedia.php?action=editmedia&pid={$this->record->getXref()}', '_blank', edit_window_specs)"); $menu->addSubmenu($submenu); // main link displayed on page if (array_key_exists('GEDFact_assistant', WT_Module::getActiveModules())) { $submenu = new WT_Menu(WT_I18N::translate('Manage links'), '#', 'menu-obje-link'); $submenu->addOnclick("return ilinkitem('" . $this->record->getXref() . "','manage');"); } else { $submenu = new WT_Menu(WT_I18N::translate('Set link'), '#', 'menu-obje-link'); $ssubmenu = new WT_Menu(WT_I18N::translate('To individual'), '#', 'menu-obje-link-indi'); $ssubmenu->addOnclick("return ilinkitem('" . $this->record->getXref() . "','person');"); $submenu->addSubMenu($ssubmenu); $ssubmenu = new WT_Menu(WT_I18N::translate('To family'), '#', 'menu-obje-link-fam'); $ssubmenu->addOnclick("return ilinkitem('" . $this->record->getXref() . "','family');"); $submenu->addSubMenu($ssubmenu); $ssubmenu = new WT_Menu(WT_I18N::translate('To source'), '#', 'menu-obje-link-sour'); $ssubmenu->addOnclick("return ilinkitem('" . $this->record->getXref() . "','source');"); $submenu->addSubMenu($ssubmenu); } $menu->addSubmenu($submenu); } // delete if (WT_USER_CAN_EDIT) { $submenu = new WT_Menu(WT_I18N::translate('Delete'), '#', 'menu-obje-del'); $submenu->addOnclick("return delete_media('" . WT_I18N::translate('Are you sure you want to delete “%s”?', strip_tags($this->record->getFullName())) . "', '" . $this->record->getXref() . "');"); $menu->addSubmenu($submenu); } // edit raw if (Auth::isAdmin() || WT_USER_CAN_EDIT && $SHOW_GEDCOM_RECORD) { $submenu = new WT_Menu(WT_I18N::translate('Edit raw GEDCOM'), '#', 'menu-obje-editraw'); $submenu->addOnclick("return edit_raw('" . $this->record->getXref() . "');"); $menu->addSubmenu($submenu); } // add to favorites if (array_key_exists('user_favorites', WT_Module::getActiveModules())) { $submenu = new WT_Menu(WT_I18N::translate('Add to favorites'), '#', 'menu-obje-addfav'); $submenu->addOnclick("jQuery.post('module.php?mod=user_favorites&mod_action=menu-add-favorite',{xref:'" . $this->record->getXref() . "'},function(){location.reload();})"); $menu->addSubmenu($submenu); } //-- get the link for the first submenu and set it as the link for the main menu if (isset($menu->submenus[0])) { $link = $menu->submenus[0]->onclick; $menu->addOnclick($link); } return $menu; }
/** * get edit menu */ function getEditMenu() { $SHOW_GEDCOM_RECORD = get_gedcom_setting(WT_GED_ID, 'SHOW_GEDCOM_RECORD'); if (!$this->record || $this->record->isOld()) { return null; } // edit menu $menu = new WT_Menu(WT_I18N::translate('Edit'), '#', 'menu-repo'); if (WT_USER_CAN_EDIT) { $fact = $this->record->getFirstFact('NAME'); $submenu = new WT_Menu(WT_I18N::translate('Edit repository'), '#', 'menu-repo-edit'); if ($fact) { // Edit existing name $submenu->addOnclick('return edit_record(\'' . $this->record->getXref() . '\', \'' . $fact->getFactId() . '\');'); } else { // Add new name $submenu->addOnclick('return add_fact(\'' . $this->record->getXref() . '\', \'NAME\');'); } $menu->addSubmenu($submenu); } // delete if (WT_USER_CAN_EDIT) { $submenu = new WT_Menu(WT_I18N::translate('Delete'), '#', 'menu-repo-del'); $submenu->addOnclick("return delete_repository('" . WT_I18N::translate('Are you sure you want to delete “%s”?', strip_tags($this->record->getFullName())) . "', '" . $this->record->getXref() . "');"); $menu->addSubmenu($submenu); } // edit raw if (Auth::isAdmin() || WT_USER_CAN_EDIT && $SHOW_GEDCOM_RECORD) { $submenu = new WT_Menu(WT_I18N::translate('Edit raw GEDCOM'), '#', 'menu-repo-editraw'); $submenu->addOnclick("return edit_raw('" . $this->record->getXref() . "');"); $menu->addSubmenu($submenu); } // add to favorites if (array_key_exists('user_favorites', WT_Module::getActiveModules())) { $submenu = new WT_Menu(WT_I18N::translate('Add to favorites'), '#', 'menu-repo-addfav'); $submenu->addOnclick("jQuery.post('module.php?mod=user_favorites&mod_action=menu-add-favorite',{xref:'" . $this->record->getXref() . "'},function(){location.reload();})"); $menu->addSubmenu($submenu); } //-- get the link for the first submenu and set it as the link for the main menu if (isset($menu->submenus[0])) { $link = $menu->submenus[0]->onclick; $menu->addOnclick($link); } return $menu; }
/** * get edit menu */ function getEditMenu() { $SHOW_GEDCOM_RECORD = get_gedcom_setting(WT_GED_ID, 'SHOW_GEDCOM_RECORD'); if (!$this->record || $this->record->isOld()) { return null; } // edit menu $menu = new WT_Menu(WT_I18N::translate('Edit'), '#', 'menu-note'); if (WT_USER_CAN_EDIT) { $submenu = new WT_Menu(WT_I18N::translate('Edit note'), '#', 'menu-note-edit'); $submenu->addOnclick('return edit_note(\'' . $this->record->getXref() . '\');'); $menu->addSubmenu($submenu); } // edit raw /* Does not currently work - NOTE records do not contain nice level 1 facts if (Auth::isAdmin() || WT_USER_CAN_EDIT && $SHOW_GEDCOM_RECORD) { $submenu = new WT_Menu(WT_I18N::translate('Edit raw GEDCOM'), '#', 'menu-note-editraw'); $submenu->addOnclick("return edit_raw('" . $this->record->getXref() . "');"); $menu->addSubmenu($submenu); } */ // delete if (WT_USER_CAN_EDIT) { $submenu = new WT_Menu(WT_I18N::translate('Delete'), '#', 'menu-note-del'); $submenu->addOnclick("return delete_note('" . WT_I18N::translate('Are you sure you want to delete “%s”?', strip_tags($this->record->getFullName())) . "', '" . $this->record->getXref() . "');"); $menu->addSubmenu($submenu); } // add to favorites if (array_key_exists('user_favorites', WT_Module::getActiveModules())) { $submenu = new WT_Menu(WT_I18N::translate('Add to favorites'), '#', 'menu-note-addfav'); $submenu->addOnclick("jQuery.post('module.php?mod=user_favorites&mod_action=menu-add-favorite',{xref:'" . $this->record->getXref() . "'},function(){location.reload();})"); $menu->addSubmenu($submenu); } //-- get the link for the first submenu and set it as the link for the main menu if (isset($menu->submenus[0])) { $link = $menu->submenus[0]->onclick; $menu->addOnclick($link); } return $menu; }
jQuery(e.target).css("visibility", "visible"); // prevent FOUC } }); '); $linked_indi = $controller->record->linkedIndividuals('NOTE'); $linked_fam = $controller->record->linkedFamilies('NOTE'); $linked_obje = $controller->record->linkedMedia('NOTE'); $linked_sour = $controller->record->linkedSources('NOTE'); $facts = array(); foreach ($controller->record->getFacts() as $fact) { if ($fact->getTag() != 'CONT') { $facts[] = $fact; } } // Legacy formatting, created by the census assistant if (array_key_exists('GEDFact_assistant', WT_Module::getActiveModules())) { $text = GEDFact_assistant_WT_Module::formatCensusNote($controller->record); } else { $text = WT_Filter::formatText($controller->record->getNote(), $WT_TREE); } ?> <div id="note-details"> <h2><?php echo $controller->record->getFullName(); ?> </h2> <div id="note-tabs"> <ul> <li> <a href="#note-edit"> <span><?php
public function configureBlock($block_id) { if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) { set_block_setting($block_id, 'gedcom', WT_Filter::post('gedcom')); set_block_setting($block_id, 'title', WT_Filter::post('title')); set_block_setting($block_id, 'html', WT_Filter::post('html')); set_block_setting($block_id, 'show_timestamp', WT_Filter::postBool('show_timestamp')); set_block_setting($block_id, 'timestamp', WT_Filter::post('timestamp')); $languages = array(); foreach (WT_I18N::installed_languages() as $code => $name) { if (WT_Filter::postBool('lang_' . $code)) { $languages[] = $code; } } set_block_setting($block_id, 'languages', implode(',', $languages)); exit; } require_once WT_ROOT . 'includes/functions/functions_edit.php'; $templates = array(WT_I18N::translate('Keyword examples') => '#getAllTagsTable#', WT_I18N::translate('Narrative description') => WT_I18N::translate('This GEDCOM (family tree) was last updated on #gedcomUpdated#. There are #totalSurnames# surnames in this family tree. The earliest recorded event is the #firstEventType# of #firstEventName# in #firstEventYear#. The most recent event is the #lastEventType# of #lastEventName# in #lastEventYear#.<br><br>If you have any comments or feedback please contact #contactWebmaster#.'), WT_I18N::translate('Statistics') => '<div class="gedcom_stats"> <span style="font-weight: bold"><a href="index.php?command=gedcom">#gedcomTitle#</a></span><br> ' . WT_I18N::translate('This family tree was last updated on %s.', '#gedcomUpdated#') . ' <table id="keywords"> <tr> <td valign="top" class="width20"> <table cellspacing="1" cellpadding="0"> <tr> <td class="facts_label">' . WT_I18N::translate('Individuals') . '</td> <td class="facts_value" align="right"><a href="indilist.php?surname_sublist=no">#totalIndividuals#</a></td> </tr> <tr> <td class="facts_label">' . WT_I18N::translate('Males') . '</td> <td class="facts_value" align="right">#totalSexMales#<br>#totalSexMalesPercentage#</td> </tr> <tr> <td class="facts_label">' . WT_I18N::translate('Females') . '</td> <td class="facts_value" align="right">#totalSexFemales#<br>#totalSexFemalesPercentage#</td> </tr> <tr> <td class="facts_label">' . WT_I18N::translate('Total surnames') . '</td> <td class="facts_value" align="right"><a href="indilist.php?show_all=yes&surname_sublist=yes&ged=' . WT_GEDURL . '">#totalSurnames#</a></td> </tr> <tr> <td class="facts_label">' . WT_I18N::translate('Families') . '</td> <td class="facts_value" align="right"><a href="famlist.php?ged=' . WT_GEDURL . '">#totalFamilies#</a></td> </tr> <tr> <td class="facts_label">' . WT_I18N::translate('Sources') . '</td> <td class="facts_value" align="right"><a href="sourcelist.php?ged=' . WT_GEDURL . '">#totalSources#</a></td> </tr> <tr> <td class="facts_label">' . WT_I18N::translate('Media objects') . '</td> <td class="facts_value" align="right"><a href="medialist.php?ged=' . WT_GEDURL . '">#totalMedia#</a></td> </tr> <tr> <td class="facts_label">' . WT_I18N::translate('Repositories') . '</td> <td class="facts_value" align="right"><a href="repolist.php?ged=' . WT_GEDURL . '">#totalRepositories#</a></td> </tr> <tr> <td class="facts_label">' . WT_I18N::translate('Total events') . '</td> <td class="facts_value" align="right">#totalEvents#</td> </tr> <tr> <td class="facts_label">' . WT_I18N::translate('Total users') . '</td> <td class="facts_value" align="right">#totalUsers#</td> </tr> </table> </td> <td><br></td> <td valign="top"> <table cellspacing="1" cellpadding="0" border="0"> <tr> <td class="facts_label">' . WT_I18N::translate('Earliest birth year') . '</td> <td class="facts_value" align="right">#firstBirthYear#</td> <td class="facts_value">#firstBirth#</td> </tr> <tr> <td class="facts_label">' . WT_I18N::translate('Latest birth year') . '</td> <td class="facts_value" align="right">#lastBirthYear#</td> <td class="facts_value">#lastBirth#</td> </tr> <tr> <td class="facts_label">' . WT_I18N::translate('Earliest death year') . '</td> <td class="facts_value" align="right">#firstDeathYear#</td> <td class="facts_value">#firstDeath#</td> </tr> <tr> <td class="facts_label">' . WT_I18N::translate('Latest death year') . '</td> <td class="facts_value" align="right">#lastDeathYear#</td> <td class="facts_value">#lastDeath#</td> </tr> <tr> <td class="facts_label">' . WT_I18N::translate('Individual who lived the longest') . '</td> <td class="facts_value" align="right">#longestLifeAge#</td> <td class="facts_value">#longestLife#</td> </tr> <tr> <td class="facts_label">' . WT_I18N::translate('Average age at death') . '</td> <td class="facts_value" align="right">#averageLifespan#</td> <td class="facts_value"></td> </tr> <tr> <td class="facts_label">' . WT_I18N::translate('Family with the most children') . '</td> <td class="facts_value" align="right">#largestFamilySize#</td> <td class="facts_value">#largestFamily#</td> </tr> <tr> <td class="facts_label">' . WT_I18N::translate('Average number of children per family') . '</td> <td class="facts_value" align="right">#averageChildren#</td> <td class="facts_value"></td> </tr> </table> </td> </tr> </table><br> <span style="font-weight: bold">' . WT_I18N::translate('Most common surnames') . '</span><br> #commonSurnames# </div>'); $title = get_block_setting($block_id, 'title'); $html = get_block_setting($block_id, 'html'); // title echo '<tr><td class="descriptionbox wrap">', WT_Gedcom_Tag::getLabel('TITL'), '</td><td class="optionbox"><input type="text" name="title" size="30" value="', WT_Filter::escapeHtml($title), '"></td></tr>'; // templates echo '<tr><td class="descriptionbox wrap">', WT_I18N::translate('Templates'), help_link('block_html_template', $this->getName()), '</td><td class="optionbox">'; // The CK editor needs lots of help to load/save data :-( if (array_key_exists('ckeditor', WT_Module::getActiveModules())) { $ckeditor_onchange = 'CKEDITOR.instances.html.setData(document.block.html.value);'; } else { $ckeditor_onchange = ''; } echo '<select name="template" onchange="document.block.html.value=document.block.template.options[document.block.template.selectedIndex].value;', $ckeditor_onchange, '">'; echo '<option value="', WT_Filter::escapeHtml($html), '">', WT_I18N::translate('Custom'), '</option>'; foreach ($templates as $title => $template) { echo '<option value="', WT_Filter::escapeHtml($template), '">', $title, '</option>'; } echo '</select></td></tr>'; // gedcom $gedcom = get_block_setting($block_id, 'gedcom'); if (count(WT_Tree::getAll()) > 1) { if ($gedcom == '__current__') { $sel_current = ' selected="selected"'; } else { $sel_current = ''; } if ($gedcom == '__default__') { $sel_default = ' selected="selected"'; } else { $sel_default = ''; } echo '<tr><td class="descriptionbox wrap">', WT_I18N::translate('Family tree'), '</td><td class="optionbox">', '<select name="gedcom">', '<option value="__current__"', $sel_current, '>', WT_I18N::translate('Current'), '</option>', '<option value="__default__"', $sel_default, '>', WT_I18N::translate('Default'), '</option>'; foreach (WT_Tree::getAll() as $tree) { if ($tree->tree_name == $gedcom) { $sel = ' selected="selected"'; } else { $sel = ''; } echo '<option value="', $tree->tree_name, '"', $sel, ' dir="auto">', $tree->tree_title_html, '</option>'; } echo '</select></td></tr>'; } // html echo '<tr><td colspan="2" class="descriptionbox">', WT_I18N::translate('Content'), help_link('block_html_content', $this->getName()), '</td></tr><tr>', '<td colspan="2" class="optionbox">'; echo '<textarea name="html" class="html-edit" rows="10" style="width:98%;">', WT_Filter::escapeHtml($html), '</textarea>'; echo '</td></tr>'; $show_timestamp = get_block_setting($block_id, 'show_timestamp', false); echo '<tr><td class="descriptionbox wrap">'; echo WT_I18N::translate('Show the date and time of update'); echo '</td><td class="optionbox">'; echo edit_field_yes_no('show_timestamp', $show_timestamp); echo '<input type="hidden" name="timestamp" value="', WT_TIMESTAMP, '">'; echo '</td></tr>'; $languages = get_block_setting($block_id, 'languages'); echo '<tr><td class="descriptionbox wrap">'; echo WT_I18N::translate('Show this block for which languages?'); echo '</td><td class="optionbox">'; echo edit_language_checkboxes('lang_', $languages); echo '</td></tr>'; }
private function edit() { require_once WT_ROOT . 'includes/functions/functions_edit.php'; if (WT_USER_CAN_EDIT) { if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) { $block_id = WT_Filter::postInteger('block_id'); if ($block_id) { WT_DB::prepare("UPDATE `##block` SET gedcom_id=?, xref=? WHERE block_id=?")->execute(array(WT_Filter::postInteger('gedcom_id'), WT_Filter::post('xref', WT_REGEX_XREF), $block_id)); } else { WT_DB::prepare("INSERT INTO `##block` (gedcom_id, xref, module_name, block_order) VALUES (?, ?, ?, ?)")->execute(array(WT_Filter::postInteger('gedcom_id'), WT_Filter::post('xref', WT_REGEX_XREF), $this->getName(), 0)); $block_id = WT_DB::getInstance()->lastInsertId(); } set_block_setting($block_id, 'title', WT_Filter::post('title')); set_block_setting($block_id, 'story_body', WT_Filter::post('story_body')); $languages = array(); foreach (WT_I18N::installed_languages() as $code => $name) { if (WT_Filter::postBool('lang_' . $code)) { $languages[] = $code; } } set_block_setting($block_id, 'languages', implode(',', $languages)); $this->config(); } else { $block_id = WT_Filter::getInteger('block_id'); $controller = new WT_Controller_Page(); if ($block_id) { $controller->setPageTitle(WT_I18N::translate('Edit story')); $title = get_block_setting($block_id, 'title'); $story_body = get_block_setting($block_id, 'story_body'); $gedcom_id = WT_DB::prepare("SELECT gedcom_id FROM `##block` WHERE block_id=?")->execute(array($block_id))->fetchOne(); $xref = WT_DB::prepare("SELECT xref FROM `##block` WHERE block_id=?")->execute(array($block_id))->fetchOne(); } else { $controller->setPageTitle(WT_I18N::translate('Add a story')); $title = ''; $story_body = ''; $gedcom_id = WT_GED_ID; $xref = WT_Filter::get('xref', WT_REGEX_XREF); } $controller->pageHeader()->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')->addInlineJavascript('autocomplete();'); if (array_key_exists('ckeditor', WT_Module::getActiveModules())) { ckeditor_WT_Module::enableEditor($controller); } echo '<form name="story" method="post" action="module.php?mod=', $this->getName(), '&mod_action=admin_edit">'; echo WT_Filter::getCsrf(); echo '<input type="hidden" name="save" value="1">'; echo '<input type="hidden" name="block_id" value="', $block_id, '">'; echo '<input type="hidden" name="gedcom_id" value="', WT_GED_ID, '">'; echo '<table id="story_module">'; echo '<tr><th>'; echo WT_I18N::translate('Story title'); echo '</th></tr><tr><td><textarea name="title" rows="1" cols="90" tabindex="2">', WT_Filter::escapeHtml($title), '</textarea></td></tr>'; echo '<tr><th>'; echo WT_I18N::translate('Story'); echo '</th></tr><tr><td>'; echo '<textarea name="story_body" class="html-edit" rows="10" cols="90" tabindex="2">', WT_Filter::escapeHtml($story_body), '</textarea>'; echo '</td></tr>'; echo '</table><table id="story_module2">'; echo '<tr>'; echo '<th>', WT_I18N::translate('Individual'), '</th>'; echo '<th>', WT_I18N::translate('Show this block for which languages?'), '</th>'; echo '</tr>'; echo '<tr>'; echo '<td class="optionbox">'; echo '<input data-autocomplete-type="INDI" type="text" name="xref" id="pid" size="4" value="' . $xref . '">'; echo print_findindi_link('pid'); if ($xref) { $person = WT_Individual::getInstance($xref); if ($person) { echo ' ', $person->format_list('span'); } } echo '</td>'; $languages = get_block_setting($block_id, 'languages'); echo '<td class="optionbox">'; echo edit_language_checkboxes('lang_', $languages); echo '</td></tr></table>'; echo '<p><input type="submit" value="', WT_I18N::translate('save'), '" tabindex="5">'; echo '</p>'; echo '</form>'; exit; } } else { header('Location: ' . WT_SERVER_NAME . WT_SCRIPT_PATH); exit; } }
public function getTabContent() { global $controller; $html = '<div id="' . $this->getName() . '_content">'; //Show Lightbox-Album header Links if (WT_USER_CAN_EDIT) { $html .= '<table class="facts_table"><tr><td class="descriptionbox rela">'; // Add a new media object if (get_gedcom_setting(WT_GED_ID, 'MEDIA_UPLOAD') >= WT_USER_ACCESS_LEVEL) { $html .= '<span><a href="#" onclick="window.open(\'addmedia.php?action=showmediaform&linktoid=' . $controller->record->getXref() . '\', \'_blank\', \'resizable=1,scrollbars=1,top=50,height=780,width=600\');return false;">'; $html .= '<img src="' . WT_CSS_URL . 'images/image_add.png" id="head_icon" class="icon" title="' . WT_I18N::translate('Add a new media object') . '" alt="' . WT_I18N::translate('Add a new media object') . '">'; $html .= WT_I18N::translate('Add a new media object'); $html .= '</a></span>'; // Link to an existing item $html .= '<span><a href="#" onclick="window.open(\'inverselink.php?linktoid=' . $controller->record->getXref() . '&linkto=person\', \'_blank\', \'resizable=1,scrollbars=1,top=50,height=300,width=450\');">'; $html .= '<img src="' . WT_CSS_URL . 'images/image_link.png" id="head_icon" class="icon" title="' . WT_I18N::translate('Link to an existing media object') . '" alt="' . WT_I18N::translate('Link to an existing media object') . '">'; $html .= WT_I18N::translate('Link to an existing media object'); $html .= '</a></span>'; } if (WT_USER_GEDCOM_ADMIN && $this->get_media()) { // Popup Reorder Media $html .= '<span><a href="#" onclick="reorder_media(\'' . $controller->record->getXref() . '\')">'; $html .= '<img src="' . WT_CSS_URL . 'images/images.png" id="head_icon" class="icon" title="' . WT_I18N::translate('Re-order media') . '" alt="' . WT_I18N::translate('Re-order media') . '">'; $html .= WT_I18N::translate('Re-order media'); $html .= '</a></span>'; } $html .= '</td></tr></table>'; } // Used when sorting media on album tab page $html .= '<table class="facts_table"><tr><td class="facts_value">'; // one-cell table - for presentation only $html .= '<ul class="album-list">'; foreach ($this->get_media() as $media) { //View Edit Menu ---------------------------------- //Get media item Notes $haystack = $media->getGedcom(); $needle = '1 NOTE'; $before = substr($haystack, 0, strpos($haystack, $needle)); $after = substr(strstr($haystack, $needle), strlen($needle)); $notes = print_fact_notes($before . $needle . $after, 1, true); // Prepare Below Thumbnail menu ---------------------------------------------------- $menu = new WT_Menu('<div style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap">' . $media->getFullName() . '</div>'); $menu->addClass('', 'submenu'); // View Notes if (strpos($media->getGedcom(), "\n1 NOTE")) { $submenu = new WT_Menu(WT_I18N::translate('View notes')); // Notes Tooltip ---------------------------------------------------- $submenu->addOnclick("modalNotes('" . WT_Filter::escapeJs($notes) . "','" . WT_I18N::translate('View notes') . "'); return false;"); $submenu->addClass("submenuitem"); $menu->addSubMenu($submenu); } //View Details $submenu = new WT_Menu(WT_I18N::translate('View details'), $media->getHtmlUrl()); $submenu->addClass("submenuitem"); $menu->addSubMenu($submenu); //View Sources $source_menu = null; foreach ($media->getFacts('SOUR') as $source_fact) { $source = $source_fact->getTarget(); if ($source && $source->canShow()) { if (!$source_menu) { // Group sources under a top level menu $source_menu = new WT_Menu(WT_I18N::translate('Sources'), '#', null, 'right', 'right'); $source_menu->addClass('submenuitem', 'submenu'); } //now add a link to the actual source as a submenu $submenu = new WT_Menu($source->getFullName(), $source->getHtmlUrl()); $submenu->addClass('submenuitem', 'submenu'); $source_menu->addSubMenu($submenu); } } if ($source_menu) { $menu->addSubMenu($source_menu); } if (WT_USER_CAN_EDIT) { // Edit Media $submenu = new WT_Menu(WT_I18N::translate('Edit media')); $submenu->addOnclick("return window.open('addmedia.php?action=editmedia&pid=" . $media->getXref() . "', '_blank', edit_window_specs);"); $submenu->addClass("submenuitem"); $menu->addSubMenu($submenu); if (Auth::isAdmin()) { // Manage Links if (array_key_exists('GEDFact_assistant', WT_Module::getActiveModules())) { $submenu = new WT_Menu(WT_I18N::translate('Manage links')); $submenu->addOnclick("return window.open('inverselink.php?mediaid=" . $media->getXref() . "&linkto=manage', '_blank', find_window_specs);"); $submenu->addClass("submenuitem"); $menu->addSubMenu($submenu); } else { $submenu = new WT_Menu(WT_I18N::translate('Set link'), '#', null, 'right', 'right'); $submenu->addClass('submenuitem', 'submenu'); $ssubmenu = new WT_Menu(WT_I18N::translate('To individual')); $ssubmenu->addOnclick("return window.open('inverselink.php?mediaid=" . $media->getXref() . "&linkto=person', '_blank', find_window_specs);"); $ssubmenu->addClass('submenuitem', 'submenu'); $submenu->addSubMenu($ssubmenu); $ssubmenu = new WT_Menu(WT_I18N::translate('To family')); $ssubmenu->addOnclick("return window.open('inverselink.php?mediaid=" . $media->getXref() . "&linkto=family', '_blank', find_window_specs);"); $ssubmenu->addClass('submenuitem', 'submenu'); $submenu->addSubMenu($ssubmenu); $ssubmenu = new WT_Menu(WT_I18N::translate('To source')); $ssubmenu->addOnclick("return window.open('inverselink.php?mediaid=" . $media->getXref() . "&linkto=source', '_blank', find_window_specs);"); $ssubmenu->addClass('submenuitem', 'submenu'); $submenu->addSubMenu($ssubmenu); $menu->addSubMenu($submenu); } // Unlink media $submenu = new WT_Menu(WT_I18N::translate('Unlink media')); $submenu->addOnclick("return unlink_media('" . WT_I18N::translate('Are you sure you want to remove links to this media object?') . "', '" . $controller->record->getXref() . "', '" . $media->getXref() . "');"); $submenu->addClass("submenuitem"); $menu->addSubMenu($submenu); } } $html .= '<li class="album-list-item">'; $html .= '<div class="album-image">' . $media->displayImage() . '</div>'; $html .= '<div class="album-title">' . $menu->getMenu() . '</div>'; $html .= '</li>'; } $html .= '</ul>'; $html .= '</td></tr></table>'; return $html; }
function media_object_info(WT_Media $media) { $xref = $media->getXref(); $gedcom = WT_Tree::getNameFromId($media->getGedcomId()); $name = $media->getFullName(); $html = '<b>' . $name . '</b>' . '<div><i>' . WT_Filter::escapeHtml($media->getNote()) . '</i></div>' . '<br>' . '<a href="' . $media->getHtmlUrl() . '">' . WT_I18N::translate('View') . '</a>'; $html .= ' - ' . '<a onclick="window.open(\'addmedia.php?action=editmedia&pid=' . $xref . '&ged=' . WT_Filter::escapeJs($gedcom) . '\', \'_blank\', edit_window_specs)" href="#">' . WT_I18N::Translate('Edit') . '</a>' . ' - ' . '<a onclick="return delete_media(\'' . WT_Filter::escapeJs(WT_I18N::translate('Are you sure you want to delete “%s”?', strip_tags($media->getFullName()))) . '\', \'' . $media->getXref() . '\', \'' . WT_Filter::escapeJs($gedcom) . '\');" href="#">' . WT_I18N::Translate('Delete') . '</a>' . ' - '; if (array_key_exists('GEDFact_assistant', WT_Module::getActiveModules())) { $html .= '<a onclick="return ilinkitem(\'' . $xref . '\', \'manage\', \'' . $gedcom . '\')" href="#">' . WT_I18N::Translate('Manage links') . '</a>'; } else { global $TEXT_DIRECTION; $classSuffix = $TEXT_DIRECTION == 'rtl' ? '_rtl' : ''; $menu = new WT_Menu(); $menu->addLabel(WT_I18N::translate('Set link')); $menu->addClass('', 'submenu'); $submenu = new WT_Menu(WT_I18N::translate('To individual')); $submenu->addClass("submenuitem" . $classSuffix); $submenu->addOnClick("return ilinkitem('{$xref}', 'person', '{$gedcom}')"); $menu->addSubMenu($submenu); $submenu = new WT_Menu(WT_I18N::translate('To family')); $submenu->addClass("submenuitem" . $classSuffix); $submenu->addOnClick("return ilinkitem('{$xref}', 'family', '{$gedcom}')"); $menu->addSubMenu($submenu); $submenu = new WT_Menu(WT_I18N::translate('To source')); $submenu->addClass("submenuitem" . $classSuffix); $submenu->addOnClick("return ilinkitem('{$xref}', 'source', '{$gedcom}')"); $menu->addSubMenu($submenu); $html .= '<div style="display:inline-block;">' . $menu->getMenu() . '</div>'; } $html .= '<br><br>'; $linked = array(); foreach ($media->linkedIndividuals('OBJE') as $link) { $linked[] = '<a href="' . $link->getHtmlUrl() . '">' . $link->getFullName() . '</a>'; } foreach ($media->linkedFamilies('OBJE') as $link) { $linked[] = '<a href="' . $link->getHtmlUrl() . '">' . $link->getFullName() . '</a>'; } foreach ($media->linkedSources('OBJE') as $link) { $linked[] = '<a href="' . $link->getHtmlUrl() . '">' . $link->getFullName() . '</a>'; } foreach ($media->linkedNotes('OBJE') as $link) { // Invalid GEDCOM - you cannot link a NOTE to an OBJE $linked[] = '<a href="' . $link->getHtmlUrl() . '">' . $link->getFullName() . '</a>'; } foreach ($media->linkedRepositories('OBJE') as $link) { // Invalid GEDCOM - you cannot link a REPO to an OBJE $linked[] = '<a href="' . $link->getHtmlUrl() . '">' . $link->getFullName() . '</a>'; } if ($linked) { $html .= '<ul>'; foreach ($linked as $link) { $html .= '<li>' . $link . '</li>'; } $html .= '</ul>'; } else { $html .= '<div class="error">' . WT_I18N::translate('This media object is not linked to any other record.') . '</div>'; } return $html; }
/** * print a note record * * @param string $text * @param int $nlevel the level of the note record * @param string $nrec the note record to print * @param bool $textOnly Don't print the "Note: " introduction * * @return boolean */ function print_note_record($text, $nlevel, $nrec, $textOnly = false) { global $WT_TREE; $text .= get_cont($nlevel, $nrec); // Check if shared note (we have already checked that it exists) if (preg_match('/^0 @(' . WT_REGEX_XREF . ')@ NOTE/', $nrec, $match)) { $note = WT_Note::getInstance($match[1]); $label = 'SHARED_NOTE'; // If Census assistant installed, allow it to format the note if (array_key_exists('GEDFact_assistant', WT_Module::getActiveModules())) { $html = GEDFact_assistant_WT_Module::formatCensusNote($note); } else { $html = WT_Filter::formatText($note->getNote(), $WT_TREE); } } else { $note = null; $label = 'NOTE'; $html = WT_Filter::formatText($text, $WT_TREE); } if ($textOnly) { return strip_tags($text); } if (strpos($text, "\n") === false) { // A one-line note? strip the block-level tags, so it displays inline return WT_Gedcom_Tag::getLabelValue($label, strip_tags($html, '<a><strong><em>')); } elseif ($WT_TREE->preference('EXPAND_NOTES')) { // A multi-line note, and we're expanding notes by default return WT_Gedcom_Tag::getLabelValue($label, $html); } else { // A multi-line note, with an expand/collapse option $element_id = Uuid::uuid4(); // NOTE: class "note-details" is (currently) used only by some third-party themes if ($note) { $first_line = '<a href="' . $note->getHtmlUrl() . '">' . $note->getFullName() . '</a>'; } else { list($first_line) = explode("\n", $text); } return '<div class="fact_NOTE"><span class="label">' . '<a href="#" onclick="expand_layer(\'' . $element_id . '\'); return false;"><i id="' . $element_id . '_img" class="icon-plus"></i></a> ' . WT_Gedcom_Tag::getLabel($label) . ':</span> ' . '<span id="' . $element_id . '-alt">' . $first_line . '</span>' . '</div>' . '<div class="note-details" id="' . $element_id . '" style="display:none">' . $html . '</div>'; } }
/** * add a new tag input field * * called for each fact to be edited on a form. * Fact level=0 means a new empty form : data are POSTed by name * else data are POSTed using arrays : * glevels[] : tag level * islink[] : tag is a link * tag[] : tag name * text[] : tag value * * @param string $tag fact record to edit (eg 2 DATE xxxxx) * @param string $upperlevel optional upper level tag (eg BIRT) * @param string $label An optional label to echo instead of the default * @param string $extra optional text to display after the input field * @param WT_Individual $person For male/female translations * * @return string */ function add_simple_tag($tag, $upperlevel = '', $label = '', $extra = null, WT_Individual $person = null) { global $tags, $emptyfacts, $main_fact, $FILE_FORM_accept, $xref, $bdm, $action; global $QUICK_REQUIRED_FACTS, $QUICK_REQUIRED_FAMFACTS, $PREFER_LEVEL2_SOURCES; $subnamefacts = array("NPFX", "GIVN", "SPFX", "SURN", "NSFX", "_MARNM_SURN"); preg_match('/^(?:(\\d+) (' . WT_REGEX_TAG . ') ?(.*))/', $tag, $match); list(, $level, $fact, $value) = $match; // element name : used to POST data if ($level == 0) { if ($upperlevel) { $element_name = $upperlevel . '_' . $fact; } else { $element_name = $fact; } // ex: OCCU } else { $element_name = "text[]"; } if ($level == 1) { $main_fact = $fact; } // element id : used by javascript functions if ($level == 0) { $element_id = $fact; } else { $element_id = $fact . Uuid::uuid4(); } if ($upperlevel) { $element_id = $upperlevel . '_' . $fact . Uuid::uuid4(); } // field value $islink = substr($value, 0, 1) === '@' && substr($value, 0, 2) != '@#'; if ($islink) { $value = trim(trim(substr($tag, strlen($fact) + 3)), " @\r"); } else { $value = trim(substr($tag, strlen($fact) + 3)); } if ($fact == 'REPO' || $fact == 'SOUR' || $fact == 'OBJE' || $fact == 'FAMC') { $islink = true; } if ($fact == 'SHARED_NOTE_EDIT' || $fact == 'SHARED_NOTE') { $islink = 1; $fact = "NOTE"; } // label echo "<tr id=\"", $element_id, "_tr\" "; if ($fact == "MAP" || ($fact == "LATI" || $fact == "LONG") && $value == '') { echo " style=\"display:none;\""; } echo " >"; if (in_array($fact, $subnamefacts) || $fact == "LATI" || $fact == "LONG") { echo "<td class=\"optionbox wrap width25\">"; } else { echo "<td class=\"descriptionbox wrap width25\">"; } if (WT_DEBUG) { echo $element_name, "<br>"; } // tag name if ($label) { echo $label; } elseif ($upperlevel) { echo WT_Gedcom_Tag::getLabel($upperlevel . ':' . $fact); } else { echo WT_Gedcom_Tag::getLabel($fact); } // help link // If using GEDFact-assistant window if ($action == "addnewnote_assisted") { // Do not print on GEDFact Assistant window } else { // Not all facts have help text. switch ($fact) { case 'FORM': if ($upperlevel != 'OBJE') { echo help_link($fact); } break; case 'NOTE': if ($islink) { echo help_link('edit_add_SHARED_NOTE'); } else { echo help_link($fact); } break; case 'NAME': if ($upperlevel != 'REPO') { echo help_link($fact); } break; case 'ASSO': case '_ASSO': // Some apps (including webtrees) use "2 _ASSO", since "2 ASSO" is not strictly valid GEDCOM if ($level == 1) { echo help_link('ASSO_1'); } else { echo help_link('ASSO_2'); } break; case 'ADDR': case 'AGNC': case 'CAUS': case 'DATE': case 'EMAI': case 'EMAIL': case 'EMAL': case '_EMAIL': case 'FAX': case 'OBJE': case 'PAGE': case 'PEDI': case 'PHON': case 'PLAC': case 'RELA': case 'RESN': case 'ROMN': case 'SEX': case 'SOUR': case 'STAT': case 'SURN': case 'TEMP': case 'TEXT': case 'TIME': case 'URL': case '_HEB': case '_PRIM': echo help_link($fact); break; } } // tag level if ($level > 0) { if ($fact == 'TEXT' && $level > 1) { echo "<input type=\"hidden\" name=\"glevels[]\" value=\"", $level - 1, "\">"; echo "<input type=\"hidden\" name=\"islink[]\" value=\"0\">"; echo "<input type=\"hidden\" name=\"tag[]\" value=\"DATA\">"; //-- leave data text[] value empty because the following TEXT line will //--- cause the DATA to be added echo "<input type=\"hidden\" name=\"text[]\" value=\"\">"; } echo "<input type=\"hidden\" name=\"glevels[]\" value=\"", $level, "\">"; echo "<input type=\"hidden\" name=\"islink[]\" value=\"", $islink, "\">"; echo "<input type=\"hidden\" name=\"tag[]\" value=\"", $fact, "\">"; } echo "</td>"; // value echo "<td class=\"optionbox wrap\">"; if (WT_DEBUG) { echo $tag, "<br>"; } // retrieve linked NOTE if ($fact == "NOTE" && $islink) { $note1 = WT_Note::getInstance($value); if ($note1) { $noterec = $note1->getGedcom(); preg_match("/{$value}/i", $noterec, $notematch); $value = $notematch[0]; } } if (in_array($fact, $emptyfacts) && ($value == '' || $value == 'Y' || $value == 'y')) { echo "<input type=\"hidden\" id=\"", $element_id, "\" name=\"", $element_name, "\" value=\"", $value, "\">"; if ($level <= 1) { echo '<input type="checkbox" '; if ($value) { echo ' checked="checked"'; } echo " onclick=\"if (this.checked) ", $element_id, ".value='Y'; else ", $element_id, ".value='';\">"; echo WT_I18N::translate('yes'); } } else { if ($fact == "TEMP") { echo select_edit_control($element_name, WT_Gedcom_Code_Temp::templeNames(), WT_I18N::translate('No temple - living ordinance'), $value); } else { if ($fact == "ADOP") { echo edit_field_adop($element_name, $value, '', $person); } else { if ($fact == "PEDI") { echo edit_field_pedi($element_name, $value, '', $person); } else { if ($fact == 'STAT') { echo select_edit_control($element_name, WT_Gedcom_Code_Stat::statusNames($upperlevel), '', $value); } else { if ($fact == 'RELA') { echo edit_field_rela($element_name, strtolower($value)); } else { if ($fact == 'QUAY') { echo select_edit_control($element_name, WT_Gedcom_Code_Quay::getValues(), '', $value); } else { if ($fact == '_WT_USER') { echo edit_field_username($element_name, $value); } else { if ($fact == 'RESN') { echo edit_field_resn($element_name, $value); } else { if ($fact == '_PRIM') { echo '<select id="', $element_id, '" name="', $element_name, '" >'; echo '<option value=""></option>'; echo '<option value="Y"'; if ($value == 'Y') { echo ' selected="selected"'; } echo '>', WT_I18N::translate('yes'), '</option>'; echo '<option value="N"'; if ($value == 'N') { echo ' selected="selected"'; } echo '>', WT_I18N::translate('no'), '</option>'; echo '</select>'; } else { if ($fact == 'SEX') { echo '<select id="', $element_id, '" name="', $element_name, '"><option value="M"'; if ($value == 'M') { echo ' selected="selected"'; } echo '>', WT_I18N::translate('Male'), '</option><option value="F"'; if ($value == 'F') { echo ' selected="selected"'; } echo '>', WT_I18N::translate('Female'), '</option><option value="U"'; if ($value == 'U' || empty($value)) { echo ' selected="selected"'; } echo '>', WT_I18N::translate_c('unknown gender', 'Unknown'), '</option></select>'; } else { if ($fact == 'TYPE' && $level == '3') { //-- Build the selector for the Media 'TYPE' Fact echo '<select name="text[]"><option selected="selected" value="" ></option>'; $selectedValue = strtolower($value); if (!array_key_exists($selectedValue, WT_Gedcom_Tag::getFileFormTypes())) { echo '<option selected="selected" value="', WT_Filter::escapeHtml($value), '" >', WT_Filter::escapeHtml($value), '</option>'; } foreach (WT_Gedcom_Tag::getFileFormTypes() as $typeName => $typeValue) { echo '<option value="', $typeName, '"'; if ($selectedValue == $typeName) { echo ' selected="selected"'; } echo '>', $typeValue, '</option>'; } echo '</select>'; } else { if ($fact == 'NAME' && $upperlevel != 'REPO' || $fact == '_MARNM') { // Populated in javascript from sub-tags echo "<input type=\"hidden\" id=\"", $element_id, "\" name=\"", $element_name, "\" onchange=\"updateTextName('", $element_id, "');\" value=\"", WT_Filter::escapeHtml($value), "\" class=\"", $fact, "\">"; echo '<span id="', $element_id, '_display" dir="auto">', WT_Filter::escapeHtml($value), '</span>'; echo ' <a href="#edit_name" onclick="convertHidden(\'', $element_id, '\'); return false;" class="icon-edit_indi" title="' . WT_I18N::translate('Edit name') . '"></a>'; } else { // textarea if ($fact == 'TEXT' || $fact == 'ADDR' || $fact == 'NOTE' && !$islink) { echo "<textarea id=\"", $element_id, "\" name=\"", $element_name, "\" dir=\"auto\">", WT_Filter::escapeHtml($value), "</textarea><br>"; } else { // text // If using GEDFact-assistant window if ($action == "addnewnote_assisted") { echo "<input type=\"text\" id=\"", $element_id, "\" name=\"", $element_name, "\" value=\"", WT_Filter::escapeHtml($value), "\" style=\"width:4.1em;\" dir=\"ltr\""; } else { echo "<input type=\"text\" id=\"", $element_id, "\" name=\"", $element_name, "\" value=\"", WT_Filter::escapeHtml($value), "\" dir=\"ltr\""; } echo " class=\"{$fact}\""; if (in_array($fact, $subnamefacts)) { echo " onblur=\"updatewholename();\" onkeyup=\"updatewholename();\""; } // Extra markup for specific fact types switch ($fact) { case 'DATE': echo " onblur=\"valid_date(this);\" onmouseout=\"valid_date(this);\""; break; case 'GIVN': echo ' autofocus data-autocomplete-type="GIVN"'; break; case 'LATI': echo " onblur=\"valid_lati_long(this, 'N', 'S');\" onmouseout=\"valid_lati_long(this, 'N', 'S');\""; break; case 'LONG': echo " onblur=\"valid_lati_long(this, 'E', 'W');\" onmouseout=\"valid_lati_long(this, 'E', 'W');\""; break; case 'NOTE': // Shared notes. Inline notes are handled elsewhere. echo ' data-autocomplete-type="NOTE"'; break; case 'OBJE': echo ' data-autocomplete-type="OBJE"'; break; case 'PLAC': echo ' data-autocomplete-type="PLAC"'; break; case 'REPO': echo ' data-autocomplete-type="REPO"'; break; case 'SOUR': echo ' data-autocomplete-type="SOUR"'; break; case 'SURN': case '_MARNM_SURN': echo ' data-autocomplete-type="SURN"'; break; } echo '>'; } $tmp_array = array('TYPE', 'TIME', 'NOTE', 'SOUR', 'REPO', 'OBJE', 'ASSO', '_ASSO', 'AGE'); // split PLAC if ($fact == 'PLAC') { echo "<div id=\"", $element_id, "_pop\" style=\"display: inline;\">"; echo print_specialchar_link($element_id), ' ', print_findplace_link($element_id); echo '<span onclick="jQuery(\'tr[id^=', $upperlevel, '_LATI],tr[id^=', $upperlevel, '_LONG],tr[id^=LATI],tr[id^=LONG]\').toggle(\'fast\'); return false;" class="icon-target" title="', WT_Gedcom_Tag::getLabel('LATI'), ' / ', WT_Gedcom_Tag::getLabel('LONG'), '"></span>'; echo '</div>'; if (array_key_exists('places_assistant', WT_Module::getActiveModules())) { places_assistant_WT_Module::setup_place_subfields($element_id); places_assistant_WT_Module::print_place_subfields($element_id); } } elseif (!in_array($fact, $tmp_array)) { echo print_specialchar_link($element_id); } } } } } } } } } } } } } } // MARRiage TYPE : hide text field and show a selection list if ($fact == 'TYPE' && $level == 2 && $tags[0] == 'MARR') { echo '<script>'; echo "document.getElementById('", $element_id, "').style.display='none'"; echo '</script>'; echo "<select id=\"", $element_id, "_sel\" onchange=\"document.getElementById('", $element_id, "').value=this.value;\" >"; foreach (array("Unknown", "Civil", "Religious", "Partners") as $key) { if ($key == "Unknown") { echo "<option value=\"\""; } else { echo "<option value=\"", $key, "\""; } $a = strtolower($key); $b = strtolower($value); if (@strpos($a, $b) !== false || @strpos($b, $a) !== false) { echo ' selected="selected"'; } $tmp = "MARR_" . strtoupper($key); echo ">", WT_Gedcom_Tag::getLabel($tmp), "</option>"; } echo "</select>"; } else { if ($fact == 'TYPE' && $level == 0) { $onchange = 'onchange="document.getElementById(\'' . $element_id . '\').value=this.value;"'; echo edit_field_name_type($element_name, $value, $onchange, $person); echo '<script>'; echo "document.getElementById('", $element_id, "').style.display='none';"; echo '</script>'; } } // popup links switch ($fact) { case 'DATE': echo print_calendar_popup($element_id); // Allow the GEDFact_assistant module to show a census-date selector if (array_key_exists('GEDFact_assistant', WT_Module::getActiveModules())) { echo GEDFact_assistant_WT_Module::censusDateSelector($action, $upperlevel, $element_id); } break; case 'FAMC': case 'FAMS': echo print_findfamily_link($element_id); break; case 'ASSO': case '_ASSO': echo print_findindi_link($element_id, $element_id . '_description'); break; case 'FILE': print_findmedia_link($element_id, "0file"); break; case 'SOUR': echo print_findsource_link($element_id, $element_id . '_description'), ' ', print_addnewsource_link($element_id); //-- checkboxes to apply '1 SOUR' to BIRT/MARR/DEAT as '2 SOUR' if ($level == 1) { echo '<br>'; if ($PREFER_LEVEL2_SOURCES === '0') { $level1_checked = ''; $level2_checked = ''; } else { if ($PREFER_LEVEL2_SOURCES === '1' || $PREFER_LEVEL2_SOURCES === true) { $level1_checked = ''; $level2_checked = ' checked="checked"'; } else { $level1_checked = ' checked="checked"'; $level2_checked = ''; } } if (strpos($bdm, 'B') !== false) { echo ' <input type="checkbox" name="SOUR_INDI" ', $level1_checked, ' value="1">'; echo WT_I18N::translate('Individual'); if (preg_match_all('/(' . WT_REGEX_TAG . ')/', $QUICK_REQUIRED_FACTS, $matches)) { foreach ($matches[1] as $match) { if (!in_array($match, explode('|', WT_EVENTS_DEAT))) { echo ' <input type="checkbox" name="SOUR_', $match, '"', $level2_checked, ' value="1">'; echo WT_Gedcom_Tag::getLabel($match); } } } } if (strpos($bdm, 'D') !== false) { if (preg_match_all('/(' . WT_REGEX_TAG . ')/', $QUICK_REQUIRED_FACTS, $matches)) { foreach ($matches[1] as $match) { if (in_array($match, explode('|', WT_EVENTS_DEAT))) { echo ' <input type="checkbox" name="SOUR_', $match, '"', $level2_checked, ' value="1">'; echo WT_Gedcom_Tag::getLabel($match); } } } } if (strpos($bdm, 'M') !== false) { echo ' <input type="checkbox" name="SOUR_FAM" ', $level1_checked, ' value="1">'; echo WT_I18N::translate('Family'); if (preg_match_all('/(' . WT_REGEX_TAG . ')/', $QUICK_REQUIRED_FAMFACTS, $matches)) { foreach ($matches[1] as $match) { echo ' <input type="checkbox" name="SOUR_', $match, '"', $level2_checked, ' value="1">'; echo WT_Gedcom_Tag::getLabel($match); } } } } break; case 'REPO': echo print_findrepository_link($element_id), ' ', print_addnewrepository_link($element_id); break; case 'NOTE': // Shared Notes Icons ======================================== if ($islink) { // Print regular Shared Note icons --------------------------- echo ' ', print_findnote_link($element_id, $element_id . '_description'), ' ', print_addnewnote_link($element_id); if ($value) { echo ' ', print_editnote_link($value); } // Allow the GEDFact_assistant module to create a formatted shared note. if (array_key_exists('GEDFact_assistant', WT_Module::getActiveModules())) { echo GEDFact_assistant_WT_Module::print_addnewnote_assisted_link($element_id, $xref, $action); } } break; case 'OBJE': echo print_findmedia_link($element_id, '1media'); if (!$value) { echo ' ', print_addnewmedia_link($element_id); $value = 'new'; } break; } echo '<div id="' . $element_id . '_description">'; // current value if ($fact == 'DATE') { $date = new WT_Date($value); echo $date->Display(false); } if ($value && $value != 'new' && $islink) { switch ($fact) { case 'ASSO': case '_ASSO': $tmp = WT_Individual::getInstance($value); if ($tmp) { echo ' ', $tmp->getFullname(); } break; case 'SOUR': $tmp = WT_Source::getInstance($value); if ($tmp) { echo ' ', $tmp->getFullname(); } break; case 'NOTE': $tmp = WT_Note::getInstance($value); if ($tmp) { echo ' ', $tmp->getFullname(); } break; case 'OBJE': $tmp = WT_Media::getInstance($value); if ($tmp) { echo ' ', $tmp->getFullname(); } break; case 'REPO': $tmp = WT_Repository::getInstance($value); if ($tmp) { echo ' ', $tmp->getFullname(); } break; } } // pastable values if ($fact == 'FORM' && $upperlevel == 'OBJE') { print_autopaste_link($element_id, $FILE_FORM_accept); } echo '</div>', $extra, '</td></tr>'; return $element_id; }
} echo '</h2>'; if ($gm_module && $gm_module->getSetting('GM_PLACE_HIERARCHY')) { $linklevels = ''; $placelevels = ''; $place_names = array(); for ($j = 0; $j < $level; $j++) { $linklevels .= '&parent[' . $j . ']=' . rawurlencode($parent[$j]); if ($parent[$j] == '') { $placelevels = ', ' . WT_I18N::translate('unknown') . $placelevels; } else { $placelevels = ', ' . $parent[$j] . $placelevels; } } $gm_module->create_map($placelevels); } elseif (array_key_exists('places_assistant', WT_Module::getActiveModules())) { // Places Assistant is a custom/add-on module that was once part of the core code. places_assistant_WT_Module::display_map($level, $parent); } // -- echo the array foreach ($child_places as $n => $child_place) { if ($n == 0) { echo '<table id="place_hierarchy" class="list_table"><tr><td class="list_label" '; if ($numfound > 20) { echo 'colspan="3"'; } elseif ($numfound > 4) { echo 'colspan="2"'; } echo '><i class="icon-place"></i> '; if ($place_id) { echo WT_I18N::translate('Places in %s', $place->getPlaceName());
private function edit() { require_once WT_ROOT . 'includes/functions/functions_edit.php'; if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) { $block_id = WT_Filter::postInteger('block_id'); if ($block_id) { WT_DB::prepare("UPDATE `##block` SET gedcom_id=NULLIF(?, '0'), block_order=? WHERE block_id=?")->execute(array(WT_Filter::postInteger('gedcom_id'), WT_Filter::postInteger('block_order'), $block_id)); } else { WT_DB::prepare("INSERT INTO `##block` (gedcom_id, module_name, block_order) VALUES (NULLIF(?, '0'), ?, ?)")->execute(array(WT_Filter::postInteger('gedcom_id'), $this->getName(), WT_Filter::postInteger('block_order'))); $block_id = WT_DB::getInstance()->lastInsertId(); } set_block_setting($block_id, 'header', WT_Filter::post('header')); set_block_setting($block_id, 'faqbody', WT_Filter::post('faqbody')); $languages = array(); foreach (WT_I18N::installed_languages() as $code => $name) { if (WT_Filter::postBool('lang_' . $code)) { $languages[] = $code; } } set_block_setting($block_id, 'languages', implode(',', $languages)); $this->config(); } else { $block_id = WT_Filter::getInteger('block_id'); $controller = new WT_Controller_Page(); if ($block_id) { $controller->setPageTitle(WT_I18N::translate('Edit FAQ item')); $header = get_block_setting($block_id, 'header'); $faqbody = get_block_setting($block_id, 'faqbody'); $block_order = WT_DB::prepare("SELECT block_order FROM `##block` WHERE block_id=?")->execute(array($block_id))->fetchOne(); $gedcom_id = WT_DB::prepare("SELECT gedcom_id FROM `##block` WHERE block_id=?")->execute(array($block_id))->fetchOne(); } else { $controller->setPageTitle(WT_I18N::translate('Add an FAQ item')); $header = ''; $faqbody = ''; $block_order = WT_DB::prepare("SELECT IFNULL(MAX(block_order)+1, 0) FROM `##block` WHERE module_name=?")->execute(array($this->getName()))->fetchOne(); $gedcom_id = WT_GED_ID; } $controller->pageHeader(); if (array_key_exists('ckeditor', WT_Module::getActiveModules())) { ckeditor_WT_Module::enableEditor($controller); } // "Help for this page" link echo '<div id="page_help">', help_link('add_faq_item', $this->getName()), '</div>'; echo '<form name="faq" method="post" action="module.php?mod=', $this->getName(), '&mod_action=admin_edit">'; echo WT_Filter::getCsrf(); echo '<input type="hidden" name="save" value="1">'; echo '<input type="hidden" name="block_id" value="', $block_id, '">'; echo '<table id="faq_module">'; echo '<tr><th>'; echo WT_I18N::translate('Question'); echo '</th></tr><tr><td><input type="text" name="header" size="90" tabindex="1" value="' . WT_Filter::escapeHtml($header) . '"></td></tr>'; echo '<tr><th>'; echo WT_I18N::translate('Answer'); echo '</th></tr><tr><td>'; echo '<textarea name="faqbody" class="html-edit" rows="10" cols="90" tabindex="2">', WT_Filter::escapeHtml($faqbody), '</textarea>'; echo '</td></tr>'; echo '</table><table id="faq_module2">'; echo '<tr>'; echo '<th>', WT_I18N::translate('Show this block for which languages?'), '</th>'; echo '<th>', WT_I18N::translate('FAQ position'), help_link('add_faq_order', $this->getName()), '</th>'; echo '<th>', WT_I18N::translate('FAQ visibility'), help_link('add_faq_visibility', $this->getName()), '</th>'; echo '</tr><tr>'; echo '<td>'; $languages = get_block_setting($block_id, 'languages'); echo edit_language_checkboxes('lang_', $languages); echo '</td><td>'; echo '<input type="text" name="block_order" size="3" tabindex="3" value="', $block_order, '"></td>'; echo '</td><td>'; echo select_edit_control('gedcom_id', WT_Tree::getIdList(), WT_I18N::translate('All'), $gedcom_id, 'tabindex="4"'); echo '</td></tr>'; echo '</table>'; echo '<p><input type="submit" value="', WT_I18N::translate('save'), '" tabindex="5">'; echo '</form>'; exit; } }
// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA use WT\Auth; define('WT_SCRIPT_NAME', 'inverselink.php'); require './includes/session.php'; require WT_ROOT . 'includes/functions/functions_edit.php'; $controller = new WT_Controller_Simple(); $controller->restrictAccess(Auth::isEditor())->setPageTitle(WT_I18N::translate('Link to an existing media object'))->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')->addInlineJavascript('autocomplete();')->pageHeader(); //-- page parameters and checking $linktoid = WT_Filter::get('linktoid', WT_REGEX_XREF); $mediaid = WT_Filter::get('mediaid', WT_REGEX_XREF); $linkto = WT_Filter::get('linkto', 'person|source|family|manage|repository|note'); $action = WT_Filter::get('action', 'choose|update', 'choose'); // If GedFAct_assistant/_MEDIA/ installed ====================== if ($linkto == 'manage' && array_key_exists('GEDFact_assistant', WT_Module::getActiveModules())) { require WT_ROOT . WT_MODULES_DIR . 'GEDFact_assistant/_MEDIA/media_0_inverselink.php'; } else { //-- check for admin $paramok = true; if (!empty($linktoid)) { $paramok = WT_GedcomRecord::getInstance($linktoid)->canShow(); } if ($action == "choose" && $paramok) { echo '<form name="link" method="get" action="inverselink.php">'; echo '<input type="hidden" name="action" value="update">'; if (!empty($mediaid)) { echo '<input type="hidden" name="mediaid" value="', $mediaid, '">'; } if (!empty($linktoid)) { echo '<input type="hidden" name="linktoid" value="', $linktoid, '">';
/** * get edit menu */ function getEditMenu() { $SHOW_GEDCOM_RECORD = get_gedcom_setting(WT_GED_ID, 'SHOW_GEDCOM_RECORD'); if (!$this->record || $this->record->isOld()) { return null; } // edit menu $menu = new WT_Menu(WT_I18N::translate('Edit'), '#', 'menu-fam'); $menu->addLabel($menu->label, 'down'); if (WT_USER_CAN_EDIT) { // edit_fam / members $submenu = new WT_Menu(WT_I18N::translate('Change family members'), '#', 'menu-fam-change'); $submenu->addOnclick("return change_family_members('" . $this->record->getXref() . "');"); $menu->addSubmenu($submenu); // edit_fam / add child $submenu = new WT_Menu(WT_I18N::translate('Add a child to this family'), '#', 'menu-fam-addchil'); $submenu->addOnclick("return add_child_to_family('" . $this->record->getXref() . "', 'U');"); $menu->addSubmenu($submenu); // edit_fam / reorder_children if ($this->record->getNumberOfChildren() > 1) { $submenu = new WT_Menu(WT_I18N::translate('Re-order children'), '#', 'menu-fam-orderchil'); $submenu->addOnclick("return reorder_children('" . $this->record->getXref() . "');"); $menu->addSubmenu($submenu); } } // delete if (WT_USER_CAN_EDIT) { $submenu = new WT_Menu(WT_I18N::translate('Delete'), '#', 'menu-fam-del'); $submenu->addOnclick("return delete_family('" . WT_I18N::translate('Deleting the family will unlink all of the individuals from each other but will leave the individuals in place. Are you sure you want to delete this family?') . "', '" . $this->record->getXref() . "');"); $menu->addSubmenu($submenu); } // edit raw if (Auth::isAdmin() || WT_USER_CAN_EDIT && $SHOW_GEDCOM_RECORD) { $submenu = new WT_Menu(WT_I18N::translate('Edit raw GEDCOM'), '#', 'menu-fam-editraw'); $submenu->addOnclick("return edit_raw('" . $this->record->getXref() . "');"); $menu->addSubmenu($submenu); } // add to favorites if (array_key_exists('user_favorites', WT_Module::getActiveModules())) { $submenu = new WT_Menu(WT_I18N::translate('Add to favorites'), '#', 'menu-fam-addfav'); $submenu->addOnclick("jQuery.post('module.php?mod=user_favorites&mod_action=menu-add-favorite',{xref:'" . $this->record->getXref() . "'},function(){location.reload();})"); $menu->addSubmenu($submenu); } //-- get the link for the first submenu and set it as the link for the main menu if (isset($menu->submenus[0])) { $link = $menu->submenus[0]->onclick; $menu->addOnclick($link); } return $menu; }
public function createMap($placelevels) { global $level, $levelm, $plzoom, $controller; // *** ENABLE STREETVIEW *** (boolean) ========================================================= $STREETVIEW = $this->getSetting('GM_USE_STREETVIEW'); // ============================================================================================= $parent = WT_Filter::get('parent'); // create the map echo '<table style="margin:20px auto 0 auto;"><tr valign="top"><td>'; //<!-- start of map display --> echo '<table><tr valign="top">'; echo '<td class="center" width="200px">'; $levelm = $this->set_levelm($level, $parent); $latlng = WT_DB::prepare("SELECT pl_place, pl_id, pl_lati, pl_long, pl_zoom, sv_long, sv_lati, sv_bearing, sv_elevation, sv_zoom FROM `##placelocation` WHERE pl_id=?")->execute(array($levelm))->fetch(PDO::FETCH_ASSOC); if ($STREETVIEW && $level != 0) { echo '<div id="place_map" style="margin-top:20px; border:1px solid gray; width: ', $this->getSetting('GM_PH_XSIZE'), 'px; height: ', $this->getSetting('GM_PH_YSIZE'), 'px; '; } else { echo '<div id="place_map" style="border:1px solid gray; width:', $this->getSetting('GM_PH_XSIZE'), 'px; height:', $this->getSetting('GM_PH_YSIZE'), 'px; '; } echo "\"><i class=\"icon-loading-large\"></i></div>"; echo '<script src="', $this->googleMapsScript(), '"></script>'; echo '</td>'; $plzoom = $latlng['pl_zoom']; // Map zoom level if (Auth::isAdmin()) { $placecheck_url = 'module.php?mod=googlemap&mod_action=admin_placecheck'; if ($parent && isset($parent[0])) { $placecheck_url .= '&country=' . $parent[0]; if (isset($parent[1])) { $placecheck_url .= '&state=' . $parent[1]; } } $adminplaces_url = 'module.php?mod=googlemap&mod_action=admin_places'; if ($latlng && isset($latlng['pl_id'])) { $adminplaces_url .= '&parent=' . $latlng['pl_id']; } echo '</tr><tr><td>'; echo '<a href="module.php?mod=googlemap&mod_action=admin_config">', WT_I18N::translate('Google Maps™ preferences'), '</a>'; echo ' | '; echo '<a href="' . $adminplaces_url . '">', WT_I18N::translate('Geographic data'), '</a>'; echo ' | '; echo '<a href="' . $placecheck_url . '">', WT_I18N::translate('Place check'), '</a>'; if (array_key_exists('batch_update', WT_Module::getActiveModules())) { $placelevels = preg_replace('/, ' . WT_I18N::translate('unknown') . '/', ', ', $placelevels); // replace ", unknown" with ", " $placelevels = substr($placelevels, 2); // remove the leading ", " if ($placelevels) { $batchupdate_url = 'module.php?mod=batch_update&mod_action=admin_batch_update&plugin=search_replace_bu_plugin&method=exact&ged=' . WT_GEDCOM . '&search=' . urlencode($placelevels); // exact match echo ' | '; echo '<a href="' . $batchupdate_url . '">', WT_I18N::translate('Batch update'), '</a>'; } } } echo '</td></tr></table>'; echo '</td>'; echo '<td style="margin-left:15px; float:right;">'; if ($STREETVIEW) { $controller->addInlineJavascript(' function update_sv_params(placeid) { var svlati = document.getElementById("sv_latiText").value.slice(0, -1); var svlong = document.getElementById("sv_longText").value.slice(0, -1); var svbear = document.getElementById("sv_bearText").value.slice(0, -1); var svelev = document.getElementById("sv_elevText").value.slice(0, -1); var svzoom = document.getElementById("sv_zoomText").value; win03 = window.open("module.php?mod=googlemap&mod_action=places_edit&action=update_sv_params&placeid="+placeid+"&svlati="+svlati+"&svlong="+svlong+"&svbear="+svbear+"&svelev="+svelev+"&svzoom="+svzoom, "win03", indx_window_specs); if (window.focus) {win03.focus();} } '); global $pl_lati, $pl_long; if ($level >= 1) { $pl_lati = str_replace(array('N', 'S', ','), array('', '-', '.'), $latlng['pl_lati']); // WT_placelocation lati $pl_long = str_replace(array('E', 'W', ','), array('', '-', '.'), $latlng['pl_long']); // WT_placelocation long // Check if Streetview location parameters are stored in database $placeid = $latlng['pl_id']; // Placelocation place id $sv_lat = $latlng['sv_lati']; // StreetView Point of View Latitude $sv_lng = $latlng['sv_long']; // StreetView Point of View Longitude $sv_dir = $latlng['sv_bearing']; // StreetView Point of View Direction (degrees from North) $sv_pitch = $latlng['sv_elevation']; // StreetView Point of View Elevation (+90 to -90 degrees (+=down, -=up) $sv_zoom = $latlng['sv_zoom']; // StreetView Point of View Zoom (0, 1, 2 or 3) // Check if Street View Lati/Long are the default of 0 or null, if so use regular Place Lati/Long to set an initial location for the panda ------------ if ($latlng['sv_lati'] == null && $latlng['sv_long'] == null || $latlng['sv_lati'] == 0 && $latlng['sv_long'] == 0) { $sv_lat = $pl_lati; $sv_lng = $pl_long; } // Set Street View parameters to numeric value if NULL (avoids problem with Google Street View™ Pane not rendering) if ($sv_dir == null) { $sv_dir = 0; } if ($sv_pitch == null) { $sv_pitch = 0; } if ($sv_zoom == null) { $sv_zoom = 1; } ?> <div> <iframe style="background: transparent; margin-top: -3px; margin-left: 2px; width: 530px; height: 405px; padding: 0; border: 0;" src="module.php?mod=googlemap&mod_action=wt_street_view&x=<?php echo $sv_lng; ?> &y=<?php echo $sv_lat; ?> &z=18&t=2&c=1&s=1&b=<?php echo $sv_dir; ?> &p=<?php echo $sv_pitch; ?> &m=<?php echo $sv_zoom; ?> &j=1&k=1&v=1" marginwidth="0" marginheight="0" frameborder="0" scrolling="no"></iframe> </div> <?php $list_latlon = WT_Gedcom_Tag::getLabel('LATI') . "<input name='sv_latiText' id='sv_latiText' type='text' style='width:42px; background:none; border:none;' value='" . $sv_lat . "'>" . WT_Gedcom_Tag::getLabel('LONG') . "<input name='sv_longText' id='sv_longText' type='text' style='width:42px; background:none; border:none;' value='" . $sv_lng . "'>" . WT_I18N::translate('Bearing') . "<input name='sv_bearText' id='sv_bearText' type='text' style='width:46px; background:none; border:none;' value='" . $sv_dir . "'>" . WT_I18N::translate('Elevation') . "<input name='sv_elevText' id='sv_elevText' type='text' style='width:30px; background:none; border:none;' value='" . $sv_pitch . "'>" . WT_I18N::translate('Zoom') . "<input name='sv_zoomText' id='sv_zoomText' type='text' style='width:30px; background:none; border:none;' value='" . $sv_zoom . "'>\n\t\t\t\t"; if (Auth::isAdmin()) { echo "<table align=\"center\" style=\"margin-left:6px; border:solid 1px black; width:522px; margin-top:-28px; background:#cccccc; \">"; } else { echo "<table align=\"center\" style=\"display:none; \">"; } echo "<tr><td>"; echo "<form style=\"text-align:left; margin-left:5px; font:11px verdana; color:blue;\" method=\"post\" action=\"\">"; echo $list_latlon; echo "<input type=\"submit\" name=\"Submit\" onclick=\"update_sv_params({$placeid});\" value=\"", WT_I18N::translate('save'), "\">"; echo "</form>"; echo "</td></tr>"; echo "</table>"; } // Next line puts Place hierarchy on new row ----- echo '</td></tr><tr>'; } // End Streetview window =================================================================== }
/** * Generate both the HTML and PNG components of the fan chart * * The HTML and PNG components both require the same co-ordinate calculations, * so we generate them using the same code, but we send them in separate * HTTP requests. * * @param string $what "png" or "html" * @param string[] $fanChart Presentation parameters, provided by the theme. * * @return string */ public function generate_fan_chart($what, $fanChart) { $treeid = ancestry_array($this->root->getXref(), $this->generations); $fanw = 640 * $this->fan_width / 100; $fandeg = 90 * $this->fan_style; $html = ''; $treesize = count($treeid); // generations count $gen = log($treesize) / log(2) - 1; $sosa = $treesize - 1; // fan size if ($fandeg == 0) { $fandeg = 360; } $fandeg = min($fandeg, 360); $fandeg = max($fandeg, 90); $cx = $fanw / 2 - 1; // center x $cy = $cx; // center y $rx = $fanw - 1; $rw = $fanw / ($gen + 1); $fanh = $fanw; // fan height if ($fandeg == 180) { $fanh = round($fanh * ($gen + 1) / ($gen * 2)); } if ($fandeg == 270) { $fanh = round($fanh * 0.86); } $scale = $fanw / 640; // image init $image = ImageCreate($fanw, $fanh); $white = ImageColorAllocate($image, 0xff, 0xff, 0xff); ImageFilledRectangle($image, 0, 0, $fanw, $fanh, $white); ImageColorTransparent($image, $white); $color = ImageColorAllocate($image, hexdec(substr($fanChart['color'], 1, 2)), hexdec(substr($fanChart['color'], 3, 2)), hexdec(substr($fanChart['color'], 5, 2))); $bgcolor = ImageColorAllocate($image, hexdec(substr($fanChart['bgColor'], 1, 2)), hexdec(substr($fanChart['bgColor'], 3, 2)), hexdec(substr($fanChart['bgColor'], 5, 2))); $bgcolorM = ImageColorAllocate($image, hexdec(substr($fanChart['bgMColor'], 1, 2)), hexdec(substr($fanChart['bgMColor'], 3, 2)), hexdec(substr($fanChart['bgMColor'], 5, 2))); $bgcolorF = ImageColorAllocate($image, hexdec(substr($fanChart['bgFColor'], 1, 2)), hexdec(substr($fanChart['bgFColor'], 3, 2)), hexdec(substr($fanChart['bgFColor'], 5, 2))); // imagemap $imagemap = '<map id="fanmap" name="fanmap">'; // loop to create fan cells while ($gen >= 0) { // clean current generation area $deg2 = 360 + ($fandeg - 180) / 2; $deg1 = $deg2 - $fandeg; ImageFilledArc($image, $cx, $cy, $rx, $rx, $deg1, $deg2, $bgcolor, IMG_ARC_PIE); $rx -= 3; // calculate new angle $p2 = pow(2, $gen); $angle = $fandeg / $p2; $deg2 = 360 + ($fandeg - 180) / 2; $deg1 = $deg2 - $angle; // special case for rootid cell if ($gen == 0) { $deg1 = 90; $deg2 = 360 + $deg1; } // draw each cell while ($sosa >= $p2) { $pid = $treeid[$sosa]; $person = WT_Individual::getInstance($pid); if ($person) { $name = $person->getFullName(); $addname = $person->getAddName(); $text = WT_I18N::reverseText($name); if ($addname) { $text .= "\n" . WT_I18N::reverseText($addname); } $text .= "\n" . WT_I18N::reverseText($person->getLifeSpan()); switch ($person->getSex()) { case 'M': $bg = $bgcolorM; break; case 'F': $bg = $bgcolorF; break; case 'U': $bg = $bgcolor; break; } ImageFilledArc($image, $cx, $cy, $rx, $rx, $deg1, $deg2, $bg, IMG_ARC_PIE); // split and center text by lines $wmax = (int) ($angle * 7 / $fanChart['size'] * $scale); $wmax = min($wmax, 35 * $scale); if ($gen == 0) { $wmax = min($wmax, 17 * $scale); } $text = $this->split_align_text($text, $wmax); // text angle $tangle = 270 - ($deg1 + $angle / 2); if ($gen == 0) { $tangle = 0; } // calculate text position $deg = $deg1 + 0.44; if ($deg2 - $deg1 > 40) { $deg = $deg1 + ($deg2 - $deg1) / 11; } if ($deg2 - $deg1 > 80) { $deg = $deg1 + ($deg2 - $deg1) / 7; } if ($deg2 - $deg1 > 140) { $deg = $deg1 + ($deg2 - $deg1) / 4; } if ($gen == 0) { $deg = 180; } $rad = deg2rad($deg); $mr = ($rx - $rw / 4) / 2; if ($gen > 0 && $deg2 - $deg1 > 80) { $mr = $rx / 2; } $tx = $cx + $mr * cos($rad); $ty = $cy - $mr * -sin($rad); if ($sosa == 1) { $ty -= $mr / 2; } // print text ImageTtfText($image, (double) $fanChart['size'], $tangle, $tx, $ty, $color, $fanChart['font'], $text); $imagemap .= '<area shape="poly" coords="'; // plot upper points $mr = $rx / 2; $deg = $deg1; while ($deg <= $deg2) { $rad = deg2rad($deg); $tx = round($cx + $mr * cos($rad)); $ty = round($cy - $mr * -sin($rad)); $imagemap .= "{$tx},{$ty},"; $deg += ($deg2 - $deg1) / 6; } // plot lower points $mr = ($rx - $rw) / 2; $deg = $deg2; while ($deg >= $deg1) { $rad = deg2rad($deg); $tx = round($cx + $mr * cos($rad)); $ty = round($cy - $mr * -sin($rad)); $imagemap .= "{$tx},{$ty},"; $deg -= ($deg2 - $deg1) / 6; } // join first point $mr = $rx / 2; $deg = $deg1; $rad = deg2rad($deg); $tx = round($cx + $mr * cos($rad)); $ty = round($cy - $mr * -sin($rad)); $imagemap .= "{$tx},{$ty}"; // add action url $imagemap .= '" href="#' . $pid . '"'; $tempURL = 'fanchart.php?rootid=' . $pid . '&generations=' . $this->generations . '&fan_width=' . $this->fan_width . '&fan_style=' . $this->fan_style . '&ged=' . WT_GEDURL; $html .= '<div id="' . $pid . '" class="fan_chart_menu">'; $html .= '<div class="person_box"><div class="details1">'; $html .= '<a href="' . $person->getHtmlUrl() . '" class="name1">' . $name; if ($addname) { $html .= $addname; } $html .= '</a>'; $html .= '<ul class="charts">'; $html .= "<li><a href=\"pedigree.php?rootid={$pid}&amp;ged=" . WT_GEDURL . "\" >" . WT_I18N::translate('Pedigree') . "</a></li>"; if (array_key_exists('googlemap', WT_Module::getActiveModules())) { $html .= "<li><a href=\"module.php?mod=googlemap&mod_action=pedigree_map&rootid=" . $pid . "&ged=" . WT_GEDURL . "\">" . WT_I18N::translate('Pedigree map') . "</a></li>"; } if (WT_USER_GEDCOM_ID && WT_USER_GEDCOM_ID != $pid) { $html .= "<li><a href=\"relationship.php?pid1=" . WT_USER_GEDCOM_ID . "&pid2={$pid}&ged=" . WT_GEDURL . "\">" . WT_I18N::translate('Relationship to me') . "</a></li>"; } $html .= "<li><a href=\"descendancy.php?rootid={$pid}&ged=" . WT_GEDURL . "\" >" . WT_I18N::translate('Descendants') . "</a></li>"; $html .= "<li><a href=\"ancestry.php?rootid={$pid}&ged=" . WT_GEDURL . "\">" . WT_I18N::translate('Ancestors') . "</a></li>"; $html .= "<li><a href=\"compact.php?rootid={$pid}&ged=" . WT_GEDURL . "\">" . WT_I18N::translate('Compact tree') . "</a></li>"; $html .= "<li><a href=\"" . $tempURL . "\">" . WT_I18N::translate('Fan chart') . "</a></li>"; $html .= "<li><a href=\"hourglass.php?rootid={$pid}&ged=" . WT_GEDURL . "\">" . WT_I18N::translate('Hourglass chart') . "</a></li>"; if (array_key_exists('tree', WT_Module::getActiveModules())) { $html .= '<li><a href="module.php?mod=tree&mod_action=treeview&ged=' . WT_GEDURL . '&rootid=' . $pid . '">' . WT_I18N::translate('Interactive tree') . '</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">' . WT_I18N::plural('Sibling', 'Siblings', count($children) - 1) . '</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()) . '">'; } $deg1 -= $angle; $deg2 -= $angle; $sosa--; } $rx -= $rw; $gen--; } $imagemap .= '</map>'; switch ($what) { case 'html': $image_title = WT_I18N::translate('Fan chart of %s', strip_tags($person->getFullName())); return $html . $imagemap . '<div id="fan_chart_img"><img src="' . WT_SCRIPT_NAME . '?rootid=' . $this->rootid . '&fan_style=' . $this->fan_style . '&generations=' . $this->generations . '&fan_width=' . $this->fan_width . '&img=1" width="' . $fanw . '" height="' . $fanh . '" alt="' . $image_title . '" title="' . $image_title . '" usemap="#fanmap"></div>'; case 'png': header('Content-Type: image/png'); ImageStringUp($image, 1, $fanw - 10, $fanh / 3, WT_SERVER_NAME . WT_SCRIPT_PATH, $color); ImagePng($image); ImageDestroy($image); } }
function print_main_notes(WT_Fact $fact, $level) { global $WT_TREE, $SHOW_FACT_ICONS; $factrec = $fact->getGedcom(); $fact_id = $fact->getFactId(); $parent = $fact->getParent(); $pid = $parent->getXref(); if ($fact->isNew()) { $styleadd = ' new'; $can_edit = $level == 1 && $fact->canEdit(); } elseif ($fact->isOld()) { $styleadd = ' old'; $can_edit = false; } else { $styleadd = ''; $can_edit = $level == 1 && $fact->canEdit(); } $ct = preg_match_all("/{$level} NOTE (.*)/", $factrec, $match, PREG_SET_ORDER); for ($j = 0; $j < $ct; $j++) { // Note object, or inline note? if (preg_match("/{$level} NOTE @(.*)@/", $match[$j][0], $nmatch)) { $note = WT_Note::getInstance($nmatch[1]); if ($note && !$note->canShow()) { continue; } } else { $note = null; } if ($level >= 2) { echo '<tr class="row_note2"><td class="descriptionbox rela ', $styleadd, ' width20">'; } else { echo '<tr><td class="descriptionbox ', $styleadd, ' width20">'; } if ($can_edit) { echo '<a onclick="return edit_record(\'', $pid, '\', \'', $fact_id, '\');" href="#" title="', WT_I18N::translate('Edit'), '">'; if ($level < 2) { if ($SHOW_FACT_ICONS) { echo '<i class="icon-note"></i> '; } if ($note) { echo WT_Gedcom_Tag::getLabel('SHARED_NOTE'); } else { echo WT_Gedcom_Tag::getLabel('NOTE'); } echo '</a>'; echo '<div class="editfacts">'; echo "<div class=\"editlink\"><a class=\"editicon\" onclick=\"return edit_record('{$pid}', '{$fact_id}');\" href=\"#\" title=\"" . WT_I18N::translate('Edit') . "\"><span class=\"link_text\">" . WT_I18N::translate('Edit') . "</span></a></div>"; echo '<div class="copylink"><a class="copyicon" href="#" onclick="return copy_fact(\'', $pid, '\', \'', $fact_id, '\');" title="' . WT_I18N::translate('Copy') . '"><span class="link_text">' . WT_I18N::translate('Copy') . '</span></a></div>'; echo "<div class=\"deletelink\"><a class=\"deleteicon\" onclick=\"return delete_fact('" . WT_I18N::translate('Are you sure you want to delete this fact?') . "', '{$pid}', '{$fact_id}');\" href=\"#\" title=\"" . WT_I18N::translate('Delete') . "\"><span class=\"link_text\">" . WT_I18N::translate('Delete') . "</span></a></div>"; if ($note) { echo '<a class="icon-note" href="', $note->getHtmlUrl(), '" title="' . WT_I18N::translate('View') . '"><span class="link_text">' . WT_I18N::translate('View') . '</span></a>'; } echo '</div>'; } } else { if ($level < 2) { if ($SHOW_FACT_ICONS) { echo '<i class="icon-note"></i> '; } if ($note) { echo WT_Gedcom_Tag::getLabel('SHARED_NOTE'); } else { echo WT_Gedcom_Tag::getLabel('NOTE'); } } $factlines = explode("\n", $factrec); // 1 BIRT Y\n2 NOTE ... $factwords = explode(" ", $factlines[0]); // 1 BIRT Y $factname = $factwords[1]; // BIRT $parent = WT_GedcomRecord::getInstance($pid); if ($factname == 'EVEN' || $factname == 'FACT') { // Add ' EVEN' to provide sensible output for an event with an empty TYPE record $ct = preg_match("/2 TYPE (.*)/", $factrec, $ematch); if ($ct > 0) { $factname = trim($ematch[1]); echo $factname; } else { echo WT_Gedcom_Tag::getLabel($factname, $parent); } } else { if ($factname != 'NOTE') { // Note is already printed echo WT_Gedcom_Tag::getLabel($factname, $parent); if ($note) { echo '<div class="editfacts"><a class="icon-note" href="', $note->getHtmlUrl(), '" title="' . WT_I18N::translate('View') . '"><span class="link_text">' . WT_I18N::translate('View') . '</span></a></div>'; } } } } echo '</td>'; if ($note) { // Note objects if (array_key_exists('GEDFact_assistant', WT_Module::getActiveModules())) { // If Census assistant installed, allow it to format the note $text = GEDFact_assistant_WT_Module::formatCensusNote($note); } else { $text = WT_Filter::formatText($note->getNote(), $WT_TREE); } } else { // Inline notes $nrec = get_sub_record($level, "{$level} NOTE", $factrec, $j + 1); $text = $match[$j][1] . get_cont($level + 1, $nrec); $text = WT_Filter::formatText($text, $WT_TREE); } echo '<td class="optionbox', $styleadd, ' wrap">'; echo $text; if (!empty($noterec)) { echo print_fact_sources($noterec, 1); } // 2 RESN tags. Note, there can be more than one, such as "privacy" and "locked" if (preg_match_all("/\n2 RESN (.+)/", $factrec, $matches)) { foreach ($matches[1] as $match) { echo '<br><span class="label">', WT_Gedcom_Tag::getLabel('RESN'), ':</span> <span class="field">'; switch ($match) { case 'none': // Note: "2 RESN none" is not valid gedcom, and the GUI will not let you add it. // However, webtrees privacy rules will interpret it as "show an otherwise private fact to public". echo '<i class="icon-resn-none"></i> ', WT_I18N::translate('Show to visitors'); break; case 'privacy': echo '<i class="icon-resn-privacy"></i> ', WT_I18N::translate('Show to members'); break; case 'confidential': echo '<i class="icon-resn-confidential"></i> ', WT_I18N::translate('Show to managers'); break; case 'locked': echo '<i class="icon-resn-locked"></i> ', WT_I18N::translate('Only managers can edit'); break; default: echo $match; break; } echo '</span>'; } } echo '</td></tr>'; } }
public static function getFavoritesMenu() { global $REQUIRE_AUTHENTICATION, $controller, $SEARCH_SPIDER; $show_user_favs = WT_USER_ID && array_key_exists('user_favorites', WT_Module::getActiveModules()); $show_gedc_favs = !$REQUIRE_AUTHENTICATION && array_key_exists('gedcom_favorites', WT_Module::getActiveModules()); if ($show_user_favs && !$SEARCH_SPIDER) { if ($show_gedc_favs && !$SEARCH_SPIDER) { $favorites = array_merge(gedcom_favorites_WT_Module::getFavorites(WT_GED_ID), user_favorites_WT_Module::getFavorites(WT_USER_ID)); } else { $favorites = user_favorites_WT_Module::getFavorites(WT_USER_ID); } } else { if ($show_gedc_favs && !$SEARCH_SPIDER) { $favorites = gedcom_favorites_WT_Module::getFavorites(WT_GED_ID); } else { return null; } } // Sort $favorites alphabetically? $menu = new WT_Menu(WT_I18N::translate('Favorites'), '#', 'menu-favorites'); foreach ($favorites as $favorite) { switch ($favorite['type']) { case 'URL': $submenu = new WT_Menu($favorite['title'], $favorite['url']); $menu->addSubMenu($submenu); break; case 'INDI': case 'FAM': case 'SOUR': case 'OBJE': case 'NOTE': $obj = WT_GedcomRecord::getInstance($favorite['gid']); if ($obj && $obj->canShowName()) { $submenu = new WT_Menu($obj->getFullName(), $obj->getHtmlUrl()); $menu->addSubMenu($submenu); } break; } } if ($show_user_favs) { if (isset($controller->record) && $controller->record instanceof WT_GedcomRecord) { $submenu = new WT_Menu(WT_I18N::translate('Add to favorites'), '#'); $submenu->addOnclick("jQuery.post('module.php?mod=user_favorites&mod_action=menu-add-favorite',{xref:'" . $controller->record->getXref() . "'},function(){location.reload();})"); $menu->addSubMenu($submenu); } } return $menu; }
define('WT_THEME_URL', WT_STATIC_URL . WT_THEME_DIR); require WT_ROOT . WT_THEME_DIR . 'theme.php'; // Page hit counter - load after theme, as we need theme formatting if ($WT_TREE && $WT_TREE->preference('SHOW_COUNTER') && !$SEARCH_SPIDER) { require WT_ROOT . 'includes/hitcount.php'; } else { $hitCount = ''; } // define constants to be used when setting permissions after creating files/directories if (substr(PHP_SAPI, 0, 3) == 'cgi') { // cgi-mode, should only be writable by owner define('WT_PERM_EXE', 0755); // to be used on directories, php files, etc. define('WT_PERM_FILE', 0644); // to be used on images, text files, etc. } else { // mod_php mode, should be writable by everyone define('WT_PERM_EXE', 0777); define('WT_PERM_FILE', 0666); } // Lightbox needs custom integration in many places. Only check for the module once. define('WT_USE_LIGHTBOX', !$SEARCH_SPIDER && array_key_exists('lightbox', WT_Module::getActiveModules())); // Search engines are only allowed to see certain pages. if ($SEARCH_SPIDER && !in_array(WT_SCRIPT_NAME, array('index.php', 'indilist.php', 'module.php', 'mediafirewall.php', 'individual.php', 'family.php', 'mediaviewer.php', 'note.php', 'repo.php', 'source.php'))) { header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden'); $controller = new WT_Controller_Page(); $controller->setPageTitle(WT_I18N::translate('Search engine')); $controller->pageHeader(); echo '<p class="ui-state-error">', WT_I18N::translate('You do not have permission to view this page.'), '</p>'; exit; }
if ($changes) { echo '<br>', WT_I18N::translate('You should accept or reject all pending changes before upgrading.'), $icon_failure; echo '<br><button onclick="window.open(\'edit_changes.php\',\'_blank\', chan_window_specs); return false;"">', WT_I18N::translate('Pending changes'), '</button>'; echo '</li></ul></form>'; exit; } else { echo '<br>', WT_I18N::translate('There are no pending changes.'), $icon_success; } echo '</li>'; flush(); //////////////////////////////////////////////////////////////////////////////// // Custom modules may not work with the new version. //////////////////////////////////////////////////////////////////////////////// echo '<li>', WT_I18N::translate('Check for custom modules…'); $custom_modules = false; foreach (WT_Module::getActiveModules() as $module) { switch ($module->getName()) { case 'GEDFact_assistant': case 'ahnentafel_report': case 'batch_update': case 'bdm_report': case 'birth_report': case 'cemetery_report': case 'change_report': case 'charts': case 'ckeditor': case 'clippings': case 'death_report': case 'descendancy': case 'descendancy_report': case 'extra_info':
/** * get edit menu */ function getEditMenu() { $SHOW_GEDCOM_RECORD = get_gedcom_setting(WT_GED_ID, 'SHOW_GEDCOM_RECORD'); if (!$this->record || $this->record->isOld()) { return null; } // edit menu $menu = new WT_Menu(WT_I18N::translate('Edit'), '#', 'menu-indi'); $menu->addLabel($menu->label, 'down'); // What behaviour shall we give the main menu? If we leave it blank, the framework // will copy the first submenu - which may be edit-raw or delete. // As a temporary solution, make it edit the name $menu->addOnclick("return false;"); if (WT_USER_CAN_EDIT) { foreach ($this->record->getFacts() as $fact) { if ($fact->getTag() == 'NAME' && $fact->canEdit()) { $menu->addOnclick("return edit_name('" . $this->record->getXref() . "', '" . $fact->getFactId() . "');"); } break; } $submenu = new WT_Menu(WT_I18N::translate('Add a new name'), '#', 'menu-indi-addname'); $submenu->addOnclick("return add_name('" . $this->record->getXref() . "');"); $menu->addSubmenu($submenu); $has_sex_record = false; $submenu = new WT_Menu(WT_I18N::translate('Edit gender'), '#', 'menu-indi-editsex'); foreach ($this->record->getFacts() as $fact) { if ($fact->getTag() == 'SEX' && $fact->canEdit()) { $submenu->addOnclick("return edit_record('" . $this->record->getXref() . "', '" . $fact->getFactId() . "');"); $has_sex_record = true; break; } } if (!$has_sex_record) { $submenu->addOnclick("return add_new_record('" . $this->record->getXref() . "', 'SEX');"); } $menu->addSubmenu($submenu); if (count($this->record->getSpouseFamilies()) > 1) { $submenu = new WT_Menu(WT_I18N::translate('Re-order families'), '#', 'menu-indi-orderfam'); $submenu->addOnclick("return reorder_families('" . $this->record->getXref() . "');"); $menu->addSubmenu($submenu); } } // delete if (WT_USER_CAN_EDIT) { $submenu = new WT_Menu(WT_I18N::translate('Delete'), '#', 'menu-indi-del'); $submenu->addOnclick("return delete_individual('" . WT_I18N::translate('Are you sure you want to delete “%s”?', WT_Filter::escapeJs(strip_tags($this->record->getFullName()))) . "', '" . $this->record->getXref() . "');"); $menu->addSubmenu($submenu); } // edit raw if (Auth::isAdmin() || WT_USER_CAN_EDIT && $SHOW_GEDCOM_RECORD) { $submenu = new WT_Menu(WT_I18N::translate('Edit raw GEDCOM'), '#', 'menu-indi-editraw'); $submenu->addOnclick("return edit_raw('" . $this->record->getXref() . "');"); $menu->addSubmenu($submenu); } // add to favorites if (array_key_exists('user_favorites', WT_Module::getActiveModules())) { $submenu = new WT_Menu(WT_I18N::translate('Add to favorites'), '#', 'menu-indi-addfav'); $submenu->addOnclick("jQuery.post('module.php?mod=user_favorites&mod_action=menu-add-favorite',{xref:'" . $this->record->getXref() . "'},function(){location.reload();})"); $menu->addSubmenu($submenu); } return $menu; }
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA use WT\Auth; define('WT_SCRIPT_NAME', 'editnews.php'); require './includes/session.php'; $controller = new WT_Controller_Simple(); $controller->setPageTitle(WT_I18N::translate('Add/edit a journal/news entry'))->restrictAccess(Auth::isMember())->pageHeader(); $action = WT_Filter::get('action', 'compose|save|delete', 'compose'); $news_id = WT_Filter::getInteger('news_id'); $user_id = WT_Filter::get('user_id', WT_REGEX_INTEGER, WT_Filter::post('user_id', WT_REGEX_INTEGER)); $gedcom_id = WT_Filter::get('gedcom_id', WT_REGEX_INTEGER, WT_Filter::post('gedcom_id', WT_REGEX_INTEGER)); $date = WT_Filter::postInteger('date', 0, PHP_INT_MAX, WT_TIMESTAMP); $title = WT_Filter::post('title'); $text = WT_Filter::post('text'); switch ($action) { case 'compose': if (array_key_exists('ckeditor', WT_Module::getActiveModules())) { ckeditor_WT_Module::enableEditor($controller); } echo '<h3>' . WT_I18N::translate('Add/edit a journal/news entry') . '</h3>'; echo '<form style="overflow: hidden;" name="messageform" method="post" action="editnews.php?action=save&news_id=' . $news_id . '">'; if ($news_id) { $news = getNewsItem($news_id); } else { $news = array(); $news['user_id'] = $user_id; $news['gedcom_id'] = $gedcom_id; $news['date'] = WT_TIMESTAMP; $news['title'] = ''; $news['text'] = ''; } echo '<input type="hidden" name="user_id" value="' . $news['user_id'] . '">';