コード例 #1
0
 /**
  * get the edit menu
  * @return Menu
  */
 function &getEditMenu()
 {
     global $TEXT_DIRECTION, $PGV_IMAGE_DIR, $PGV_IMAGES, $GEDCOM;
     global $NAME_LINENUM, $SEX_LINENUM, $pgv_lang, $pgv_changes, $USE_QUICK_UPDATE;
     if ($TEXT_DIRECTION == "rtl") {
         $ff = "_rtl";
     } else {
         $ff = "";
     }
     //-- main edit menu
     $menu = new Menu($pgv_lang["edit"]);
     if (!empty($PGV_IMAGES["edit_indi"]["small"])) {
         $menu->addIcon($PGV_IMAGE_DIR . "/" . $PGV_IMAGES["edit_indi"]["small"]);
     }
     $menu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}", "submenu{$ff}");
     // Determine whether the Quick Update form can be shown
     $showQuickForm = false;
     if ($USE_QUICK_UPDATE) {
         if ($USE_QUICK_UPDATE === '1' && PGV_USER_IS_ADMIN) {
             $showQuickForm = true;
         } else {
             if ($USE_QUICK_UPDATE === '2' && PGV_USER_GEDCOM_ADMIN) {
                 $showQuickForm = true;
             } else {
                 if (($USE_QUICK_UPDATE === '3' || $USE_QUICK_UPDATE === true) && PGV_USER_CAN_EDIT) {
                     $showQuickForm = true;
                 }
             }
         }
     }
     if ($showQuickForm) {
         $submenu = new Menu($pgv_lang["quick_update_title"]);
         $submenu->addOnclick("return quickEdit('" . $this->pid . "','','" . $GEDCOM . "');");
         $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}");
         $menu->addSubmenu($submenu);
         $menu->addSeparator();
     }
     if (PGV_USER_CAN_EDIT) {
         if (count($this->indi->getSpouseFamilyIds()) > 1) {
             $submenu = new Menu($pgv_lang["reorder_families"]);
             $submenu->addOnclick("return reorder_families('" . $this->pid . "');");
             $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}");
             $menu->addSubmenu($submenu);
         }
         if ($this->total_names < 2) {
             $submenu = new Menu($pgv_lang["edit_name"]);
             $submenu->addOnclick("return edit_name('" . $this->pid . "', {$NAME_LINENUM});");
             $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}");
             $menu->addSubmenu($submenu);
         }
         $submenu = new Menu($pgv_lang["add_name"]);
         $submenu->addOnclick("return add_name('" . $this->pid . "');");
         $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}");
         $menu->addSubmenu($submenu);
         if ($this->SEX_COUNT < 2) {
             $submenu = new Menu($pgv_lang["edit_sex"]);
             if ($SEX_LINENUM == "new") {
                 $submenu->addOnclick("return add_new_record('" . $this->pid . "', 'SEX');");
             } else {
                 $submenu->addOnclick("return edit_record('" . $this->pid . "', {$SEX_LINENUM});");
             }
             $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}");
             $menu->addSubmenu($submenu);
         }
         $menu->addSeparator();
     }
     if (isset($pgv_changes[$this->pid . "_" . $GEDCOM])) {
         if (!$this->show_changes) {
             $label = $pgv_lang["show_changes"];
             $link = $this->indi->getLinkUrl() . "&show_changes=yes";
         } else {
             $label = $pgv_lang["hide_changes"];
             $link = $this->indi->getLinkUrl() . "&show_changes=no";
         }
         $submenu = new Menu($label, encode_url($link));
         $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}");
         $menu->addSubmenu($submenu);
         if (PGV_USER_CAN_ACCEPT) {
             $submenu = new Menu($pgv_lang["undo_all"], encode_url($this->indi->getLinkUrl() . "&action=undo"));
             $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}");
             $menu->addSubmenu($submenu);
             $submenu = new Menu($pgv_lang["accept_all"], encode_url($this->indi->getLinkUrl() . "&action=accept"));
             $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}");
             $menu->addSubmenu($submenu);
         }
         $menu->addSeparator();
     }
     if (PGV_USER_IS_ADMIN || $this->canShowGedcomRecord()) {
         $submenu = new Menu($pgv_lang["edit_raw"]);
         $submenu->addOnclick("return edit_raw('" . $this->pid . "');");
         $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}");
         $menu->addSubmenu($submenu);
     }
     $submenu = new Menu($pgv_lang["delete_person"]);
     $submenu->addOnclick("return deleteperson('" . $this->pid . "');");
     $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}");
     $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;
 }
