Exemple #1
0
 /**
  * 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;
 }
Exemple #2
0
 /**
  * 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;
 }
Exemple #3
0
 /**
  * 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;
 }
Exemple #4
0
 /**
  * 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;
 }
Exemple #5
0
 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;
 }
Exemple #6
0
 /**
  * edit menu items used in media list
  */
 static function getMediaListMenu($mediaobject)
 {
     $html = '<div class="lightbox-menu"><ul class="makeMenu lb-menu">';
     $menu = new WT_Menu(WT_I18N::translate('Edit details'));
     $menu->addClass('', '', 'lb-image_edit');
     $menu->addOnclick("return window.open('addmedia.php?action=editmedia&amp;pid=" . $mediaobject->getXref() . "', '_blank', edit_window_specs);");
     $html .= $menu->getMenuAsList();
     $menu = new WT_Menu(WT_I18N::translate('Set link'));
     $menu->addClass('', '', 'lb-image_link');
     $menu->addOnclick("return ilinkitem('" . $mediaobject->getXref() . "','person')");
     $submenu = new WT_Menu(WT_I18N::translate('To individual'), '#');
     $submenu->addOnclick("return ilinkitem('" . $mediaobject->getXref() . "','person')");
     $menu->addSubMenu($submenu);
     $submenu = new WT_Menu(WT_I18N::translate('To family'), '#');
     $submenu->addOnclick("return ilinkitem('" . $mediaobject->getXref() . "','family')");
     $menu->addSubMenu($submenu);
     $submenu = new WT_Menu(WT_I18N::translate('To source'), '#');
     $submenu->addOnclick("return ilinkitem('" . $mediaobject->getXref() . "','source')");
     $menu->addSubMenu($submenu);
     $html .= $menu->getMenuAsList();
     $menu = new WT_Menu(WT_I18N::translate('View details'), $mediaobject->getHtmlUrl());
     $menu->addClass('', '', 'lb-image_view');
     $html .= $menu->getMenuAsList();
     $html .= '</ul></div>';
     return $html;
 }
Exemple #7
0
 /**
  * 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&amp;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;
 }
Exemple #8
0
 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&amp;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() . "&amp;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() . "&amp;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() . "&amp;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() . "&amp;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;
 }