コード例 #2
0
ファイル: media_ctrl.php プロジェクト: bitweaver/phpgedview
 /**
  * get the edit menu
  * @return Menu
  */
 function &getEditMenu()
 {
     global $TEXT_DIRECTION, $PGV_IMAGE_DIR, $PGV_IMAGES, $GEDCOM, $TOTAL_NAMES;
     global $NAME_LINENUM, $SEX_LINENUM, $pgv_lang, $pgv_changes, $USE_QUICK_UPDATE;
     global $SHOW_GEDCOM_RECORD;
     if ($TEXT_DIRECTION == "rtl") {
         $ff = "_rtl";
     } else {
         $ff = "";
     }
     $links = get_media_relations($this->pid);
     $linktoid = "new";
     foreach ($links as $linktoid => $type) {
         break;
         // we're only interested in the key of the first list entry
     }
     //-- main edit menu
     $menu = new Menu($pgv_lang["edit"]);
     $click_link = "window.open('addmedia.php?action=editmedia&pid={$this->pid}&linktoid={$linktoid}', '_blank', 'top=50,left=50,width=600,height=500,resizable=1,scrollbars=1')";
     $menu->addOnclick($click_link);
     if (!empty($PGV_IMAGES["edit_indi"]["small"])) {
         $menu->addIcon($PGV_IMAGE_DIR . "/" . $PGV_IMAGES["edit_indi"]["small"]);
     }
     $menu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}", "submenu{$ff}");
     if (PGV_USER_CAN_EDIT) {
         //- plain edit option
         $submenu = new Menu($pgv_lang["edit"]);
         $click_link = "window.open('addmedia.php?action=editmedia&pid={$this->pid}&linktoid={$linktoid}', '_blank', 'top=50,left=50,width=600,height=500,resizable=1,scrollbars=1')";
         $submenu->addOnclick($click_link);
         $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}");
         $menu->addSubmenu($submenu);
         if ($SHOW_GEDCOM_RECORD || PGV_USER_IS_ADMIN) {
             $submenu = new Menu($pgv_lang["edit_raw"]);
             $submenu->addOnclick("return edit_raw('" . $this->pid . "');");
             $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}");
             $menu->addSubmenu($submenu);
         }
         //- end plain edit option
         if (PGV_USER_GEDCOM_ADMIN) {
             //- remove object option
             $submenu = new Menu($pgv_lang["remove_object"]);
             $submenu->addLink(encode_url("media.php?action=removeobject&xref=" . $this->pid));
             $submenu->addOnclick("return confirm('" . $pgv_lang["confirm_remove_object"] . "')");
             $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}");
             $menu->addSubmenu($submenu);
         }
         // main link displayed on page
         if (PGV_USER_GEDCOM_ADMIN && file_exists('modules/GEDFact_assistant/_MEDIA/media_1_ctrl.php')) {
             $submenu = new Menu($pgv_lang["add_or_remove_links"]);
         } else {
             $submenu = new Menu($pgv_lang["set_link"]);
         }
         // GEDFact assistant Add Media Links =======================
         if (PGV_USER_GEDCOM_ADMIN && file_exists('modules/GEDFact_assistant/_MEDIA/media_1_ctrl.php')) {
             $submenu->addOnclick("return ilinkitem('" . $this->pid . "','manage');");
             $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}", "submenu{$ff}");
             // Do not print ssubmunu
         } else {
             $submenu->addOnclick("return ilinkitem('" . $this->pid . "','person');");
             $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}", "submenu{$ff}");
             $ssubmenu = new Menu($pgv_lang["to_person"]);
             $ssubmenu->addOnclick("return ilinkitem('" . $this->pid . "','person');");
             $ssubmenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}");
             $submenu->addSubMenu($ssubmenu);
             $ssubmenu = new Menu($pgv_lang["to_family"]);
             $ssubmenu->addOnclick("return ilinkitem('" . $this->pid . "','family');");
             $ssubmenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}");
             $submenu->addSubMenu($ssubmenu);
             $ssubmenu = new Menu($pgv_lang["to_source"]);
             $ssubmenu->addOnclick("return ilinkitem('" . $this->pid . "','source');");
             $ssubmenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}");
             $submenu->addSubMenu($ssubmenu);
         }
         $menu->addSubmenu($submenu);
     }
     if (isset($pgv_changes[$this->pid . "_" . $GEDCOM])) {
         $menu->addSeparator();
         if (!$this->show_changes) {
             $label = $pgv_lang["show_changes"];
             $link = "mediaviewer.php?mid={$this->pid}&show_changes=yes";
         } else {
             $label = $pgv_lang["hide_changes"];
             $link = "mediaviewer.php?mid={$this->pid}&show_changes=no";
         }
         $submenu = new Menu($label, encode_url($link));
         $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}");
         $menu->addSubmenu($submenu);
         if (PGV_USER_CAN_ACCEPT) {
             $submenu = new Menu($pgv_lang["undo_all"], encode_url("mediaviewer.php?mid={$this->pid}&action=undo"));
             $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}");
             $menu->addSubmenu($submenu);
             $submenu = new Menu($pgv_lang["accept_all"], encode_url("mediaviewer.php?mid={$this->pid}&action=accept"));
             $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}");
             $menu->addSubmenu($submenu);
         }
     }
     return $menu;
 }
コード例 #3
0
ファイル: family_ctrl.php プロジェクト: bitweaver/phpgedview
 /**
  * get the family page edit menu
  */
 function &getEditMenu()
 {
     global $TEXT_DIRECTION, $PGV_IMAGE_DIR, $PGV_IMAGES, $GEDCOM, $pgv_lang, $pgv_changes;
     global $SHOW_GEDCOM_RECORD;
     if ($TEXT_DIRECTION == "rtl") {
         $ff = "_rtl";
     } else {
         $ff = "";
     }
     // edit_fam menu
     $menu = new Menu($pgv_lang['edit_fam']);
     $menu->addOnclick("return edit_family('" . $this->getFamilyID() . "');");
     if (!empty($PGV_IMAGES["edit_fam"]["small"])) {
         $menu->addIcon("{$PGV_IMAGE_DIR}/{$PGV_IMAGES['edit_fam']['small']}");
     }
     $menu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}", "submenu{$ff}");
     // edit_fam / edit_fam
     $submenu = new Menu($pgv_lang['edit_fam']);
     $submenu->addOnclick("return edit_family('" . $this->getFamilyID() . "');");
     if (!empty($PGV_IMAGES["edit_fam"]["small"])) {
         $submenu->addIcon("{$PGV_IMAGE_DIR}/{$PGV_IMAGES['edit_fam']['small']}");
     }
     $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}");
     $menu->addSubmenu($submenu);
     // edit_fam / members
     $submenu = new Menu($pgv_lang['change_family_members']);
     $submenu->addOnclick("return change_family_members('" . $this->getFamilyID() . "');");
     if (!empty($PGV_IMAGES["edit_fam"]["small"])) {
         $submenu->addIcon("{$PGV_IMAGE_DIR}/{$PGV_IMAGES['edit_fam']['small']}");
     }
     $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}");
     $menu->addSubmenu($submenu);
     // edit_fam / add child
     $submenu = new Menu($pgv_lang['add_child_to_family']);
     $submenu->addOnclick("return addnewchild('" . $this->getFamilyID() . "');");
     if (!empty($PGV_IMAGES["edit_fam"]["small"])) {
         $submenu->addIcon("{$PGV_IMAGE_DIR}/{$PGV_IMAGES['edit_fam']['small']}");
     }
     $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}");
     $menu->addSubmenu($submenu);
     // edit_fam / reorder_children
     if ($this->family->getNumberOfChildren() > 1) {
         $submenu = new Menu($pgv_lang['reorder_children']);
         $submenu->addOnclick("return reorder_children('" . $this->getFamilyID() . "');");
         if (!empty($PGV_IMAGES["edit_fam"]["small"])) {
             $submenu->addIcon("{$PGV_IMAGE_DIR}/{$PGV_IMAGES['edit_fam']['small']}");
         }
         $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}");
         $menu->addSubmenu($submenu);
     }
     if (isset($pgv_changes[$this->getFamilyID() . '_' . $GEDCOM])) {
         // edit_fam / separator
         $menu->addSeparator();
         // edit_fam / show/hide changes
         if (!$this->show_changes) {
             $submenu = new Menu($pgv_lang['show_changes'], encode_url('family.php?famid=' . $this->getFamilyID() . '&show_changes=yes'));
             if (!empty($PGV_IMAGES["edit_fam"]["small"])) {
                 $submenu->addIcon("{$PGV_IMAGE_DIR}/{$PGV_IMAGES['edit_fam']['small']}");
             }
             $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}");
             $menu->addSubmenu($submenu);
         } else {
             $submenu = new Menu($pgv_lang['hide_changes'], encode_url('family.php?famid=' . $this->getFamilyID() . '&show_changes=no'));
             if (!empty($PGV_IMAGES["edit_fam"]["small"])) {
                 $submenu->addIcon("{$PGV_IMAGE_DIR}/{$PGV_IMAGES['edit_fam']['small']}");
             }
             $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}");
             $menu->addSubmenu($submenu);
         }
         if (PGV_USER_CAN_ACCEPT) {
             // edit_fam / accept_all
             $submenu = new Menu($pgv_lang["undo_all"], encode_url("family.php?famid={$this->famid}&action=undo"));
             if (!empty($PGV_IMAGES["edit_fam"]["small"])) {
                 $submenu->addIcon("{$PGV_IMAGE_DIR}/{$PGV_IMAGES['edit_fam']['small']}");
             }
             $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}");
             $menu->addSubmenu($submenu);
             $submenu = new Menu($pgv_lang["accept_all"], encode_url("family.php?famid={$this->famid}&action=accept"));
             if (!empty($PGV_IMAGES["edit_fam"]["small"])) {
                 $submenu->addIcon("{$PGV_IMAGE_DIR}/{$PGV_IMAGES['edit_fam']['small']}");
             }
             $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}");
             $menu->addSubmenu($submenu);
         }
     }
     // edit_fam / separator
     $menu->addSeparator();
     // edit_fam / edit_raw
     if ($SHOW_GEDCOM_RECORD || PGV_USER_IS_ADMIN) {
         $submenu = new Menu($pgv_lang['edit_raw']);
         $submenu->addOnclick("return edit_raw('" . $this->getFamilyID() . "');");
         if (!empty($PGV_IMAGES["edit_fam"]["small"])) {
             $submenu->addIcon("{$PGV_IMAGE_DIR}/{$PGV_IMAGES['edit_fam']['small']}");
         }
         $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}");
         $menu->addSubmenu($submenu);
     }
     // edit_fam / delete_family
     $submenu = new Menu($pgv_lang['delete_family']);
     $submenu->addOnclick("if (confirm('" . $pgv_lang["delete_family_confirm"] . "')) return delete_family('" . $this->getFamilyID() . "'); else return false;");
     if (!empty($PGV_IMAGES["edit_fam"]["small"])) {
         $submenu->addIcon("{$PGV_IMAGE_DIR}/{$PGV_IMAGES['edit_fam']['small']}");
     }
     $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}");
     $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;
 }
コード例 #4
0
 static function &getFavoritesMenu()
 {
     global $REQUIRE_AUTHENTICATION, $pgv_lang, $GEDCOM, $QUERY_STRING, $SCRIPT_NAME, $PGV_IMAGE_DIR, $PGV_IMAGES, $TEXT_DIRECTION;
     global $SEARCH_SPIDER;
     global $controller;
     // Pages with a controller can be added to the favorites
     if (!empty($SEARCH_SPIDER)) {
         return false;
         // show no favorites, because they taint every page that is indexed.
     }
     if ($TEXT_DIRECTION == "rtl") {
         $ff = "_rtl";
     } else {
         $ff = "";
     }
     if (PGV_USER_ID || !$REQUIRE_AUTHENTICATION) {
         $menu = new Menu($pgv_lang['favorites'], '#', 'down');
         if (!empty($PGV_IMAGES['gedcom']['large'])) {
             $menu->addIcon($PGV_IMAGE_DIR . '/' . $PGV_IMAGES['gedcom']['large']);
         }
         $menu->addClass("menuitem{$ff}", "menuitem_hover{$ff}", "submenu{$ff}", "icon_large_gedcom");
         //			$menu->print_menu = NULL;
         $userfavs = getUserFavorites(PGV_USER_ID);
         $gedfavs = getUserFavorites($GEDCOM);
         // User favorites
         if ($userfavs || PGV_USER_ID) {
             $submenu = new Menu('<strong>' . $pgv_lang['my_favorites'] . '</strong>');
             $submenu->addClass('favsubmenuitem', 'favsubmenuitem_hover');
             $menu->addSubMenu($submenu);
             while (PGV_USER_ID && isset($controller)) {
                 // Get the right $gid from each supported controller type
                 switch (get_class($controller)) {
                     case 'IndividualController':
                         $gid = $controller->pid;
                         break;
                     case 'FamilyController':
                         $gid = $controller->famid;
                         break;
                     case 'MediaController':
                         $gid = $controller->mid;
                         break;
                     case 'SourceController':
                         $gid = $controller->sid;
                         break;
                     case 'RepositoryController':
                         $gid = $controller->rid;
                         break;
                     default:
                         break 2;
                 }
                 $submenu = new Menu('<em>' . $pgv_lang['add_to_my_favorites'] . '</em>', $SCRIPT_NAME . normalize_query_string($QUERY_STRING . '&amp;action=addfav&amp;gid=' . $gid));
                 $submenu->addClass('favsubmenuitem', 'favsubmenuitem_hover');
                 $menu->addSubMenu($submenu);
                 break;
             }
             foreach ($userfavs as $fav) {
                 $OLD_GEDCOM = $GEDCOM;
                 $GEDCOM = $fav['file'];
                 switch ($fav['type']) {
                     case 'URL':
                         $submenu = new Menu(PrintReady($fav['title']), $fav['url']);
                         $submenu->addClass('favsubmenuitem', 'favsubmenuitem_hover');
                         $menu->addSubMenu($submenu);
                         break;
                     case 'INDI':
                     case 'FAM':
                     case 'SOUR':
                     case 'OBJE':
                         if (displayDetailsById($fav['gid'], $fav['type'])) {
                             $obj = GedcomRecord::getInstance($fav['gid']);
                             if ($obj) {
                                 $submenu = new Menu(PrintReady($obj->getFullName()), encode_url($obj->getLinkUrl()));
                                 $submenu->addClass('favsubmenuitem', 'favsubmenuitem_hover');
                                 $menu->addSubMenu($submenu);
                             }
                         }
                         break;
                 }
                 $GEDCOM = $OLD_GEDCOM;
             }
             if ($gedfavs) {
                 $menu->addSeparator();
             }
         }
         // Gedcom favorites
         if ($gedfavs) {
             $submenu = new Menu('<strong>' . $pgv_lang['gedcom_favorites'] . '</strong>');
             $submenu->addClass('favsubmenuitem', 'favsubmenuitem_hover');
             $menu->addSubMenu($submenu);
             foreach ($gedfavs as $fav) {
                 $OLD_GEDCOM = $GEDCOM;
                 $GEDCOM = $fav['file'];
                 switch ($fav['type']) {
                     case 'URL':
                         $submenu = new Menu(PrintReady($fav['title']), $fav['url']);
                         $submenu->addClass('favsubmenuitem', 'favsubmenuitem_hover');
                         $menu->addSubMenu($submenu);
                         break;
                     case 'INDI':
                     case 'FAM':
                     case 'SOUR':
                     case 'OBJE':
                         if (displayDetailsById($fav['gid'], $fav['type'])) {
                             $obj = GedcomRecord::getInstance($fav['gid']);
                             if ($obj) {
                                 $submenu = new Menu(PrintReady($obj->getFullName()), encode_url($obj->getLinkUrl()));
                                 $submenu->addClass('favsubmenuitem', 'favsubmenuitem_hover');
                                 $menu->addSubMenu($submenu);
                             }
                         }
                         break;
                 }
                 $GEDCOM = $OLD_GEDCOM;
             }
         }
     }
     return $menu;
 }