Ejemplo n.º 1
0
/**
* 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 from the $factarray
* @param string $readOnly optional, when "READONLY", fact data can't be changed
* @param string $noClose optional, when "NOCLOSE", final "</td></tr>" won't be printed
* (so that additional text can be printed in the box)
* @param boolean $rowDisplay True to have the row displayed by default, false to hide it by default
*/
function add_simple_tag($tag, $upperlevel = "", $label = "", $readOnly = "", $noClose = "", $rowDisplay = true)
{
    global $factarray, $pgv_lang, $PGV_IMAGE_DIR, $PGV_IMAGES, $MEDIA_DIRECTORY, $TEMPLE_CODES;
    global $assorela, $tags, $emptyfacts, $main_fact, $TEXT_DIRECTION, $pgv_changes, $GEDCOM;
    global $NPFX_accept, $SPFX_accept, $NSFX_accept, $FILE_FORM_accept, $upload_count;
    global $tabkey, $STATUS_CODES, $SPLIT_PLACES, $pid, $linkToID;
    global $bdm, $PRIVACY_BY_RESN;
    global $lang_short_cut, $LANGUAGE;
    global $QUICK_REQUIRED_FACTS, $QUICK_REQUIRED_FAMFACTS, $PREFER_LEVEL2_SOURCES;
    if (substr($tag, 0, strpos($tag, "PLAC"))) {
        ?>
<script type="text/javascript">
		<!--
		function valid_lati_long(field, pos, neg) {
			// valid LATI or LONG according to Gedcom standard
			// pos (+) : N or E
			// neg (-) : S or W
			txt=field.value.toUpperCase();
			txt=txt.replace(/(^\s*)|(\s*$)/g,''); // trim
			txt=txt.replace(/ /g,':'); // N12 34 ==> N12.34
			txt=txt.replace(/\+/g,''); // +17.1234 ==> 17.1234
			txt=txt.replace(/-/g,neg); // -0.5698 ==> W0.5698
			txt=txt.replace(/,/g,'.'); // 0,5698 ==> 0.5698
			// 0�34'11 ==> 0:34:11
			txt=txt.replace(/\uB0/g,':'); // �
			txt=txt.replace(/\u27/g,':'); // '
			// 0:34:11.2W ==> W0.5698
			txt=txt.replace(/^([0-9]+):([0-9]+):([0-9.]+)(.*)/g, function($0, $1, $2, $3, $4) { var n=parseFloat($1); n+=($2/60); n+=($3/3600); n=Math.round(n*1E4)/1E4; return $4+n; });
			// 0:34W ==> W0.5667
			txt=txt.replace(/^([0-9]+):([0-9]+)(.*)/g, function($0, $1, $2, $3) { var n=parseFloat($1); n+=($2/60); n=Math.round(n*1E4)/1E4; return $3+n; });
			// 0.5698W ==> W0.5698
			txt=txt.replace(/(.*)([N|S|E|W]+)$/g,'$2$1');
			// 17.1234 ==> N17.1234
			if (txt!='' && txt.charAt(0)!=neg && txt.charAt(0)!=pos) txt=pos+txt;
			field.value = txt;
		}

		function toggle_lati_long() {
			tr = document.getElementsByTagName('tr');
			for (var i=0; i<tr.length; i++) {
				if (tr[i].id.indexOf("LATI")>=0 || tr[i].id.indexOf("LONG")>=0) {
					var disp = tr[i].style.display;
					if (disp=="none") {
						disp="table-row";
						if (document.all && !window.opera) disp = "inline"; // IE
					}
					else disp="none";
					tr[i].style.display=disp;
				}
			}
		}
		//-->
		</script>
		<?php 
    }
    if (!isset($noClose) && isset($readOnly) && $readOnly == "NOCLOSE") {
        $noClose = "NOCLOSE";
        $readOnly = "";
    }
    if (!isset($noClose) || $noClose != "NOCLOSE") {
        $noClose = "";
    }
    if (!isset($readOnly) || $readOnly != "READONLY") {
        $readOnly = "";
    }
    if (!isset($tabkey)) {
        $tabkey = 1;
    }
    if (empty($linkToID)) {
        $linkToID = $pid;
    }
    $subnamefacts = array("NPFX", "GIVN", "SPFX", "SURN", "NSFX", "_MARNM_SURN");
    @(list($level, $fact, $value) = explode(" ", $tag));
    // 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 . floor(microtime() * 1000000);
    }
    // ex: SOUR56402
    if ($upperlevel) {
        $element_id = $upperlevel . "_" . $fact;
    }
    // ex: BIRT_DATE | DEAT_DATE ...
    // field value
    $islink = (substr($value, 0, 1) == "@" and 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;
    }
    // rows & cols
    switch ($fact) {
        case 'FORM':
            $rows = 1;
            $cols = 5;
            break;
        case 'LATI':
        case 'LONG':
        case 'NPFX':
        case 'SPFX':
        case 'NSFX':
            $rows = 1;
            $cols = 12;
            break;
        case 'DATE':
        case 'TIME':
        case 'TYPE':
            $rows = 1;
            $cols = 20;
            break;
        case 'GIVN':
        case 'SURN':
        case '_MARNM':
            $rows = 1;
            $cols = 25;
            break;
        case '_UID':
            $rows = 1;
            $cols = 50;
            break;
        case 'TEXT':
        case 'PUBL':
            $rows = 10;
            $cols = 70;
            break;
        case 'SHARED_NOTE_EDIT':
            $islink = 1;
            $fact = "NOTE";
            $rows = 15;
            $cols = 88;
            break;
        case 'SHARED_NOTE':
            $islink = 1;
            $fact = "NOTE";
            $rows = 1;
            $cols = $islink ? 8 : 40;
            break;
        case 'NOTE':
            if ($islink) {
                $rows = 1;
                $cols = $islink ? 8 : 40;
                break;
            } else {
                $rows = 10;
                $cols = 70;
                break;
            }
        case 'ADDR':
            $rows = 4;
            $cols = 40;
            break;
        case 'PAGE':
            $rows = 1;
            $cols = 50;
            break;
        default:
            $rows = 1;
            $cols = $islink ? 8 : 40;
            break;
    }
    // label
    $style = "";
    echo "<tr id=\"" . $element_id . "_tr\" ";
    if ($fact == "MAP" || $fact == "LATI" || $fact == "LONG") {
        echo " style=\"display:none;\"";
    }
    echo " >\n";
    if (in_array($fact, $subnamefacts) || $fact == "LATI" || $fact == "LONG") {
        echo "<td class=\"optionbox {$TEXT_DIRECTION} wrap width25\">";
    } else {
        echo "<td class=\"descriptionbox {$TEXT_DIRECTION} wrap width25\">";
    }
    // help link
    if (!in_array($fact, $emptyfacts)) {
        if ($fact == "DATE") {
            print_help_link("def_gedcom_date_help", "qm", "date");
        } else {
            if ($fact == "RESN") {
                print_help_link($fact . "_help", "qm");
            } else {
                if ($fact == "NOTE" && $islink) {
                    print_help_link("edit_add_SHARED_NOTE_help", "qm");
                } else {
                    print_help_link("edit_" . $fact . "_help", "qm");
                }
            }
        }
    }
    if ($fact == "_AKAN" || $fact == "_AKA" || $fact == "ALIA") {
        // Allow special processing for different languages
        $func = "fact_AKA_localisation_{$lang_short_cut[$LANGUAGE]}";
        if (function_exists($func)) {
            // Localise the AKA fact
            $func($fact, $pid);
        }
    } else {
        if ($fact == "AGNC" && !empty($main_fact)) {
            // Allow special processing for different languages
            $func = "fact_AGNC_localisation_{$lang_short_cut[$LANGUAGE]}";
            if (function_exists($func)) {
                // Localise the AGNC fact
                $func($fact, $main_fact);
            }
        }
    }
    if (PGV_DEBUG) {
        echo $element_name . "<br />\n";
    }
    // tag name
    if (!empty($label)) {
        if ($label == "Note" && $islink) {
            echo $pgv_lang["shared_note"];
        } else {
            echo $label;
        }
    } else {
        if ($fact == "NOTE" && $islink) {
            echo $pgv_lang["shared_note"];
        } else {
            if (isset($pgv_lang[$fact])) {
                echo $pgv_lang[$fact];
            } else {
                if (isset($factarray[$fact])) {
                    echo $factarray[$fact];
                } else {
                    echo $fact;
                }
            }
        }
    }
    echo "\n";
    // tag level
    if ($level > 0) {
        if ($fact == "TEXT" and $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 . "\" />\n";
        echo "<input type=\"hidden\" name=\"islink[]\" value=\"" . $islink . "\" />\n";
        echo "<input type=\"hidden\" name=\"tag[]\" value=\"" . $fact . "\" />\n";
        // Shared Notes Debug --------------------
        // echo "<br />Label = ".$label;
        // echo "<br />Level = ".$level;
        // echo "<br />Link = ".$islink;
        // echo "<br />Fact = ".$fact;
        // echo "<br />Value = ".$value;
        // End Debug -------------------
    }
    echo "\n</td>";
    // value
    echo "<td class=\"optionbox wrap\">\n";
    if (PGV_DEBUG) {
        echo $tag . "<br />\n";
    }
    // retrieve linked NOTE
    if ($fact == "NOTE" && $islink) {
        $noteid = $value;
    }
    if (in_array($fact, $emptyfacts) && (empty($value) || $value == "y" || $value == "Y")) {
        $value = strtoupper($value);
        //-- don't default anything to Y when adding events through people
        //-- default to Y when specifically adding one of these events
        if ($level == 1) {
            $value = "Y";
        }
        // default YES
        echo "<input type=\"hidden\" id=\"" . $element_id . "\" name=\"" . $element_name . "\" value=\"" . $value . "\" />";
        if ($level <= 1) {
            echo "<input type=\"checkbox\" ";
            if ($value == "Y") {
                echo " checked=\"checked\"";
            }
            echo " onclick=\"if (this.checked) " . $element_id . ".value='Y'; else " . $element_id . ".value=''; \" />";
            echo $pgv_lang["yes"];
        }
    } else {
        if ($fact == "TEMP") {
            echo "<select tabindex=\"" . $tabkey . "\" name=\"" . $element_name . "\" >\n";
            echo "<option value=''>" . $pgv_lang["no_temple"] . "</option>\n";
            foreach ($TEMPLE_CODES as $code => $temple) {
                echo "<option value=\"{$code}\"";
                if ($code == $value) {
                    echo " selected=\"selected\"";
                }
                echo ">{$temple} ({$code})</option>\n";
            }
            echo "</select>\n";
        } else {
            if ($fact == "ADOP") {
                echo "<select tabindex=\"" . $tabkey . "\" name=\"" . $element_name . "\" >";
                foreach (array("BOTH" => $factarray["HUSB"] . "+" . $factarray["WIFE"], "HUSB" => $factarray["HUSB"], "WIFE" => $factarray["WIFE"]) as $k => $v) {
                    echo "<option value='{$k}'";
                    if ($value == $k) {
                        echo " selected=\"selected\"";
                    }
                    echo ">{$v}</option>";
                }
                echo "</select>\n";
            } else {
                if ($fact == "PEDI") {
                    echo "<select tabindex=\"" . $tabkey . "\" name=\"" . $element_name . "\" >";
                    foreach (array("" => $pgv_lang["unknown"], "birth" => $factarray["BIRT"], "adopted" => $pgv_lang["adopted"], "foster" => $pgv_lang["foster"], "sealing" => $pgv_lang["sealing"]) as $k => $v) {
                        echo "<option value='{$k}'";
                        if (UTF8_strtolower($value) == $k) {
                            echo " selected=\"selected\"";
                        }
                        echo ">{$v}</option>";
                    }
                    echo "</select>\n";
                } else {
                    if ($fact == "STAT") {
                        echo "<select tabindex=\"" . $tabkey . "\" name=\"" . $element_name . "\" >\n";
                        echo "<option value=''>No special status</option>\n";
                        foreach ($STATUS_CODES as $code => $status) {
                            echo "<option value=\"{$code}\"";
                            if ($code == $value) {
                                echo " selected=\"selected\"";
                            }
                            echo ">{$status}</option>\n";
                        }
                        echo "</select>\n";
                    } else {
                        if ($fact == "RELA") {
                            $text = strtolower($value);
                            // add current relationship if not found in default list
                            if (!array_key_exists($text, $assorela)) {
                                $assorela[$text] = $text;
                            }
                            echo "<select tabindex=\"" . $tabkey . "\" id=\"" . $element_id . "\" name=\"" . $element_name . "\" >\n";
                            foreach ($assorela as $key => $value) {
                                echo "<option value=\"" . $key . "\"";
                                if ($key == $text) {
                                    echo " selected=\"selected\"";
                                }
                                echo ">" . $assorela["{$key}"] . "</option>\n";
                            }
                            echo "</select>\n";
                        } else {
                            if ($fact == "_PGVU") {
                                $text = strtolower($value);
                                echo "<select tabindex=\"" . $tabkey . "\" id=\"" . $element_id . "\" name=\"" . $element_name . "\" >\n";
                                echo '<option value=""';
                                if ('' == $text) {
                                    echo ' selected="selected"';
                                }
                                echo ">-</option>\n";
                                foreach (get_all_users('asc', 'username') as $user_id => $user_name) {
                                    echo "<option value=\"" . $user_id . "\"";
                                    if ($user_id == $text) {
                                        echo " selected=\"selected\"";
                                    }
                                    echo ">" . $user_name . "</option>\n";
                                }
                                echo "</select>\n";
                            } else {
                                if ($fact == "RESN") {
                                    ?>
		<script type="text/javascript">
		<!--
		function update_RESN_img(resn_val) {
			document.getElementById("RESN_none").style.display="none";
			document.getElementById("RESN_locked").style.display="none";
			document.getElementById("RESN_privacy").style.display="none";
			document.getElementById("RESN_confidential").style.display="none";
			document.getElementById("RESN_"+resn_val).style.display="inline";
			if (resn_val=='none') resn_val='';
			document.getElementById("<?php 
                                    echo $element_id;
                                    ?>
").value=resn_val;
		}
		//-->
		</script>
		<?php 
                                    if (!$PRIVACY_BY_RESN && $level == 1) {
                                        // warn user that level 1 RESN tags have no effect when PRIVACY_BY_RESN is false
                                        echo "<small>" . $pgv_lang["resn_disabled"] . "</small>";
                                    }
                                    echo "<input type=\"hidden\" id=\"" . $element_id . "\" name=\"" . $element_name . "\" value=\"" . $value . "\" />\n";
                                    echo "<table><tr valign=\"top\">\n";
                                    foreach (array("none", "locked", "privacy", "confidential") as $resn_index => $resn_val) {
                                        if ($resn_val == "none") {
                                            $resnv = "";
                                        } else {
                                            $resnv = $resn_val;
                                        }
                                        echo "<td><input tabindex=\"" . $tabkey . "\" type=\"radio\" name=\"RESN_radio\" onclick=\"update_RESN_img('" . $resn_val . "')\"";
                                        echo " value=\"" . $resnv . "\"";
                                        if ($value == $resnv) {
                                            echo " checked=\"checked\"";
                                        }
                                        echo " /><small>" . $pgv_lang[$resn_val] . "</small>";
                                        echo "<br />&nbsp;<img id=\"RESN_" . $resn_val . "\" src=\"images/RESN_" . $resn_val . ".gif\"  alt=\"" . $pgv_lang[$resn_val] . "\" title=\"" . $pgv_lang[$resn_val] . "\" border=\"0\"";
                                        if ($value == $resnv) {
                                            echo " style=\"display:inline\"";
                                        } else {
                                            echo " style=\"display:none\"";
                                        }
                                        echo " /></td>\n";
                                    }
                                    echo "</tr></table>\n";
                                } else {
                                    if ($fact == "_PRIM" or $fact == "_THUM") {
                                        echo "<select tabindex=\"" . $tabkey . "\" id=\"" . $element_id . "\" name=\"" . $element_name . "\" >\n";
                                        echo "<option value=\"\"></option>\n";
                                        echo "<option value=\"Y\"";
                                        if ($value == "Y") {
                                            echo " selected=\"selected\"";
                                        }
                                        echo ">" . $pgv_lang["yes"] . "</option>\n";
                                        echo "<option value=\"N\"";
                                        if ($value == "N") {
                                            echo " selected=\"selected\"";
                                        }
                                        echo ">" . $pgv_lang["no"] . "</option>\n";
                                        echo "</select>\n";
                                    } else {
                                        if ($fact == "SEX") {
                                            echo "<select tabindex=\"" . $tabkey . "\" id=\"" . $element_id . "\" name=\"" . $element_name . "\">\n<option value=\"M\"";
                                            if ($value == "M") {
                                                echo " selected=\"selected\"";
                                            }
                                            echo ">" . $pgv_lang["male"] . "</option>\n<option value=\"F\"";
                                            if ($value == "F") {
                                                echo " selected=\"selected\"";
                                            }
                                            echo ">" . $pgv_lang["female"] . "</option>\n<option value=\"U\"";
                                            if ($value == "U" || empty($value)) {
                                                echo " selected=\"selected\"";
                                            }
                                            echo ">" . $pgv_lang["unknown"] . "</option>\n</select>\n";
                                        } else {
                                            if ($fact == "TYPE" && $level == '3') {
                                                //-- Build array of currently defined values for this Media Fact
                                                foreach ($pgv_lang as $varname => $typeValue) {
                                                    if (substr($varname, 0, 6) == "TYPE__") {
                                                        if ($varname != "TYPE__other") {
                                                            $type[strtolower(substr($varname, 6))] = $typeValue;
                                                        }
                                                    }
                                                }
                                                //-- Sort the array into a meaningful order
                                                array_flip($type);
                                                asort($type);
                                                array_flip($type);
                                                //-- Add "Other" at the end of the list
                                                $type["other"] = $pgv_lang["TYPE__other"];
                                                //-- Build the selector for the Media "TYPE" Fact
                                                echo "<select tabindex=\"" . $tabkey . "\" name=\"text[]\">";
                                                if ($value == "") {
                                                    echo "<option selected=\"selected\" value=\"\" > " . $pgv_lang["choose"] . " </option>";
                                                }
                                                $selectedValue = strtolower($value);
                                                foreach ($type 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=\"" . PrintReady(htmlspecialchars($value, ENT_COMPAT, 'UTF-8')) . "\" />";
                                                    echo "<span id=\"" . $element_id . "_display\">" . PrintReady(htmlspecialchars($value, ENT_COMPAT, 'UTF-8')) . "</span>";
                                                    echo " <a href=\"#edit_name\" onclick=\"convertHidden('" . $element_id . "'); return false;\"> ";
                                                    if (isset($PGV_IMAGES["edit_indi"]["small"])) {
                                                        echo "<img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["edit_indi"]["small"] . "\" border=\"0\" width=\"20\" alt=\"" . $pgv_lang["edit_name"] . "\" align=\"top\" />";
                                                    } else {
                                                        echo "<span class=\"age\">[" . $pgv_lang["edit_name"] . "]</span>";
                                                    }
                                                    echo "</a>";
                                                } else {
                                                    // textarea
                                                    if ($rows > 1) {
                                                        echo "<textarea tabindex=\"" . $tabkey . "\" id=\"" . $element_id . "\" name=\"" . $element_name . "\" rows=\"" . $rows . "\" cols=\"" . $cols . "\">" . PrintReady(htmlspecialchars($value, ENT_COMPAT, 'UTF-8')) . "</textarea><br />\n";
                                                    } else {
                                                        // text
                                                        echo "<input tabindex=\"" . $tabkey . "\" type=\"text\" id=\"" . $element_id . "\" name=\"" . $element_name . "\" value=\"" . PrintReady(htmlspecialchars($value, ENT_COMPAT, 'UTF-8')) . "\" size=\"" . $cols . "\" dir=\"ltr\"";
                                                        echo " class=\"{$fact}\"";
                                                        echo " autocomplete=\"off\"";
                                                        if (in_array($fact, $subnamefacts)) {
                                                            echo " onblur=\"updatewholename();\" onkeyup=\"updatewholename();\"";
                                                        }
                                                        if ($fact == "DATE") {
                                                            echo " onblur=\"valid_date(this);\" onmouseout=\"valid_date(this);\"";
                                                        }
                                                        if ($fact == "LATI") {
                                                            echo " onblur=\"valid_lati_long(this, 'N', 'S');\" onmouseout=\"valid_lati_long(this, 'N', 'S');\"";
                                                        }
                                                        if ($fact == "LONG") {
                                                            echo " onblur=\"valid_lati_long(this, 'E', 'W');\" onmouseout=\"valid_lati_long(this, 'E', 'W');\"";
                                                        }
                                                        //if ($fact=="FILE") echo " onchange=\"if (updateFormat) updateFormat(this.value);\"";
                                                        echo " " . $readOnly . " />\n";
                                                    }
                                                    // split PLAC
                                                    if ($fact == "PLAC" && $readOnly == "") {
                                                        echo "<div id=\"" . $element_id . "_pop\" style=\"display: inline;\">\n";
                                                        print_specialchar_link($element_id, false);
                                                        print_findplace_link($element_id);
                                                        echo "</div>\n";
                                                        echo "<a href=\"javascript:;\" onclick=\"toggle_lati_long();\"><img src=\"images/buttons/target.gif\" border=\"0\" align=\"middle\" alt=\"" . $factarray["LATI"] . " / " . $factarray["LONG"] . "\" title=\"" . $factarray["LATI"] . " / " . $factarray["LONG"] . "\" /></a>";
                                                        if ($SPLIT_PLACES) {
                                                            if (!function_exists("print_place_subfields")) {
                                                                require "includes/functions/functions_places.php";
                                                            }
                                                            setup_place_subfields($element_id);
                                                            print_place_subfields($element_id);
                                                        }
                                                    } else {
                                                        if (($cols > 20 || $fact == "NPFX") && $readOnly == "") {
                                                            print_specialchar_link($element_id, false);
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    // MARRiage TYPE : hide text field and show a selection list
    if ($fact == "TYPE" and $tags[0] == "MARR") {
        echo "<script type='text/javascript'>";
        echo "document.getElementById('" . $element_id . "').style.display='none'";
        echo "</script>";
        echo "<select tabindex=\"" . $tabkey . "\" id=\"" . $element_id . "_sel\" onchange=\"document.getElementById('" . $element_id . "').value=this.value;\" >\n";
        foreach (array("Unknown", "Civil", "Religious", "Partners") as $indexval => $key) {
            if ($key == "Unknown") {
                echo "<option value=\"\"";
            } else {
                echo "<option value=\"" . $key . "\"";
            }
            $a = strtolower($key);
            $b = strtolower($value);
            if (@strpos($a, $b) !== false or @strpos($b, $a) !== false) {
                echo " selected=\"selected\"";
            }
            echo ">" . $factarray["MARR_" . strtoupper($key)] . "</option>\n";
        }
        echo "</select>";
    }
    // popup links
    if ($readOnly == "") {
        if ($fact == "DATE") {
            print_calendar_popup($element_id);
        }
        if ($fact == "FAMC") {
            print_findfamily_link($element_id, "");
        }
        if ($fact == "FAMS") {
            print_findfamily_link($element_id, "");
        }
        if ($fact == "ASSO") {
            print_findindi_link($element_id, "");
        }
        if ($fact == "FILE") {
            print_findmedia_link($element_id, "0file");
        }
        if ($fact == "SOUR") {
            print_findsource_link($element_id);
            print_addnewsource_link($element_id);
            //print_autopaste_link($element_id, array("S1", "S2"), false, false, true);
            //-- 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 '&nbsp;<input type="checkbox" name="SOUR_INDI" ', $level1_checked, ' value="Y" />';
                    echo $pgv_lang['individual'];
                    if (preg_match_all('/(' . PGV_REGEX_TAG . ')/', $QUICK_REQUIRED_FACTS, $matches)) {
                        foreach ($matches[1] as $match) {
                            if (!in_array($match, explode('|', PGV_EVENTS_DEAT))) {
                                echo '&nbsp;<input type="checkbox" name="SOUR_', $match, '"', $level2_checked, ' value="Y" />';
                                echo $factarray[$match];
                            }
                        }
                    }
                }
                if (strpos($bdm, 'D') !== false) {
                    if (preg_match_all('/(' . PGV_REGEX_TAG . ')/', $QUICK_REQUIRED_FACTS, $matches)) {
                        foreach ($matches[1] as $match) {
                            if (in_array($match, explode('|', PGV_EVENTS_DEAT))) {
                                echo '&nbsp;<input type="checkbox" name="SOUR_', $match, '"', $level2_checked, ' value="Y" />';
                                echo $factarray[$match];
                            }
                        }
                    }
                }
                if (strpos($bdm, 'M') !== false) {
                    echo '&nbsp;<input type="checkbox" name="SOUR_FAM" ', $level1_checked, ' value="Y" />';
                    echo $pgv_lang["family"];
                    if (preg_match_all('/(' . PGV_REGEX_TAG . ')/', $QUICK_REQUIRED_FAMFACTS, $matches)) {
                        foreach ($matches[1] as $match) {
                            echo '&nbsp;<input type="checkbox" name="SOUR_', $match, '"', $level2_checked, ' value="Y" />';
                            echo $factarray[$match];
                        }
                    }
                }
            }
        }
        if ($fact == "REPO") {
            print_findrepository_link($element_id);
            print_addnewrepository_link($element_id);
        }
        // Shared Notes Icons ========================================
        // $record=GedcomRecord::getInstance($value);
        if ($fact == "NOTE" && $islink) {
            print_findnote_link($element_id);
            print_addnewnote_link($element_id);
            if ($value != "") {
                echo "&nbsp;&nbsp;&nbsp;";
                print_editnote_link($value);
            }
            // If GEDFAct_assistant/_CENS/ module exists && we are on the INDI page
            // Then show the add Shared note assisted icon, if not  ... do not show
            if ($pid) {
                $type_pid = GedcomRecord::getInstance($pid);
                if (file_exists('modules/GEDFact_assistant/_CENS/census_1_ctrl.php') && $type_pid->getType() == "INDI") {
                    echo "&nbsp;&nbsp;&nbsp;";
                    print_addnewnote_assisted_link($element_id);
                }
            }
            echo "<br />";
        }
        // ===========================================================
        if ($fact == "OBJE") {
            print_findmedia_link($element_id, "1media");
        }
        if ($fact == "OBJE" && !$value) {
            print_addnewmedia_link($element_id);
            $value = "new";
        }
    }
    // current value
    if ($TEXT_DIRECTION == "ltr") {
        if ($fact == "DATE") {
            $date = new GedcomDate($value);
            echo $date->Display(false);
        }
        if (($fact == "ASSO" || $fact == "SOUR" || $fact == "OBJE" || $fact == "NOTE" && $islink) && $value) {
            $record = GedcomRecord::getInstance($value);
            if ($record) {
                echo ' ', PrintReady($record->getFullName()), ' (', $value, ')';
            } else {
                if ($value != "new") {
                    echo ' ', $value;
                }
            }
        }
    } else {
        if ($fact == "DATE") {
            $date = new GedcomDate($value);
            echo getRLM(), $date->Display(false), getRLM();
        }
        if (($fact == "ASSO" || $fact == "SOUR" || $fact == "OBJE" || $fact == "NOTE" && $islink) && $value) {
            $record = GedcomRecord::getInstance($value);
            if ($record) {
                echo getRLM(), PrintReady($record->getFullName()), ' ', getLRM(), '(', $value, ') ', getLRM(), getRLM();
            } else {
                if ($value != "new") {
                    echo getRLM(), $value, ' ', getRLM();
                }
            }
        }
    }
    /*
    	if ($fact=="NOTE" && $islink && $value!="") {
    		include('includes/functions/functions_print_lists.php'); 
    		echo "<tr><td class=\"descriptionbox ".$TEXT_DIRECTION." wrap width25\">";
    				print_help_link("edit_add_SHARED_NOTE_help", "qm");
    			//	echo $pgv_lang["admin_override"];
    			echo "Shared Note Links<br /><br />";
    		echo "</td><td class=\"optionbox wrap\">\n";
    			print_indi_list(fetch_linked_indi($value, "NOTE", "1"));
    		echo "</td></tr>\n";
    	}
    */
    // pastable values
    if ($readOnly == "") {
        if ($fact == "SPFX") {
            print_autopaste_link($element_id, $SPFX_accept);
        }
        if ($fact == "NSFX") {
            print_autopaste_link($element_id, $NSFX_accept);
        }
        if ($fact == "FORM") {
            print_autopaste_link($element_id, $FILE_FORM_accept, false, false);
        }
    }
    if ($noClose != "NOCLOSE") {
        echo "</td></tr>\n";
    }
    $tabkey++;
    return $element_id;
}
Ejemplo n.º 2
0
    public function modAction($mod_action)
    {
        switch ($mod_action) {
            case 'ajax':
                $html = $this->getSidebarAjaxContent();
                Zend_Session::writeClose();
                header('Content-Type: text/html; charset=UTF-8');
                echo $html;
                break;
            case 'index':
                global $MAX_PEDIGREE_GENERATIONS, $controller, $WT_SESSION, $GEDCOM_MEDIA_PATH;
                require_once WT_ROOT . WT_MODULES_DIR . 'clippings/clippings_ctrl.php';
                require_once WT_ROOT . 'includes/functions/functions_export.php';
                $clip_ctrl = new WT_Controller_Clippings();
                $controller = new WT_Controller_Page();
                $controller->setPageTitle($this->getTitle())->PageHeader()->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')->addInlineJavascript('autocomplete();');
                echo '<script>';
                echo 'function radAncestors(elementid) {var radFamilies=document.getElementById(elementid);radFamilies.checked=true;}';
                echo '</script>';
                if (!$WT_SESSION->cart[WT_GED_ID]) {
                    echo '<h2>', WT_I18N::translate('Family tree clippings cart'), '</h2>';
                }
                if ($clip_ctrl->action == 'add') {
                    $person = WT_GedcomRecord::getInstance($clip_ctrl->id);
                    echo '<h3><a href="', $person->getHtmlUrl(), '">' . $person->getFullName(), '</a></h3>';
                    if ($clip_ctrl->type == 'fam') {
                        ?>
					<form action="module.php" method="get">
					<input type="hidden" name="mod" value="clippings">
					<input type="hidden" name="mod_action" value="index">
					<table>
						<tr><td class="topbottombar"><?php 
                        echo WT_I18N::translate('Which other links from this family would you like to add?');
                        ?>
						<input type="hidden" name="id" value="<?php 
                        echo $clip_ctrl->id;
                        ?>
">
						<input type="hidden" name="type" value="<?php 
                        echo $clip_ctrl->type;
                        ?>
">
						<input type="hidden" name="action" value="add1"></td></tr>
						<tr><td class="optionbox"><input type="radio" name="others" checked value="none"><?php 
                        echo WT_I18N::translate('Add just this family record.');
                        ?>
</td></tr>
						<tr><td class="optionbox"><input type="radio" name="others" value="parents"><?php 
                        echo WT_I18N::translate('Add parents’ records together with this family record.');
                        ?>
</td></tr>
						<tr><td class="optionbox"><input type="radio" name="others" value="members"><?php 
                        echo WT_I18N::translate('Add parents’ and children’s records together with this family record.');
                        ?>
</td></tr>
						<tr><td class="optionbox"><input type="radio" name="others" value="descendants"><?php 
                        echo WT_I18N::translate('Add parents’ and all descendants’ records together with this family record.');
                        ?>
</td></tr>
						<tr><td class="topbottombar"><input type="submit" value="<?php 
                        echo WT_I18N::translate('Continue adding');
                        ?>
"></td></tr>

					</table>
					</form>
				<?php 
                    } else {
                        if ($clip_ctrl->type == 'indi') {
                            ?>
					<form action="module.php" method="get">
					<input type="hidden" name="mod" value="clippings">
					<input type="hidden" name="mod_action" value="index">
					<table>
						<tr><td class="topbottombar"><?php 
                            echo WT_I18N::translate('Which links from this individual would you also like to add?');
                            ?>
						<input type="hidden" name="id" value="<?php 
                            echo $clip_ctrl->id;
                            ?>
">
						<input type="hidden" name="type" value="<?php 
                            echo $clip_ctrl->type;
                            ?>
">
						<input type="hidden" name="action" value="add1"></td></tr>
						<tr><td class="optionbox"><input type="radio" name="others" checked value="none"><?php 
                            echo WT_I18N::translate('Add just this individual.');
                            ?>
</td></tr>
						<tr><td class="optionbox"><input type="radio" name="others" value="parents"><?php 
                            echo WT_I18N::translate('Add this individual, his parents, and siblings.');
                            ?>
</td></tr>
						<tr><td class="optionbox"><input type="radio" name="others" value="ancestors" id="ancestors"><?php 
                            echo WT_I18N::translate('Add this individual and his direct line ancestors.');
                            ?>
<br>
							&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php 
                            echo WT_I18N::translate('Number of generations:');
                            ?>
 <input type="text" size="5" name="level1" value="<?php 
                            echo $MAX_PEDIGREE_GENERATIONS;
                            ?>
" onfocus="radAncestors('ancestors');"></td></tr>
						<tr><td class="optionbox"><input type="radio" name="others" value="ancestorsfamilies" id="ancestorsfamilies"><?php 
                            echo WT_I18N::translate('Add this individual, his direct line ancestors, and their families.');
                            ?>
<br >
							&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php 
                            echo WT_I18N::translate('Number of generations:');
                            ?>
 <input type="text" size="5" name="level2" value="<?php 
                            echo $MAX_PEDIGREE_GENERATIONS;
                            ?>
" onfocus="radAncestors('ancestorsfamilies');"></td></tr>
						<tr><td class="optionbox"><input type="radio" name="others" value="members"><?php 
                            echo WT_I18N::translate('Add this individual, his spouse, and children.');
                            ?>
</td></tr>
						<tr><td class="optionbox"><input type="radio" name="others" value="descendants" id="descendants"><?php 
                            echo WT_I18N::translate('Add this individual, his spouse, and all descendants.');
                            ?>
<br >
							&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php 
                            echo WT_I18N::translate('Number of generations:');
                            ?>
 <input type="text" size="5" name="level3" value="<?php 
                            echo $MAX_PEDIGREE_GENERATIONS;
                            ?>
" onfocus="radAncestors('descendants');"></td></tr>
						<tr><td class="topbottombar"><input type="submit" value="<?php 
                            echo WT_I18N::translate('Continue adding');
                            ?>
">
					</table>
					</form>
				<?php 
                        } else {
                            if ($clip_ctrl->type == 'sour') {
                                ?>
					<form action="module.php" method="get">
					<input type="hidden" name="mod" value="clippings">
					<input type="hidden" name="mod_action" value="index">
					<table>
						<tr><td class="topbottombar"><?php 
                                echo WT_I18N::translate('Which records linked to this source should be added?');
                                ?>
						<input type="hidden" name="id" value="<?php 
                                echo $clip_ctrl->id;
                                ?>
">
						<input type="hidden" name="type" value="<?php 
                                echo $clip_ctrl->type;
                                ?>
">
						<input type="hidden" name="action" value="add1"></td></tr>
						<tr><td class="optionbox"><input type="radio" name="others" checked value="none"><?php 
                                echo WT_I18N::translate('Add just this source.');
                                ?>
</td></tr>
						<tr><td class="optionbox"><input type="radio" name="others" value="linked"><?php 
                                echo WT_I18N::translate('Add this source and families/individuals linked to it.');
                                ?>
</td></tr>
						<tr><td class="topbottombar"><input type="submit" value="<?php 
                                echo WT_I18N::translate('Continue adding');
                                ?>
">
					</table>
					</form>
				<?php 
                            }
                        }
                    }
                }
                if ($clip_ctrl->privCount > 0) {
                    echo "<span class=\"error\">" . WT_I18N::translate('Some items could not be added due to privacy restrictions') . "</span><br><br>";
                }
                if (!$WT_SESSION->cart[WT_GED_ID]) {
                    if ($clip_ctrl->action != 'add') {
                        echo WT_I18N::translate('The clippings cart allows you to take extracts (“clippings”) from this family tree and bundle them up into a single file for downloading and subsequent importing into your own genealogy program.  The downloadable file is recorded in GEDCOM format.<br><ul><li>How to take clippings?<br>This is really simple. Whenever you see a clickable name (individual, family, or source) you can go to the Details page of that name. There you will see the <b>Add to clippings cart</b> option.  When you click that link you will be offered several options to download.</li><li>How to download?<br>Once you have items in your cart, you can download them just by clicking the “Download” link.  Follow the instructions and links.</li></ul>');
                        ?>
					<form method="get" name="addin" action="module.php">
					<input type="hidden" name="mod" value="clippings">
					<input type="hidden" name="mod_action" value="index">
					<table>
					<tr>
						<td colspan="2" class="topbottombar" style="text-align:center; ">
							<?php 
                        echo WT_I18N::translate('Enter an individual, family, or source ID'), help_link('add_by_id', $this->getName());
                        ?>
						</td>
					</tr>
					<tr>
						<td class="optionbox">
							<input type="hidden" name="action" value="add">
							<input type="text" data-autocomplete-type="IFSRO" name="id" id="cart_item_id" size="5">
						</td>
						<td class="optionbox">
							<?php 
                        echo print_findindi_link('cart_item_id');
                        ?>
							<?php 
                        echo print_findfamily_link('cart_item_id');
                        ?>
							<?php 
                        echo print_findsource_link('cart_item_id', '');
                        ?>
							<input type="submit" value="<?php 
                        echo WT_I18N::translate('Add');
                        ?>
">

						</td>
					</tr>
					</table>
					</form>
					<?php 
                    }
                    // -- end new lines
                    echo WT_I18N::translate('Your clippings cart is empty.');
                } else {
                    // Keep track of the INDI from the parent page, otherwise it will
                    // get lost after ajax updates
                    $pid = WT_Filter::get('pid', WT_REGEX_XREF);
                    if ($clip_ctrl->action != 'download' && $clip_ctrl->action != 'add') {
                        ?>
					<table><tr><td class="width33" valign="top" rowspan="3">
					<form method="get" action="module.php">
					<input type="hidden" name="mod" value="clippings">
					<input type="hidden" name="mod_action" value="index">
					<input type="hidden" name="action" value="download">
					<input type="hidden" name="pid" value="<?php 
                        echo $pid;
                        ?>
">
					<table>
					<tr><td colspan="2" class="topbottombar"><h2><?php 
                        echo WT_I18N::translate('Download');
                        ?>
</h2></td></tr>
					<tr><td class="descriptionbox width50 wrap"><?php 
                        echo WT_I18N::translate('Zip file(s)'), help_link('zip');
                        ?>
</td>
					<td class="optionbox"><input type="checkbox" name="Zip" value="yes"></td></tr>

					<tr><td class="descriptionbox width50 wrap"><?php 
                        echo WT_I18N::translate('Include media (automatically zips files)'), help_link('include_media');
                        ?>
</td>
					<td class="optionbox"><input type="checkbox" name="IncludeMedia" value="yes"></td></tr>

					<?php 
                        if (WT_USER_GEDCOM_ADMIN) {
                            ?>
						<tr><td class="descriptionbox width50 wrap"><?php 
                            echo WT_I18N::translate('Apply privacy settings?'), help_link('apply_privacy');
                            ?>
</td>
						<td class="optionbox">
							<input type="radio" name="privatize_export" value="none" checked="checked"> <?php 
                            echo WT_I18N::translate('None');
                            ?>
<br>
							<input type="radio" name="privatize_export" value="gedadmin"> <?php 
                            echo WT_I18N::translate('Manager');
                            ?>
<br>
							<input type="radio" name="privatize_export" value="user"> <?php 
                            echo WT_I18N::translate('Member');
                            ?>
<br>
							<input type="radio" name="privatize_export" value="visitor"> <?php 
                            echo WT_I18N::translate('Visitor');
                            ?>
						</td></tr>
					<?php 
                        } elseif (WT_USER_CAN_ACCESS) {
                            ?>
						<tr><td class="descriptionbox width50 wrap"><?php 
                            echo WT_I18N::translate('Apply privacy settings?'), help_link('apply_privacy');
                            ?>
</td>
						<td class="optionbox">
							<input type="radio" name="privatize_export" value="user" checked="checked"> <?php 
                            echo WT_I18N::translate('Member');
                            ?>
<br>
							<input type="radio" name="privatize_export" value="visitor"> <?php 
                            echo WT_I18N::translate('Visitor');
                            ?>
						</td></tr>
					<?php 
                        }
                        ?>

					<tr><td class="descriptionbox width50 wrap"><?php 
                        echo WT_I18N::translate('Convert from UTF-8 to ANSI (ISO-8859-1)'), help_link('utf8_ansi');
                        ?>
</td>
					<td class="optionbox"><input type="checkbox" name="convert" value="yes"></td></tr>

					<tr><td class="descriptionbox width50 wrap"><?php 
                        echo WT_I18N::translate('Add the GEDCOM media path to filenames'), help_link('GEDCOM_MEDIA_PATH');
                        ?>
</td>
					<td class="optionbox">
						<input type="checkbox" name="conv_path" value="<?php 
                        echo WT_Filter::escapeHtml($GEDCOM_MEDIA_PATH);
                        ?>
">
						<span dir="auto"><?php 
                        echo WT_Filter::escapeHtml($GEDCOM_MEDIA_PATH);
                        ?>
</span>
					</td></tr>

					<tr><td class="topbottombar" colspan="2">
					<input type="submit" value="<?php 
                        echo WT_I18N::translate('Download');
                        ?>
">
					</form>
					</td></tr>
					</table>
					</td></tr>
					</table>
					<br>

					<form method="get" name="addin" action="module.php">
					<input type="hidden" name="mod" value="clippings">
					<input type="hidden" name="mod_action" value="index">
					<table>
					<tr>
						<td colspan="2" class="topbottombar" style="text-align:center; ">
							<?php 
                        echo WT_I18N::translate('Enter an individual, family, or source ID'), help_link('add_by_id', $this->getName());
                        ?>
						</td>
					</tr>
					<tr>
						<td class="optionbox">
							<input type="hidden" name="action" value="add">
							<input type="text" data-autocomplete-type="IFSRO" name="id" id="cart_item_id" size="8">
						</td>
						<td class="optionbox">
							<?php 
                        echo print_findindi_link('cart_item_id');
                        ?>
							<?php 
                        echo print_findfamily_link('cart_item_id');
                        ?>
							<?php 
                        echo print_findsource_link('cart_item_id');
                        ?>
							<input type="submit" value="<?php 
                        echo WT_I18N::translate('Add');
                        ?>
">

						</td>
					</tr>
					</table>
					</form>


				<?php 
                    }
                    ?>
				<br><a href="module.php?mod=clippings&amp;mod_action=index&amp;action=empty"><?php 
                    echo WT_I18N::translate('Empty the clippings cart');
                    ?>
</a><?php 
                    echo help_link('empty_cart', $this->getName());
                    ?>
				</td></tr>

				<tr><td class="topbottombar"><h2><?php 
                    echo WT_I18N::translate('Family tree clippings cart');
                    ?>
</h2></td></tr>

				<tr><td valign="top">
				<table id="mycart" class="sortable list_table width100">
					<tr>
						<th class="list_label"><?php 
                    echo WT_I18N::translate('Record');
                    ?>
</th>
						<th class="list_label"><?php 
                    echo WT_I18N::translate('Remove');
                    ?>
</th>
					</tr>
			<?php 
                    foreach (array_keys($WT_SESSION->cart[WT_GED_ID]) as $xref) {
                        $record = WT_GedcomRecord::getInstance($xref);
                        if ($record) {
                            switch ($record::RECORD_TYPE) {
                                case 'INDI':
                                    $icon = 'icon-indis';
                                    break;
                                case 'FAM':
                                    $icon = 'icon-sfamily';
                                    break;
                                case 'SOUR':
                                    $icon = 'icon-source';
                                    break;
                                case 'REPO':
                                    $icon = 'icon-repository';
                                    break;
                                case 'NOTE':
                                    $icon = 'icon-note';
                                    break;
                                case 'OBJE':
                                    $icon = 'icon-media';
                                    break;
                                default:
                                    $icon = 'icon-clippings';
                                    break;
                            }
                            ?>
						<tr><td class="list_value">
							<i class="<?php 
                            echo $icon;
                            ?>
"></i>
						<?php 
                            echo '<a href="', $record->getHtmlUrl(), '">', $record->getFullName(), '</a>';
                            ?>
						</td>
						<td class="list_value center vmiddle"><a href="module.php?mod=clippings&amp;mod_action=index&amp;action=remove&amp;id=<?php 
                            echo $xref;
                            ?>
" class="icon-remove" title="<?php 
                            echo WT_I18N::translate('Remove');
                            ?>
"></a></td>
					</tr>
					<?php 
                        }
                    }
                    ?>
				</table>
				</td></tr></table>
			<?php 
                }
                break;
            default:
                header('HTTP/1.0 404 Not Found');
                break;
        }
    }
Ejemplo n.º 3
0
echo '<form method="post" name="newmedia" action="addmedia.php" enctype="multipart/form-data">';
echo '<input type="hidden" name="action" value="', $action, '">';
echo '<input type="hidden" name="ged" value="', WT_GEDCOM, '">';
echo '<input type="hidden" name="pid" value="', $pid, '">';
if ($linktoid) {
    echo '<input type="hidden" name="linktoid" value="', $linktoid, '">';
}
echo '<table class="facts_table">';
echo '<tr><td class="topbottombar" colspan="2">';
echo $controller->getPageTitle(), help_link('OBJE');
echo '</td></tr>';
if (!$linktoid && $action == 'create') {
    echo '<tr><td class="descriptionbox wrap width25">';
    echo WT_I18N::translate('Enter an individual, family, or source ID');
    echo '</td><td class="optionbox wrap"><input type="text" data-autocomplete-type="IFS" name="linktoid" id="linktoid" size="6" value="">';
    echo ' ', print_findindi_link('linktoid');
    echo ' ', print_findfamily_link('linktoid');
    echo ' ', print_findsource_link('linktoid');
    echo '<p class="sub">', WT_I18N::translate('Enter or search for the ID of the individual, family, or source to which this media item should be linked.'), '</p></td></tr>';
}
$tmp = WT_Media::getInstance($pid);
if ($tmp) {
    $gedrec = $tmp->getGedcom();
} else {
    $gedrec = '';
}
// 0 OBJE
// 1 FILE
if ($gedrec == '') {
    $gedfile = 'FILE';
    if ($filename != '') {
Ejemplo n.º 4
0
	<?php 
}
if (!isset($col)) {
    $col = 0;
}
?>
		<td class="person<?php 
echo $col;
?>
" style="padding: 5px;" valign="top">
			<?php 
echo WT_I18N::translate('Add another individual to the chart'), '<br>';
?>
			<input class="pedigree_form" data-autocomplete-type="INDI" type="text" size="5" id="newpid" name="newpid">
			<?php 
echo print_findindi_link('newpid');
?>
			<br>
			<br>
			<div style="text-align: center;"><input type="submit" value="<?php 
echo WT_I18N::translate('Add');
?>
"></div>
		</td>
	<?php 
if (count($controller->people) > 0) {
    $scalemod = round($controller->scale * 0.2) + 1;
    ?>
		<td class="list_value" style="padding: 5px;">
			<a href="<?php 
    echo WT_SCRIPT_NAME . "?" . $controller->pidlinks . "scale=" . ($controller->scale + $scalemod);
Ejemplo n.º 5
0
    ?>
</td>
	<td class="optionbox"><input type="text" name="NEW_PEDIGREE_ROOT_ID" id="NEW_PEDIGREE_ROOT_ID" value="<?php 
    print $PEDIGREE_ROOT_ID;
    ?>
" size="5" tabindex="<?php 
    $i++;
    print $i;
    ?>
" onfocus="getHelp('PEDIGREE_ROOT_ID_help');" />
			<?php 
    // We can only show the person's details if we're editing an existing
    // gedcom.  Otherwise there could be a mismatch between DB and FILE,
    // or we could be uploading a new file, which we haven't seen yet.
    if ($source == '') {
        print_findindi_link("NEW_PEDIGREE_ROOT_ID", "");
        if ($PEDIGREE_ROOT_ID) {
            $person = Person::getInstance($PEDIGREE_ROOT_ID);
            if ($person) {
                echo ' <span class="list_item">', $person->getFullName(), ' ', $person->format_first_major_fact(PGV_EVENTS_BIRT, 1), '</span>';
            } else {
                echo ' <span class="error">', $pgv_lang['unable_to_find_record'], '</span>';
            }
        }
    }
    ?>
		</td>
	</tr>
	<tr>
		<td class="descriptionbox wrap width20">
		<?php 
Ejemplo n.º 6
0
function print_user_favorites($block = true, $config = "", $side, $index)
{
    global $pgv_lang, $PGV_IMAGE_DIR, $PGV_IMAGES, $GEDCOM, $TEXT_DIRECTION, $INDEX_DIRECTORY, $MEDIA_DIRECTORY, $MULTI_MEDIA, $MEDIA_DIRECTORY_LEVELS, $ctype;
    global $show_full, $PEDIGREE_FULL_DETAILS, $BROWSERTYPE, $ENABLE_AUTOCOMPLETE;
    // Override GEDCOM configuration temporarily
    if (isset($show_full)) {
        $saveShowFull = $show_full;
    }
    $savePedigreeFullDetails = $PEDIGREE_FULL_DETAILS;
    $show_full = 1;
    $PEDIGREE_FULL_DETAILS = 1;
    $userfavs = getUserFavorites(PGV_USER_NAME);
    if (!is_array($userfavs)) {
        $userfavs = array();
    }
    $id = "user_favorites";
    $title = print_help_link("mygedview_favorites_help", "qm", "", false, true);
    $title .= $pgv_lang["my_favorites"] . "&nbsp;&nbsp;";
    if ($TEXT_DIRECTION == "rtl") {
        $title .= getRLM();
    }
    $title .= "(" . count($userfavs) . ")";
    if ($TEXT_DIRECTION == "rtl") {
        $title .= getRLM();
    }
    if ($ENABLE_AUTOCOMPLETE) {
        $content = '<script type="text/javascript" src="js/jquery/jquery.min.js"></script>
		<script type="text/javascript" src="js/jquery/jquery.autocomplete.js"></script>
		<script type="text/javascript" src="js/jquery/jquery.ajaxQueue.js"></script>
		<script type="text/javascript">
		jQuery.noConflict(); // @see http://docs.jquery.com/Using_jQuery_with_Other_Libraries/
		jQuery(document).ready(function($){
			$("input[name^=gid]").autocomplete("autocomplete.php", {
				extraParams: {field:"IFSRO"},
				formatItem: function(row, i) {
					return row[0] + " (" + row[1] + ")";
				},
				formatResult: function(row) {
					return row[1];
				},
				width: 400,
				minChars: 2
			});
		});
		</script>';
    } else {
        $content = '';
    }
    if ($block) {
        $style = 2;
        // 1 means "regular box", 2 means "wide box"
        $tableWidth = $BROWSERTYPE == "msie" ? "95%" : "99%";
        // IE needs to have room for vertical scroll bar inside the box
        $cellSpacing = "1px";
    } else {
        $style = 2;
        $tableWidth = "99%";
        $cellSpacing = "3px";
    }
    if (count($userfavs) == 0) {
        $content .= print_text("no_favorites", 0, 1);
    } else {
        $mygedcom = $GEDCOM;
        $current_gedcom = $GEDCOM;
        $content .= "<table width=\"{$tableWidth}\" style=\"border:none\" cellspacing=\"{$cellSpacing}\" class=\"center {$TEXT_DIRECTION}\">";
        foreach ($userfavs as $key => $favorite) {
            if (isset($favorite["id"])) {
                $key = $favorite["id"];
            }
            $removeFavourite = "<a class=\"font9\" href=\"" . encode_url("index.php?ctype={$ctype}&action=deletefav&fv_id={$key}") . "\" onclick=\"return confirm('" . $pgv_lang["confirm_fav_remove"] . "');\">" . $pgv_lang["remove"] . "</a><br />";
            $current_gedcom = $GEDCOM;
            $GEDCOM = $favorite["file"];
            $content .= "<tr><td>";
            if ($favorite["type"] == "URL") {
                $content .= "<div id=\"boxurl" . $key . ".0\" class=\"person_box\">";
                if ($ctype == "user" || PGV_USER_IS_ADMIN) {
                    $content .= $removeFavourite;
                }
                $content .= "<a href=\"" . $favorite["url"] . "\">" . PrintReady($favorite["title"]) . "</a>";
                $content .= "<br />" . PrintReady($favorite["note"]);
            } else {
                require $INDEX_DIRECTORY . $GEDCOM . '_conf.php';
                $indirec = find_gedcom_record($favorite["gid"], PGV_GED_ID);
                if ($favorite["type"] == "INDI") {
                    $content .= "<div id=\"box" . $favorite["gid"] . ".0\" class=\"person_box";
                    if (strpos($indirec, "\n1 SEX F") !== false) {
                        $content .= "F";
                    } elseif (strpos($indirec, "\n1 SEX M") !== false) {
                        $content .= "";
                    } else {
                        $content .= "NN";
                    }
                    $content .= "\">";
                    if ($ctype == "user" || PGV_USER_IS_ADMIN) {
                        $content .= $removeFavourite;
                    }
                    ob_start();
                    print_pedigree_person($favorite["gid"], $style, 1, $key);
                    $content .= ob_get_clean();
                    $content .= PrintReady($favorite["note"]);
                } else {
                    $record = GedcomRecord::getInstance($favorite['gid']);
                    $content .= "<div id=\"box" . $favorite["gid"] . ".0\" class=\"person_box\">";
                    if ($ctype == "user" || PGV_USER_IS_ADMIN) {
                        $content .= $removeFavourite;
                    }
                    if ($record) {
                        $content .= $record->format_list('span');
                    } else {
                        $content .= $pgv_lang['invalid_id'];
                    }
                    $content .= "<br />" . PrintReady($favorite["note"]);
                }
            }
            $content .= "</div>";
            $content .= "</td></tr>";
            $GEDCOM = $mygedcom;
            require $INDEX_DIRECTORY . $GEDCOM . '_conf.php';
        }
        $content .= "</table>";
    }
    $content .= '
	<script language="JavaScript" type="text/javascript">
	var pastefield;
	function paste_id(value) {
		pastefield.value=value;
	}
	</script>
	<br />
	';
    $uniqueID = floor(microtime() * 1000000);
    $content .= print_help_link("index_add_favorites_help", "qm", "", false, true);
    $content .= "<b><a href=\"javascript: " . $pgv_lang["add_favorite"] . " \" onclick=\"expand_layer('add_user_fav'); return false;\"><img id=\"add_user_fav_img\" src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["plus"]["other"] . "\" border=\"0\" alt=\"\" />&nbsp;" . $pgv_lang["add_favorite"] . "</a></b>";
    $content .= "<br /><div id=\"add_user_fav\" style=\"display: none;\">";
    $content .= "<form name=\"addufavform\" method=\"post\" action=\"index.php\">";
    $content .= "<input type=\"hidden\" name=\"action\" value=\"addfav\" />";
    $content .= "<input type=\"hidden\" name=\"ctype\" value=\"{$ctype}\" />";
    $content .= "<input type=\"hidden\" name=\"favtype\" value=\"user\" />";
    $content .= "<input type=\"hidden\" name=\"ged\" value=\"{$GEDCOM}\" />";
    $content .= "<table width=\"{$tableWidth}\" style=\"border:none\" cellspacing=\"{$cellSpacing}\" class=\"center {$TEXT_DIRECTION}\">";
    $content .= "<tr><td>" . $pgv_lang["add_fav_enter_id"] . " <br />";
    $content .= "<input class=\"pedigree_form\" type=\"text\" name=\"gid\" id=\"gid{$uniqueID}\" size=\"5\" value=\"\" />";
    $content .= print_findindi_link("gid{$uniqueID}", '', true) . "\n";
    $content .= print_findfamily_link("gid{$uniqueID}", '', true) . "\n";
    $content .= print_findsource_link("gid{$uniqueID}", '', true) . "\n";
    $content .= print_findrepository_link("gid{$uniqueID}", '', true) . "\n";
    $content .= print_findnote_link("gid{$uniqueID}", '', true) . "\n";
    $content .= print_findmedia_link("gid{$uniqueID}", '1', '', true) . "\n";
    $content .= "<br />" . $pgv_lang["add_fav_or_enter_url"];
    $content .= "<table><tr><td>" . $pgv_lang["url"] . "</td><td><input type=\"text\" name=\"url\" size=\"40\" value=\"\" /></td></tr>";
    $content .= "<tr><td>" . $pgv_lang["title"] . "</td><td><input type=\"text\" name=\"favtitle\" size=\"40\" value=\"\" /></td></tr></table>";
    if ($block) {
        $content .= "\n</td></tr><tr><td><br />";
    } else {
        $content .= "\n</td><td>";
    }
    $content .= $pgv_lang["add_fav_enter_note"];
    $content .= "<br /><textarea name=\"favnote\" rows=\"6\" cols=\"50\"></textarea>";
    $content .= "</td></tr></table>";
    $content .= "<br /><input type=\"submit\" value=\"" . $pgv_lang["add"] . "\" style=\"font-size: 8pt; \" />";
    $content .= "</form></div>";
    global $THEME_DIR;
    if ($block) {
        require $THEME_DIR . 'templates/block_small_temp.php';
    } else {
        require $THEME_DIR . 'templates/block_main_temp.php';
    }
    // Restore GEDCOM configuration
    unset($show_full);
    if (isset($saveShowFull)) {
        $show_full = $saveShowFull;
    }
    $PEDIGREE_FULL_DETAILS = $savePedigreeFullDetails;
}
Ejemplo n.º 7
0
                list($value, $display) = $opt;
                if (substr($display, 0, 18) == 'WT_I18N::translate' || substr($display, 0, 15) == 'WT_I18N::number' || substr($display, 0, 23) == 'WT_Gedcom_Tag::getLabel') {
                    eval("\$display={$display};");
                }
                echo '<option value="', WT_Filter::escapeHtml($value), '"';
                if ($opt[0] == $input['default']) {
                    echo ' selected="selected"';
                }
                echo '>', WT_Filter::escapeHtml($display), '</option>';
            }
            echo '</select>';
        }
        if (isset($input['lookup'])) {
            echo '<input type="hidden" name="type[', WT_Filter::escapeHtml($input['name']), ']" value="', WT_Filter::escapeHtml($input['lookup']), '">';
            if ($input['lookup'] == 'INDI') {
                echo print_findindi_link('pid');
            } elseif ($input['lookup'] == 'PLAC') {
                echo print_findplace_link($input['name']);
            } elseif ($input['lookup'] == 'FAM') {
                echo print_findfamily_link('famid');
            } elseif ($input['lookup'] == 'SOUR') {
                echo print_findsource_link($input['name']);
            } elseif ($input['lookup'] == 'DATE') {
                echo ' <a href="#" onclick="cal_toggleDate(\'div_', WT_Filter::EscapeJs($input['name']), '\', \'', WT_Filter::EscapeJs($input['name']), '\'); return false;" class="icon-button_calendar" title="', WT_I18N::translate('Select a date'), '"></a>';
                echo '<div id="div_', WT_Filter::EscapeHtml($input['name']), '" style="position:absolute;visibility:hidden;background-color:white;"></div>';
            }
        }
        echo '</td></tr>';
    }
    echo '<tr>
		<td colspan="2" class="optionbox">
Ejemplo n.º 8
0
	<input type="hidden" name="form_action" value="update">
	', WT_Filter::getCsrf(), '
	<div id="edituser-table">
		<div class="label">', WT_I18N::translate('Username'), help_link('username'), '</div>
		<div class="value"><input type="text" name="form_username" value="', WT_Filter::escapeHtml(Auth::user()->getUserName()), '" autofocus></div>
		<div class="label">', WT_I18N::translate('Real name'), help_link('real_name'), '</div>
		<div class="value"><input type="text" name="form_realname" value="', WT_Filter::escapeHtml(Auth::user()->getRealName()), '"></div>';
$person = WT_Individual::getInstance(WT_USER_GEDCOM_ID);
if ($person) {
    echo '<div class="label">', WT_I18N::translate('Individual record'), help_link('edituser_gedcomid'), '</div>
				<div class="value">', $person->format_list('span'), '</div>';
}
$person = WT_Individual::getInstance(WT_USER_ROOT_ID);
echo '<div class="label">', WT_I18N::translate('Default individual'), help_link('default_individual'), '</div>
			<div class="value"><input data-autocomplete-type="INDI" type="text" name="form_rootid" id="rootid" value="', WT_USER_ROOT_ID, '">';
echo print_findindi_link('rootid'), '<br>';
if ($person) {
    echo $person->format_list('span');
}
echo '</div>
		<div class="label">', WT_I18N::translate('Password'), help_link('password'), '</div>
		<div class="value"><input type="password" name="form_pass1"> ', WT_I18N::translate('Leave password blank if you want to keep the current password.'), '</div>
		<div class="label">', WT_I18N::translate('Confirm password'), help_link('password_confirm'), '</div>
		<div class="value"><input type="password" name="form_pass2"></div>
		<div class="label">', WT_I18N::translate('Language'), '</div>
		<div class="value">', edit_field_language('form_language', Auth::user()->getSetting('language')), '</div>
		<div class="label">', WT_I18N::translate('Email address'), help_link('email'), '</div>
		<div class="value"><input type="email" name="form_email" value="', WT_Filter::escapeHtml(Auth::user()->getEmail()), '" size="50"></div>
		<div class="label">', WT_I18N::translate('Theme'), help_link('THEME'), '</div>
		<div class="value">
			<select name="form_theme">
Ejemplo n.º 9
0
echo '<input type="text" name="form_lastname" tabindex="', ++$tab, '" value="', get_user_setting(PGV_USER_ID, 'lastname'), '" />';
echo '</td></tr>';
$person = Person::getInstance(PGV_USER_GEDCOM_ID);
if ($person) {
    echo '<tr><td class="descriptionbox wrap">';
    echo print_help_link("edituser_gedcomid_help", "qm", '', false, true);
    echo $pgv_lang['gedcomid'], '</td><td class="optionbox">';
    echo $person->format_list('span');
    echo '</td></tr>';
}
$person = Person::getInstance(PGV_USER_ROOT_ID);
echo '<tr><td class="descriptionbox wrap">';
echo print_help_link('edituser_rootid_help', 'qm', '', false, true);
echo $pgv_lang['rootid'], '</td><td class="optionbox">';
echo '<input type="text" name="form_rootid" id="rootid" tabindex="', ++$tab, '" value="', PGV_USER_ROOT_ID, '" />';
echo print_findindi_link('rootid', '', true), '<br/>';
if ($person) {
    echo $person->format_list('span');
}
echo '</td></tr>';
echo '<tr><td class="descriptionbox wrap">';
echo print_help_link('edituser_password_help', 'qm', '', false, true);
echo $pgv_lang['password'], '</td><td class="optionbox">';
echo '<input type="password" name="form_pass1" tabindex="', ++$tab, '" /> ', $pgv_lang['leave_blank'], '</td></tr>';
echo '<tr><td class="descriptionbox wrap">';
echo print_help_link('edituser_conf_password_help', 'qm', '', false, true);
echo $pgv_lang['confirm'], '</td><td class="optionbox">';
echo '<input type="password" name="form_pass2" tabindex="', ++$tab, '" /></td></tr>';
if ($ENABLE_MULTI_LANGUAGE) {
    echo '<tr><td class="descriptionbox wrap">';
    echo print_help_link('edituser_change_lang_help', 'qm', '', false, true);
Ejemplo n.º 10
0
echo WT_I18N::translate('Privacy restrictions - these apply to records and facts that do not contain a GEDCOM RESN tag');
?>
					</th>
				</tr>
		<?php 
$all_tags = array();
$tags = array_unique(array_merge(explode(',', get_gedcom_setting(WT_GED_ID, 'INDI_FACTS_ADD')), explode(',', get_gedcom_setting(WT_GED_ID, 'INDI_FACTS_UNIQUE')), explode(',', get_gedcom_setting(WT_GED_ID, 'FAM_FACTS_ADD')), explode(',', get_gedcom_setting(WT_GED_ID, 'FAM_FACTS_UNIQUE')), explode(',', get_gedcom_setting(WT_GED_ID, 'NOTE_FACTS_ADD')), explode(',', get_gedcom_setting(WT_GED_ID, 'NOTE_FACTS_UNIQUE')), explode(',', get_gedcom_setting(WT_GED_ID, 'SOUR_FACTS_ADD')), explode(',', get_gedcom_setting(WT_GED_ID, 'SOUR_FACTS_UNIQUE')), explode(',', get_gedcom_setting(WT_GED_ID, 'REPO_FACTS_ADD')), explode(',', get_gedcom_setting(WT_GED_ID, 'REPO_FACTS_UNIQUE')), array('SOUR', 'REPO', 'OBJE', '_PRIM', 'NOTE', 'SUBM', 'SUBN', '_UID', 'CHAN')));
foreach ($tags as $tag) {
    if ($tag) {
        $all_tags[$tag] = WT_Gedcom_Tag::getLabel($tag);
    }
}
uasort($all_tags, array('WT_I18N', 'strcasecmp'));
echo '<tr><td>';
echo '<input type="text" class="pedigree_form" name="xref" id="xref" size="6" maxlength="20">';
echo ' ', print_findindi_link('xref');
echo ' ', print_findfamily_link('xref');
echo ' ', print_findsource_link('xref');
echo ' ', print_findrepository_link('xref');
echo ' ', print_findnote_link('xref');
echo ' ', print_findmedia_link('xref', '1media');
echo '</td><td>';
echo select_edit_control('tag_type', $all_tags, '', null, null);
echo '</td><td>';
echo select_edit_control('resn', $PRIVACY_CONSTANTS, null, 'privacy', null);
echo '</td><td>';
echo '<input type="button" value="', WT_I18N::translate('Add'), '" onClick="document.configform.elements[\'action\'].value=\'add\';document.configform.submit();">';
echo '<input type="hidden" name="default_resn_id" value="">';
// value set by JS
echo '</td></tr>';
$rows = WT_DB::prepare("SELECT default_resn_id, tag_type, xref, resn" . " FROM `##default_resn`" . " LEFT JOIN `##name` ON (gedcom_id=n_file AND xref=n_id AND n_num=0)" . " WHERE gedcom_id=?" . " ORDER BY xref IS NULL, n_sort, xref, tag_type")->execute(array(WT_GED_ID))->fetchAll();
Ejemplo n.º 11
0
        ?>
">
			<?php 
        echo WT_Filter::getCsrf();
        ?>
			<table class="facts_table">
				<tr>
					<td class="facts_label">
						<?php 
        echo $label;
        ?>
					</td>
					<td class="facts_value">
						<input data-autocomplete-type="INDI" id="spouseid" type="text" name="spid" size="8">
						<?php 
        echo print_findindi_link('spouseid');
        ?>
					</td>
				</tr>
				<?php 
        add_simple_tag("0 MARR Y");
        ?>
				<?php 
        add_simple_tag("0 DATE", "MARR");
        ?>
				<?php 
        add_simple_tag("0 PLAC", "MARR");
        ?>
				<?php 
        echo keep_chan($person);
        ?>
Ejemplo n.º 12
0
     }
 } else {
     echo '<input data-autocomplete-type="OBJE" type="text" name="mediaid" id="mediaid" size="5">';
     echo ' ', print_findmedia_link('mediaid', '1media');
     echo "</td></tr>";
 }
 if (!isset($linktoid)) {
     $linktoid = "";
 }
 echo '<tr><td class="descriptionbox">';
 if ($linkto == "person") {
     echo WT_I18N::translate('Individual'), "</td>";
     echo '<td class="optionbox wrap">';
     if ($linktoid == "") {
         echo '<input class="pedigree_form" type="text" name="linktoid" id="linktopid" size="3" value="', $linktoid, '"> ';
         echo print_findindi_link('linktopid');
     } else {
         $record = WT_Individual::getInstance($linktoid);
         echo $record->format_list('span', false, $record->getFullName());
     }
 }
 if ($linkto == "family") {
     echo WT_I18N::translate('Family'), '</td>';
     echo '<td class="optionbox wrap">';
     if ($linktoid == "") {
         echo '<input class="pedigree_form" type="text" name="linktoid" id="linktofamid" size="3" value="', $linktoid, '"> ';
         echo print_findfamily_link('linktofamid');
     } else {
         $record = WT_Family::getInstance($linktoid);
         echo $record->format_list('span', false, $record->getFullName());
     }
Ejemplo n.º 13
0
    static function _getFavorites($isged = true)
    {
        global $GEDCOM, $pgv_lang;
        global $pgv_lang, $factarray, $PGV_IMAGE_DIR, $PGV_IMAGES, $GEDCOM, $ctype, $TEXT_DIRECTION, $INDEX_DIRECTORY;
        global $show_full, $PEDIGREE_FULL_DETAILS, $BROWSERTYPE;
        // Override GEDCOM configuration temporarily
        if (isset($show_full)) {
            $saveShowFull = $show_full;
        }
        $savePedigreeFullDetails = $PEDIGREE_FULL_DETAILS;
        $show_full = 1;
        $PEDIGREE_FULL_DETAILS = 1;
        if ($isged) {
            $userfavs = getUserFavorites($GEDCOM);
        } else {
            $userfavs = getUserFavorites(PGV_USER_ID);
        }
        $content = '';
        if (!count($userfavs)) {
            if ($isged) {
                if (PGV_USER_GEDCOM_ADMIN) {
                    $content .= print_text('no_favorites', 0, 1);
                } else {
                    $content .= print_text('no_gedcom_favorites', 0, 1);
                }
            } else {
                print_text('no_favorites', 0, 1);
            }
        } else {
            if (!$isged) {
                $mygedcom = $GEDCOM;
                $current_gedcom = $GEDCOM;
            }
            $content .= "<table width=\"99%\" style=\"border:none\" cellspacing=\"3px\" class=\"center {$TEXT_DIRECTION}\">";
            foreach ($userfavs as $k => $favorite) {
                if (isset($favorite['id'])) {
                    $k = $favorite['id'];
                }
                $removeFavourite = "<a class=\"font9\" href=\"" . encode_url("index.php?ctype={$ctype}&action=deletefav&fv_id={$k}") . "\" onclick=\"return confirm('{$pgv_lang['confirm_fav_remove']}');\">{$pgv_lang['remove']}</a><br />\n";
                if (!$isged) {
                    $current_gedcom = $GEDCOM;
                    $GEDCOM = $favorite['file'];
                }
                $content .= '<tr><td>';
                if ($favorite['type'] == 'URL') {
                    $content .= "<div id=\"boxurl{$k}.0\" class=\"person_box\">\n";
                    if ($ctype == 'user' || PGV_USER_GEDCOM_ADMIN) {
                        $content .= $removeFavourite;
                    }
                    $content .= "<a href=\"{$favorite['url']}\"><b>" . PrintReady($favorite['title']) . '</b></a>';
                    $content .= "<br />\n" . PrintReady($favorite['note'], false, true);
                    $content .= "</div>\n";
                } else {
                    if (displayDetailsById($favorite['gid'], $favorite['type'])) {
                        require "{$INDEX_DIRECTORY}{$GEDCOM}_conf.php";
                        switch ($favorite['type']) {
                            case 'INDI':
                                $indirec = find_person_record($favorite['gid']);
                                $content .= "<div id=\"box{$favorite['gid']}.0\" class=\"person_box";
                                if (preg_match("/1 SEX F/", $indirec) > 0) {
                                    $content .= 'F';
                                } elseif (preg_match("/1 SEX M/", $indirec) > 0) {
                                    $content .= '';
                                } else {
                                    $content .= 'NN';
                                }
                                $content .= "\">\n";
                                if ($ctype == 'user' || PGV_USER_GEDCOM_ADMIN) {
                                    $content .= $removeFavourite;
                                }
                                ob_start();
                                print_pedigree_person($favorite['gid'], 2, 1, $k);
                                $content .= ob_get_clean();
                                $content .= PrintReady($favorite['note'], false, true);
                                $content .= "</div>\n";
                                break;
                            default:
                                $record = GedcomRecord::getInstance($favorite['gid']);
                                $content .= "<div id=\"box{$favorite['gid']}.0\" class=\"person_box\">\n";
                                if ($ctype == 'user' || PGV_USER_GEDCOM_ADMIN) {
                                    $content .= $removeFavourite;
                                }
                                $content .= $record->format_list('span');
                                $content .= "<br />\n" . PrintReady($favorite['note'], false, true);
                                $content .= "</div>\n";
                                break;
                        }
                        if (!$isged) {
                            $GEDCOM = $mygedcom;
                            require "{$INDEX_DIRECTORY}{$GEDCOM}_conf.php";
                        }
                    }
                }
                $content .= "</div>\n" . "</td></tr>\n";
            }
            $content .= "</table>\n";
        }
        if ($isged && PGV_USER_GEDCOM_ADMIN || !$isged) {
            $content .= '
				<script language="JavaScript" type="text/javascript">
				var pastefield;
				function paste_id(value) {
					pastefield.value=value;
				}
				</script>
				<br />
				';
            $uniqueID = floor(microtime() * 1000000);
            if ($isged) {
                $content .= print_help_link('index_add_favorites_help', 'qm', '', false, true) . "<b><a href=\"javascript://{$pgv_lang['add_favorite']} \" onclick=\"expand_layer('add_ged_fav'); return false;\"><img id=\"add_ged_fav_img\" src=\"{$PGV_IMAGE_DIR}/{$PGV_IMAGES['plus']['other']}\" border=\"0\" alt=\"\" />&nbsp;{$pgv_lang['add_favorite']}</a></b>" . "<br />\n<div id=\"add_ged_fav\" style=\"display: none;\">\n" . "<form name=\"addgfavform\" method=\"post\" action=\"index.php\">\n" . "<input type=\"hidden\" name=\"favtype\" value=\"gedcom\" />\n";
            } else {
                $content .= print_help_link('index_add_favorites_help', 'qm', '', false, true) . "<b><a href=\"javascript://{$pgv_lang['add_favorite']} \" onclick=\"expand_layer('add_user_fav'); return false;\"><img id=\"add_user_fav_img\" src=\"{$PGV_IMAGE_DIR}/{$PGV_IMAGES['plus']['other']}\" border=\"0\" alt=\"\" />&nbsp;{$pgv_lang['add_favorite']}</a></b>" . "<br />\n<div id=\"add_user_fav\" style=\"display: none;\">\n" . "<form name=\"addufavform\" method=\"post\" action=\"index.php\">\n" . "<input type=\"hidden\" name=\"favtype\" value=\"user\" />\n";
            }
            $content .= "<input type=\"hidden\" name=\"action\" value=\"addfav\" />\n" . "<input type=\"hidden\" name=\"ctype\" value=\"{$ctype}\" />\n" . "<input type=\"hidden\" name=\"ged\" value=\"{$GEDCOM}\" />\n" . "<table width=\"99%\" style=\"border:none\" cellspacing=\"3px\" class=\"center {$TEXT_DIRECTION}\">" . "<tr><td>{$pgv_lang['add_fav_enter_id']}<br />\n" . "<input class=\"pedigree_form\" type=\"text\" name=\"gid\" id=\"gid{$uniqueID}\" size=\"5\" value=\"\" />" . print_findindi_link("gid{$uniqueID}", '', true) . print_findfamily_link("gid{$uniqueID}", '', true) . print_findsource_link("gid{$uniqueID}", '', true) . print_findrepository_link("gid{$uniqueID}", '', true) . print_findnote_link("gid{$uniqueID}", '', true) . print_findmedia_link("gid{$uniqueID}", '1', '', true) . "<br />\n{$pgv_lang['add_fav_or_enter_url']}" . "<table><tr><td>{$pgv_lang['url']}</td><td><input type=\"text\" name=\"url\" size=\"40\" value=\"\" /></td></tr>" . "<tr><td>{$pgv_lang['title']}</td><td><input type=\"text\" name=\"favtitle\" size=\"40\" value=\"\" /></td></tr></table>" . "\n</td><td>" . "\n{$pgv_lang['add_fav_enter_note']}" . "<br />\n<textarea name=\"favnote\" rows=\"6\" cols=\"50\"></textarea>" . "</td></tr></table>\n" . "<br />\n<input type=\"submit\" value=\"{$pgv_lang['add']}\" style=\"font-size: 8pt; \" />" . "\n</form></div>\n";
        }
        // Restore GEDCOM configuration
        unset($show_full);
        if (isset($saveShowFull)) {
            $show_full = $saveShowFull;
        }
        $PEDIGREE_FULL_DETAILS = $savePedigreeFullDetails;
        return $content;
    }
Ejemplo n.º 14
0
print $pgv_lang["choice"];
?>
</td>
			<td class="descriptionbox"><?php 
print $pgv_lang["accessible_by"];
?>
</td>
		</tr>
		<tr class="<?php 
print $TEXT_DIRECTION;
?>
">
			<td class="optionbox">
				<input type="text" class="pedigree_form" name="v_new_person_facts_access_ID" id="v_new_person_facts_access_ID" size="4" />
				<?php 
print_findindi_link("v_new_person_facts_access_ID", "");
print_findfamily_link("v_new_person_facts_access_ID");
print_findsource_link("v_new_person_facts_access_ID");
print_findrepository_link("v_new_person_facts_access_ID");
?>
			</td>
			<td class="optionbox">
				<select size="1" name="v_new_person_facts_abbr">
				<?php 
foreach ($factarray as $tag => $label) {
    print "<option";
    print " value=\"";
    print $tag;
    print "\">";
    print $tag . " - " . str_replace("<br />", " ", $label);
    print "</option>";
Ejemplo n.º 15
0
echo '<table><tr><td valign="top"><h2>', $pgv_lang['descend_chart'], ':<br />', PrintReady($controller->name), '</h2>';
echo PGV_JS_START;
echo 'var pastefield; function paste_id(value) {pastefield.value=value;}';
echo PGV_JS_END;
$gencount = 0;
if ($view != "preview") {
    $show_famlink = true;
    echo '</td><td width="50px">&nbsp;</td><td><form method="get" name="people" action="?">';
    echo '<input type="hidden" name="show_full" value="', $controller->show_full, '" />';
    echo '<table class="list_table', $TEXT_DIRECTION, '">';
    echo '<tr><td class="descriptionbox">';
    print_help_link("desc_rootid_help", "qm");
    echo $pgv_lang["root_person"] . "&nbsp;</td>";
    echo '<td class="optionbox vmiddle">';
    echo '<input class="pedigree_form" type="text" id="pid" name="pid" size="3" value="', $controller->pid, '" />';
    print_findindi_link("pid", "");
    echo '</td>';
    echo '<td class="descriptionbox">';
    print_help_link("box_width_help", "qm");
    print $pgv_lang["box_width"] . "&nbsp;</td>";
    echo '<td class="optionbox vmiddle"><input type="text" size="3" name="box_width" value="', $controller->box_width, '" />';
    echo '<b>%</b></td>';
    echo '<td rowspan="2" class="descriptionbox">';
    echo $pgv_lang["displ_layout_conf"];
    echo '</td><td rowspan="2" class="optionbox vmiddle">';
    echo '<input type="radio" name="chart_style" value="0"';
    if ($controller->chart_style == 0) {
        echo ' checked="checked"';
    }
    echo '/>', $pgv_lang['chart_list'];
    echo '<br /><input type="radio" name="chart_style" value="1"';
Ejemplo n.º 16
0
		<tr>
			<td colspan="2" class="topbottombar" style="text-align:center; ">
				<?php 
        print_help_link("add_by_id_help", "qm");
        print $pgv_lang["add_individual_by_id"];
        ?>
			</td>
		</tr>
		<tr>
			<td class="optionbox">
				<input type="hidden" name="action" value="add"/>
				<input type="text" name="id" id="cart_item_id" size="8" />
			</td>
			<td class="optionbox">
				<?php 
        print_findindi_link('cart_item_id', '');
        ?>
				<?php 
        print_findfamily_link('cart_item_id', '');
        ?>
				<?php 
        print_findsource_link('cart_item_id', '');
        ?>
				<input type="submit" value="<?php 
        print $pgv_lang["add"];
        ?>
"/>

			</td>
		</tr>
		</table>
Ejemplo n.º 17
0
    private function pedigreeMap()
    {
        global $controller, $PEDIGREE_GENERATIONS, $MAX_PEDIGREE_GENERATIONS;
        // Default is show for both of these.
        $hideflags = WT_Filter::get('hideflags');
        $hidelines = WT_Filter::get('hidelines');
        $controller = new WT_Controller_Pedigree();
        // Start of internal configuration variables
        // Limit this to match available number of icons.
        // 8 generations equals 255 individuals
        $MAX_PEDIGREE_GENERATIONS = min($MAX_PEDIGREE_GENERATIONS, 8);
        // End of internal configuration variables
        $controller->setPageTitle(WT_I18N::translate('Pedigree map of %s', $controller->getPersonName()))->pageHeader()->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')->addInlineJavascript('autocomplete();');
        echo '<link type="text/css" href="', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/css/wt_v3_googlemap.css" rel="stylesheet">';
        echo '<div id="pedigreemap-page">
				<h2>', $controller->getPageTitle(), '</h2>';
        // -- print the form to change the number of displayed generations
        ?>
		<form name="people" method="get" action="?">
			<input type="hidden" name="ged" value="<?php 
        echo WT_Filter::escapeHtml(WT_GEDCOM);
        ?>
">
			<input type="hidden" name="mod" value="googlemap">
			<input type="hidden" name="mod_action" value="pedigree_map">
			<table class="list_table" width="555">
				<tr>
					<td class="descriptionbox wrap">
						<?php 
        echo WT_I18N::translate('Individual');
        ?>
					</td>
					<td class="descriptionbox wrap">
						<?php 
        echo WT_I18N::translate('Generations');
        ?>
					</td>
					<td class="descriptionbox wrap">
						<?php 
        echo WT_I18N::translate('Hide flags'), help_link('PEDIGREE_MAP_hideflags', 'googlemap');
        ?>
					</td>
					<td class="descriptionbox wrap">
						<?php 
        echo WT_I18N::translate('Hide lines'), help_link('PEDIGREE_MAP_hidelines', 'googlemap');
        ?>
					</td>
				</tr>
				<tr>
					<td class="optionbox">
						<input class="pedigree_form" data-autocomplete-type="INDI" type="text" id="rootid" name="rootid" size="3" value="<?php 
        echo $controller->root->getXref();
        ?>
">
						<?php 
        echo print_findindi_link('rootid');
        ?>
					</td>
					<td class="optionbox">
						<select name="PEDIGREE_GENERATIONS">
						<?php 
        for ($p = 3; $p <= $MAX_PEDIGREE_GENERATIONS; $p++) {
            echo '<option value="', $p, '" ';
            if ($p == $controller->PEDIGREE_GENERATIONS) {
                echo 'selected="selected"';
            }
            echo '>', $p, '</option>';
        }
        ?>
						</select>
					</td>
					<td class="optionbox">
						<?php 
        echo '<input name="hideflags" type="checkbox"';
        if ($hideflags) {
            echo ' checked="checked"';
        }
        echo '>';
        ?>
					</td>
					<td class="optionbox">
						<?php 
        echo '<input name="hidelines" type="checkbox"';
        if ($hidelines) {
            echo ' checked="checked"';
        }
        echo '>';
        ?>
					</td>
				</tr>
				<tr>
					<td class="topbottombar" colspan="5">
						<input type="submit" value="<?php 
        echo WT_I18N::translate('View');
        ?>
">
					</td>
				</tr>
			</table>
		</form>
		<!-- end of form -->

		<!-- count records by type -->
		<?php 
        $curgen = 1;
        $priv = 0;
        $count = 0;
        $miscount = 0;
        $missing = '';
        $latlongval = array();
        $lat = array();
        $lon = array();
        for ($i = 0; $i < $controller->treesize; $i++) {
            // -- check to see if we have moved to the next generation
            if ($i + 1 >= pow(2, $curgen)) {
                $curgen++;
            }
            $person = WT_Individual::getInstance($controller->treeid[$i]);
            if (!empty($person)) {
                $name = $person->getFullName();
                if ($name == WT_I18N::translate('Private')) {
                    $priv++;
                }
                $place = $person->getBirthPlace();
                if (empty($place)) {
                    $latlongval[$i] = null;
                } else {
                    $latlongval[$i] = $this->getLatitudeAndLongitudeFromPlaceLocation($person->getBirthPlace());
                }
                if ($latlongval[$i]) {
                    $lat[$i] = str_replace(array('N', 'S', ','), array('', '-', '.'), $latlongval[$i]->pl_lati);
                    $lon[$i] = str_replace(array('E', 'W', ','), array('', '-', '.'), $latlongval[$i]->pl_long);
                    if ($lat[$i] != null && $lon[$i] != null) {
                        $count++;
                    } else {
                        // The place is in the table but has empty values
                        if ($name) {
                            if ($missing) {
                                $missing .= ', ';
                            }
                            $missing .= '<a href="' . $person->getHtmlUrl() . '">' . $name . '</a>';
                            $miscount++;
                        }
                    }
                } else {
                    // There was no place, or not listed in the map table
                    if ($name) {
                        if ($missing) {
                            $missing .= ', ';
                        }
                        $missing .= '<a href="' . $person->getHtmlUrl() . '">' . $name . '</a>';
                        $miscount++;
                    }
                }
            }
        }
        //<!-- end of count records by type -->
        //<!-- start of map display -->
        echo '<div id="pedigreemap_chart">';
        echo '<table class="tabs_table" cellspacing="0" cellpadding="0" border="0" width="100%">';
        echo '<tr>';
        echo '<td valign="top">';
        echo '<div id="pm_map" style="border: 1px solid gray; height: ', $this->getSetting('GM_YSIZE'), 'px; font-size: 0.9em;';
        echo '"><i class="icon-loading-large"></i></div>';
        if (Auth::isAdmin()) {
            echo '<table width="100%">';
            echo '<tr><td align="left">';
            echo '<a href="module.php?mod=googlemap&amp;mod_action=admin_config">', WT_I18N::translate('Google Maps™ preferences'), '</a>';
            echo '</td>';
            echo '<td align="center">';
            echo '<a href="module.php?mod=googlemap&amp;mod_action=admin_places">', WT_I18N::translate('Geographic data'), '</a>';
            echo '</td>';
            echo '<td align="right">';
            echo '<a href="module.php?mod=googlemap&amp;mod_action=admin_placecheck">', WT_I18N::translate('Place check'), '</a>';
            echo '</td></tr>';
            echo '</table>';
        }
        echo '</td><td width="15px">&nbsp;</td>';
        echo '<td width="310px" valign="top">';
        echo '<div id="side_bar" style="width:300px; font-size:0.9em; overflow:auto; overflow-x:hidden; overflow-y:auto; height:', $this->getSetting('GM_YSIZE'), 'px;"></div></td>';
        echo '</tr>';
        echo '</table>';
        // display info under map
        echo '<hr>';
        echo '<table cellspacing="0" cellpadding="0" border="0" width="100%">';
        echo '<tr>';
        echo '<td valign="top">';
        // print summary statistics
        if (isset($curgen)) {
            $total = pow(2, $curgen) - 1;
            echo WT_I18N::plural('%1$d individual displayed, out of the normal total of %2$d, from %3$d generations.', '%1$d individuals displayed, out of the normal total of %2$d, from %3$d generations.', $count, $count, $total, $curgen), '<br>';
            echo '</td>';
            echo '</tr>';
            echo '<tr>';
            echo '<td valign="top">';
            if ($priv) {
                echo WT_I18N::plural('%s individual is private.', '%s individuals are private.', $priv, $priv), '<br>';
            }
            if ($count + $priv != $total) {
                if ($miscount == 0) {
                    echo WT_I18N::translate('No ancestors in the database.'), "<br>";
                } else {
                    echo WT_I18N::plural('%1$d individual is missing birthplace map coordinates: %2$s.', '%1$d individuals are missing birthplace map coordinates: %2$s.', $miscount, $miscount, $missing), '<br>';
                }
            }
        }
        echo '</td>';
        echo '</tr>';
        echo '</table>';
        echo '</div>';
        // close #pedigreemap_chart
        echo '</div>';
        // close #pedigreemap-page
        ?>
		<!-- end of map display -->
		<!-- Start of map scripts -->
		<?php 
        echo '<script src="', $this->googleMapsScript(), '"></script>';
        $controller->addInlineJavascript($this->pedigreeMapJavascript($hideflags, $hidelines));
    }
Ejemplo n.º 18
0
/**
 * 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 '&nbsp;<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 '&nbsp;<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 '&nbsp;<input type="checkbox" name="SOUR_', $match, '"', $level2_checked, ' value="1">';
                                echo WT_Gedcom_Tag::getLabel($match);
                            }
                        }
                    }
                }
                if (strpos($bdm, 'M') !== false) {
                    echo '&nbsp;<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 '&nbsp;<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;
}
Ejemplo n.º 19
0
}
print "</h2>";
// -- print the form to change the number of displayed generations
if ($view != "preview") {
    echo PGV_JS_START;
    echo "var pastefield; function paste_id(value) { pastefield.value=value; }";
    echo PGV_JS_END;
    print "</td><td><form name=\"people\" method=\"get\" action=\"?\">";
    print "<table class=\"list_table {$TEXT_DIRECTION}\"><tr>";
    // NOTE: rootid
    print "<td class=\"descriptionbox\">";
    print_help_link("rootid_help", "qm");
    print $pgv_lang["root_person"] . "</td>";
    print "<td class=\"optionbox\">";
    print "<input class=\"pedigree_form\" type=\"text\" name=\"rootid\" id=\"rootid\" size=\"3\" value=\"{$rootid}\" />";
    print_findindi_link("rootid", "");
    print "</td>";
    // NOTE: fan style
    print "<td rowspan=\"3\" class=\"descriptionbox\">";
    print_help_link("fan_style_help", "qm");
    print $pgv_lang["fan_chart"] . "</td>";
    print "<td rowspan=\"3\" class=\"optionbox\">";
    print "<input type=\"radio\" name=\"fan_style\" value=\"2\"";
    if ($fan_style == 2) {
        print " checked=\"checked\"";
    }
    print " /> 1/2";
    print "<br /><input type=\"radio\" name=\"fan_style\" value=\"3\"";
    if ($fan_style == 3) {
        print " checked=\"checked\"";
    }
Ejemplo n.º 20
0
        // ----
    } else {
        $record = WT_Individual::getInstance($linktoid);
        echo '<b>', $record->getFullName(), '</b>';
    }
    echo '<table><tr><td>';
    echo '<input type="text" data-autocomplete-type="IFS" name="gid" id="gid" size="6" value="">';
    // echo ' Enter Name or ID &nbsp; &nbsp; &nbsp; <b>OR</b> &nbsp; &nbsp; &nbsp;Search for ID ';
    echo '</td><td style="padding-bottom: 2px; vertical-align: middle;">';
    echo '&nbsp;';
    if (isset($WT_IMAGES["add"])) {
        echo '<img style="border-style:none;" src="', $WT_IMAGES["add"], '" alt="', WT_I18N::translate('Add'), ' " title="', WT_I18N::translate('Add'), '" align="middle" name="addLink" value="" onclick="blankwin(); return false;">';
    } else {
        echo '<button name="addLink" value="" type="button" onclick="blankwin(); return false;">', WT_I18N::translate('Add'), '</button>';
    }
    echo ' ', print_findindi_link('gid');
    echo ' ', print_findfamily_link('gid');
    echo ' ', print_findsource_link('gid');
    echo '</td></tr></table>';
    echo "<sub>" . WT_I18N::translate('Enter or search for the ID of the individual, family, or source to which this media item should be linked.') . "</sub>";
    echo '<br><br>';
    echo '<input type="hidden" name="idName" id="idName" size="36" value="Name of ID">';
    ?>
<script>

	function addlinks(iname) {
		// iid=document.getElementById('gid').value;
		if (document.getElementById('gid').value == "") {
			alert(id_empty);
		} else {
			addmedia_links(document.getElementById('gid'), document.getElementById('gid').value, iname );
Ejemplo n.º 21
0
 public function getBlock($block_id, $template = true, $cfg = null)
 {
     global $ctype, $show_full, $PEDIGREE_FULL_DETAILS, $controller;
     self::updateSchema();
     // make sure the favorites table has been created
     $action = WT_Filter::get('action');
     switch ($action) {
         case 'deletefav':
             $favorite_id = WT_Filter::getInteger('favorite_id');
             if ($favorite_id) {
                 self::deleteFavorite($favorite_id);
             }
             break;
         case 'addfav':
             $gid = WT_Filter::get('gid', WT_REGEX_XREF);
             $favnote = WT_Filter::get('favnote');
             $url = WT_Filter::getUrl('url');
             $favtitle = WT_Filter::get('favtitle');
             if ($gid) {
                 $record = WT_GedcomRecord::getInstance($gid);
                 if ($record && $record->canShow()) {
                     self::addFavorite(array('user_id' => $ctype == 'user' ? WT_USER_ID : null, 'gedcom_id' => WT_GED_ID, 'gid' => $record->getXref(), 'type' => $record::RECORD_TYPE, 'url' => null, 'note' => $favnote, 'title' => $favtitle));
                 }
             } elseif ($url) {
                 self::addFavorite(array('user_id' => $ctype == 'user' ? WT_USER_ID : null, 'gedcom_id' => WT_GED_ID, 'gid' => null, 'type' => 'URL', 'url' => $url, 'note' => $favnote, 'title' => $favtitle ? $favtitle : $url));
             }
             break;
     }
     $block = get_block_setting($block_id, 'block', false);
     if ($cfg) {
         foreach (array('block') as $name) {
             if (array_key_exists($name, $cfg)) {
                 ${$name} = $cfg[$name];
             }
         }
     }
     // Override GEDCOM configuration temporarily
     if (isset($show_full)) {
         $saveShowFull = $show_full;
     }
     $savePedigreeFullDetails = $PEDIGREE_FULL_DETAILS;
     $show_full = 1;
     $PEDIGREE_FULL_DETAILS = 1;
     $userfavs = $this->getFavorites($ctype == 'user' ? WT_USER_ID : WT_GED_ID);
     if (!is_array($userfavs)) {
         $userfavs = array();
     }
     $id = $this->getName() . $block_id;
     $class = $this->getName() . '_block';
     $title = $this->getTitle();
     if (WT_USER_ID) {
         $controller->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')->addInlineJavascript('autocomplete();');
     }
     $content = '';
     $style = 2;
     // 1 means "regular box", 2 means "wide box"
     if ($userfavs) {
         foreach ($userfavs as $key => $favorite) {
             if (isset($favorite['id'])) {
                 $key = $favorite['id'];
             }
             $removeFavourite = '<a class="font9" href="index.php?ctype=' . $ctype . '&amp;action=deletefav&amp;favorite_id=' . $key . '" onclick="return confirm(\'' . WT_I18N::translate('Are you sure you want to remove this item from your list of favorites?') . '\');">' . WT_I18N::translate('Remove') . '</a> ';
             if ($favorite['type'] == 'URL') {
                 $content .= '<div id="boxurl' . $key . '.0" class="person_box">';
                 if ($ctype == 'user' || WT_USER_GEDCOM_ADMIN) {
                     $content .= $removeFavourite;
                 }
                 $content .= '<a href="' . $favorite['url'] . '"><b>' . $favorite['title'] . '</b></a>';
                 $content .= '<br>' . $favorite['note'];
                 $content .= '</div>';
             } else {
                 $record = WT_GedcomRecord::getInstance($favorite['gid']);
                 if ($record && $record->canShow()) {
                     if ($record instanceof WT_Individual) {
                         $content .= '<div id="box' . $favorite["gid"] . '.0" class="person_box action_header';
                         switch ($record->getsex()) {
                             case 'M':
                                 break;
                             case 'F':
                                 $content .= 'F';
                                 break;
                             case 'U':
                                 $content .= 'NN';
                                 break;
                         }
                         $content .= '">';
                         if ($ctype == "user" || WT_USER_GEDCOM_ADMIN) {
                             $content .= $removeFavourite;
                         }
                         ob_start();
                         print_pedigree_person($record, $style, 1, $key);
                         $content .= ob_get_clean();
                         $content .= $favorite['note'];
                         $content .= '</div>';
                     } else {
                         $content .= '<div id="box' . $favorite['gid'] . '.0" class="person_box">';
                         if ($ctype == 'user' || WT_USER_GEDCOM_ADMIN) {
                             $content .= $removeFavourite;
                         }
                         $content .= $record->format_list('span');
                         $content .= '<br>' . $favorite['note'];
                         $content .= '</div>';
                     }
                 }
             }
         }
     }
     if ($ctype == 'user' || WT_USER_GEDCOM_ADMIN) {
         $uniqueID = Uuid::uuid4();
         // This block can theoretically appear multiple times, so use a unique ID.
         $content .= '<div class="add_fav_head">';
         $content .= '<a href="#" onclick="return expand_layer(\'add_fav' . $uniqueID . '\');">' . WT_I18N::translate('Add a new favorite') . '<i id="add_fav' . $uniqueID . '_img" class="icon-plus"></i></a>';
         $content .= '</div>';
         $content .= '<div id="add_fav' . $uniqueID . '" style="display: none;">';
         $content .= '<form name="addfavform" method="get" action="index.php">';
         $content .= '<input type="hidden" name="action" value="addfav">';
         $content .= '<input type="hidden" name="ctype" value="' . $ctype . '">';
         $content .= '<input type="hidden" name="ged" value="' . WT_GEDCOM . '">';
         $content .= '<div class="add_fav_ref">';
         $content .= '<input type="radio" name="fav_category" value="record" checked="checked" onclick="jQuery(\'#gid' . $uniqueID . '\').removeAttr(\'disabled\'); jQuery(\'#url, #favtitle\').attr(\'disabled\',\'disabled\').val(\'\');">';
         $content .= '<label for="gid' . $uniqueID . '">' . WT_I18N::translate('Enter an individual, family, or source ID') . '</label>';
         $content .= '<input class="pedigree_form" data-autocomplete-type="IFSRO" type="text" name="gid" id="gid' . $uniqueID . '" size="5" value="">';
         $content .= ' ' . print_findindi_link('gid' . $uniqueID);
         $content .= ' ' . print_findfamily_link('gid' . $uniqueID);
         $content .= ' ' . print_findsource_link('gid' . $uniqueID);
         $content .= ' ' . print_findrepository_link('gid' . $uniqueID);
         $content .= ' ' . print_findnote_link('gid' . $uniqueID);
         $content .= ' ' . print_findmedia_link('gid' . $uniqueID);
         $content .= '</div>';
         $content .= '<div class="add_fav_url">';
         $content .= '<input type="radio" name="fav_category" value="url" onclick="jQuery(\'#url, #favtitle\').removeAttr(\'disabled\'); jQuery(\'#gid' . $uniqueID . '\').attr(\'disabled\',\'disabled\').val(\'\');">';
         $content .= '<input type="text" name="url" id="url" size="20" value="" placeholder="' . WT_Gedcom_Tag::getLabel('URL') . '" disabled="disabled"> ';
         $content .= '<input type="text" name="favtitle" id="favtitle" size="20" value="" placeholder="' . WT_I18N::translate('Title') . '" disabled="disabled">';
         $content .= '<p>' . WT_I18N::translate('Enter an optional note about this favorite') . '</p>';
         $content .= '<textarea name="favnote" rows="6" cols="50"></textarea>';
         $content .= '</div>';
         $content .= '<input type="submit" value="' . WT_I18N::translate('Add') . '">';
         $content .= '</form></div>';
     }
     if ($template) {
         if ($block) {
             require WT_THEME_DIR . 'templates/block_small_temp.php';
         } else {
             require WT_THEME_DIR . 'templates/block_main_temp.php';
         }
     } else {
         return $content;
     }
     // Restore GEDCOM configuration
     unset($show_full);
     if (isset($saveShowFull)) {
         $show_full = $saveShowFull;
     }
     $PEDIGREE_FULL_DETAILS = $savePedigreeFullDetails;
 }
Ejemplo n.º 22
0
function print_charts_block_config($config)
{
    global $pgv_lang, $ctype, $PGV_BLOCKS, $TEXT_DIRECTION, $PEDIGREE_ROOT_ID, $ENABLE_AUTOCOMPLETE;
    if (empty($config)) {
        $config = $PGV_BLOCKS["print_charts_block"]["config"];
    }
    if (empty($config["rootId"])) {
        $config["rootId"] = $PEDIGREE_ROOT_ID;
    }
    if (empty($config['details'])) {
        $config['details'] = 'no';
    }
    if ($ENABLE_AUTOCOMPLETE) {
        require PGV_ROOT . 'js/autocomplete.js.htm';
    }
    ?>
	<tr><td class="descriptionbox wrap width33"><?php 
    print $pgv_lang["chart_type"];
    ?>
</td>
	<td class="optionbox">
		<select name="type">
			<option value="pedigree"<?php 
    if ($config["type"] == "pedigree") {
        print " selected=\"selected\"";
    }
    ?>
><?php 
    print $pgv_lang["index_header"];
    ?>
</option>
			<option value="descendants"<?php 
    if ($config["type"] == "descendants") {
        print " selected=\"selected\"";
    }
    ?>
><?php 
    print $pgv_lang["descend_chart"];
    ?>
</option>
			<option value="hourglass"<?php 
    if ($config["type"] == "hourglass") {
        print " selected=\"selected\"";
    }
    ?>
><?php 
    print $pgv_lang["hourglass_chart"];
    ?>
</option>
			<?php 
    if (file_exists(PGV_ROOT . 'includes/classes/class_treenav.php')) {
        ?>
			<option value="treenav"<?php 
        if ($config["type"] == "treenav") {
            print " selected=\"selected\"";
        }
        ?>
><?php 
        print $pgv_lang["interactive_tree"];
        ?>
</option>
			<?php 
    }
    ?>
		</select>
	</td></tr>
	<tr>
		<td class="descriptionbox wrap width33"><?php 
    print $pgv_lang["show_details"];
    ?>
</td>
	<td class="optionbox">
		<select name="details">
				<option value="no" <?php 
    if ($config["details"] == "no") {
        print " selected=\"selected\"";
    }
    ?>
><?php 
    print $pgv_lang['no'];
    ?>
</option>
				<option value="yes" <?php 
    if ($config["details"] == "yes") {
        print " selected=\"selected\"";
    }
    ?>
><?php 
    print $pgv_lang['yes'];
    ?>
</option>
		</select>
		</td>
	</tr>
	<tr>
		<td class="descriptionbox wrap width33"><?php 
    print $pgv_lang["root_person"];
    ?>
</td>
		<td class="optionbox">
			<input type="text" name="pid" id="pid" value="<?php 
    print $config['pid'];
    ?>
" size="5" />
			<?php 
    print_findindi_link('pid', '');
    $root = Person::getInstance($config['pid']);
    if ($root) {
        echo ' <span class="list_item">', $root->getFullName(), $root->format_first_major_fact(PGV_EVENTS_BIRT, 1), '</span>';
    }
    ?>
		</td>
	</tr>
  	<?php 
    // Cache file life
    if ($ctype == "gedcom") {
        print "<tr><td class=\"descriptionbox wrap width33\">";
        print_help_link("cache_life_help", "qm");
        print $pgv_lang["cache_life"];
        print "</td><td class=\"optionbox\">";
        print "<input type=\"text\" name=\"cache\" size=\"2\" value=\"" . $config["cache"] . "\" />";
        print "</td></tr>";
    }
}
Ejemplo n.º 23
0
    public function configureBlock($block_id)
    {
        global $ctype, $controller;
        $PEDIGREE_ROOT_ID = get_gedcom_setting(WT_GED_ID, 'PEDIGREE_ROOT_ID');
        if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) {
            set_block_setting($block_id, 'details', WT_Filter::postBool('details'));
            set_block_setting($block_id, 'type', WT_Filter::post('type', 'pedigree|descendants|hourglass|treenav', 'pedigree'));
            set_block_setting($block_id, 'pid', WT_Filter::post('pid', WT_REGEX_XREF));
            exit;
        }
        $details = get_block_setting($block_id, 'details', false);
        $type = get_block_setting($block_id, 'type', 'pedigree');
        $pid = get_block_setting($block_id, 'pid', WT_USER_ID ? WT_USER_GEDCOM_ID ? WT_USER_GEDCOM_ID : $PEDIGREE_ROOT_ID : $PEDIGREE_ROOT_ID);
        $controller->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')->addInlineJavascript('autocomplete();');
        ?>
		<tr><td class="descriptionbox wrap width33"><?php 
        echo WT_I18N::translate('Chart type');
        ?>
</td>
		<td class="optionbox">
			<select name="type">
				<option value="pedigree"<?php 
        if ($type == "pedigree") {
            echo " selected=\"selected\"";
        }
        ?>
><?php 
        echo WT_I18N::translate('Pedigree');
        ?>
</option>
				<option value="descendants"<?php 
        if ($type == "descendants") {
            echo " selected=\"selected\"";
        }
        ?>
><?php 
        echo WT_I18N::translate('Descendants');
        ?>
</option>
				<option value="hourglass"<?php 
        if ($type == "hourglass") {
            echo " selected=\"selected\"";
        }
        ?>
><?php 
        echo WT_I18N::translate('Hourglass chart');
        ?>
</option>
				<option value="treenav"<?php 
        if ($type == "treenav") {
            echo " selected=\"selected\"";
        }
        ?>
><?php 
        echo WT_I18N::translate('Interactive tree');
        ?>
</option>
			</select>
		</td></tr>
		<tr>
			<td class="descriptionbox wrap width33"><?php 
        echo WT_I18N::translate('Show details');
        ?>
</td>
		<td class="optionbox">
			<select name="details">
					<option value="no" <?php 
        if (!$details) {
            echo " selected=\"selected\"";
        }
        ?>
><?php 
        echo WT_I18N::translate('no');
        ?>
</option>
					<option value="yes" <?php 
        if ($details) {
            echo " selected=\"selected\"";
        }
        ?>
><?php 
        echo WT_I18N::translate('yes');
        ?>
</option>
			</select>
			</td>
		</tr>
		<tr>
			<td class="descriptionbox wrap width33"><?php 
        echo WT_I18N::translate('Individual');
        ?>
</td>
			<td class="optionbox">
				<input data-autocomplete-type="INDI" type="text" name="pid" id="pid" value="<?php 
        echo $pid;
        ?>
" size="5">
				<?php 
        echo print_findindi_link('pid');
        $root = WT_Individual::getInstance($pid);
        if ($root) {
            echo ' <span class="list_item">', $root->getFullName(), $root->format_first_major_fact(WT_EVENTS_BIRT, 1), '</span>';
        }
        ?>
			</td>
		</tr>
		<?php 
        require_once WT_ROOT . 'includes/functions/functions_edit.php';
        $block = get_block_setting($block_id, 'block', false);
        echo '<tr><td class="descriptionbox wrap width33">';
        echo WT_I18N::translate('Add a scrollbar when block contents grow');
        echo '</td><td class="optionbox">';
        echo edit_field_yes_no('block', $block);
        echo '</td></tr>';
    }
Ejemplo n.º 24
0
<tr><td class="topbottombar" colspan="4"><?php 
        print_help_link("quick_update_child_help", "qm");
        echo $pgv_lang["add_child_to_family"];
        ?>
</td></tr>
<tr>
	<td class="descriptionbox"><?php 
        echo $pgv_lang["add_child_to_family"];
        ?>
</td>
	<td class="optionbox" colspan="3"><input type="text" size="10" name="CHIL[]" id="CHIL<?php 
        echo $i;
        ?>
" />
	<?php 
        print_findindi_link("CHIL{$i}", "");
        ?>
	</td>
</tr>
<?php 
        if ($NAME_REVERSE) {
            ?>
<tr>
	<td class="descriptionbox"><?php 
            print_help_link("edit_surname_help", "qm");
            echo $factarray["SURN"];
            ?>
</td>
	<td class="optionbox" colspan="3"><input size="50" type="text" tabindex="<?php 
            echo $tabkey;
            ?>
Ejemplo n.º 25
0
		<table class="list_table">
			<tr>
				<td class="descriptionbox">
					<label for="rootid">
						<?php 
echo WT_I18N::translate('Individual');
?>
					</label>
				</td>
				<td class="optionbox">
					<input class="pedigree_form" data-autocomplete-type="INDI" type="text" name="rootid" id="rootid" size="3" value="<?php 
echo $controller->rootid;
?>
">
					<?php 
echo print_findindi_link('rootid');
?>
				</td>
				<td class="descriptionbox">
					<label for="fan_style">
						<?php 
echo WT_I18N::translate('Layout');
?>
						</label>
				</td>
				<td class="optionbox">
					<?php 
echo select_edit_control('fan_style', $controller->getFanStyles(), null, $controller->fan_style);
?>
				</td>
				<td rowspan="2" class="topbottombar vmiddle">
Ejemplo n.º 26
0
 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(), '&amp;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;
     }
 }
Ejemplo n.º 27
0
			<tr>
				<td colspan="4">
					<table id="adduser2">
						<tr>
							<th>', WT_I18N::translate('Family tree'), '</th>
							<th>', WT_I18N::translate('Default individual'), help_link('default_individual'), '</th>
							<th>', WT_I18N::translate('Individual record'), help_link('useradmin_gedcomid'), '</th>
							<th>', WT_I18N::translate('Role'), help_link('role'), '</th>
							<th>', WT_I18N::translate('Restrict to immediate family'), help_link('RELATIONSHIP_PATH_LENGTH'), '</th>
						</tr>';
        foreach (WT_Tree::getAll() as $tree) {
            echo '<tr>', '<td>', $tree->tree_title_html, '</td>', '<td>';
            $varname = 'rootid' . $tree->tree_id;
            echo '<input data-autocomplete-type="INDI" data-autocomplete-ged="' . $tree->tree_name_html . '" type="text" size="12" name="', $varname, '" id="', $varname, '" value="', WT_Filter::escapeHtml(WT_Filter::post('rootid' . $tree->tree_id, WT_REGEX_XREF)), '"> ', print_findindi_link($varname, '', $tree->tree_name), '</td>', '<td>';
            $varname = 'gedcomid' . $tree->tree_id;
            echo '<input data-autocomplete-type="INDI" data-autocomplete-ged="' . $tree->tree_name_html . '" type="text" size="12" name="', $varname, '" id="', $varname, '" value="', WT_Filter::escapeHtml(WT_Filter::post('gedcomid' . $tree->tree_id, WT_REGEX_XREF)), '"> ', print_findindi_link($varname, '', $tree->tree_name), '</td>', '<td>';
            $varname = 'canedit' . $tree->tree_id;
            echo '<select name="', $varname, '">';
            foreach ($ALL_EDIT_OPTIONS as $EDIT_OPTION => $desc) {
                echo '<option value="', $EDIT_OPTION, '" ';
                if ($EDIT_OPTION == WT_I18N::translate('None')) {
                    echo 'selected="selected" ';
                }
                echo '>', $desc, '</option>';
            }
            echo '</select>', '</td>', '<td>';
            $varname = 'RELATIONSHIP_PATH_LENGTH' . $tree->tree_id;
            echo '<select name="', $varname, '" id="', $varname, '" class="relpath">';
            for ($n = 0; $n <= 10; ++$n) {
                echo '<option value="', $n, '">', $n ? $n : WT_I18N::translate('No'), '</option>';
            }
Ejemplo n.º 28
0
 init_calendar_popup();
 echo "<form method=\"post\" name=\"addchildform\" action=\"edit_interface.php\">\n";
 echo "<input type=\"hidden\" name=\"action\" value=\"linkspouseaction\" />\n";
 echo "<input type=\"hidden\" name=\"pid\" value=\"{$pid}\" />\n";
 echo "<input type=\"hidden\" name=\"famid\" value=\"new\" />\n";
 echo "<input type=\"hidden\" name=\"famtag\" value=\"{$famtag}\" />\n";
 echo "<table class=\"facts_table\">";
 echo "<tr><td class=\"facts_label\">";
 if ($famtag == "WIFE") {
     echo $pgv_lang["wife"];
 } else {
     echo $pgv_lang["husband"];
 }
 echo "</td>";
 echo "<td class=\"facts_value\"><input id=\"spouseid\" type=\"text\" name=\"spid\" size=\"8\" /> ";
 print_findindi_link("spouseid", "");
 echo "\n</td></tr>";
 add_simple_tag("0 MARR");
 add_simple_tag("0 DATE", "MARR");
 add_simple_tag("0 PLAC", "MARR");
 if (PGV_USER_IS_ADMIN) {
     echo "<tr><td class=\"descriptionbox ", $TEXT_DIRECTION, " wrap width25\">";
     print_help_link("no_update_CHAN_help", "qm", "no_update_CHAN");
     echo $pgv_lang["admin_override"], "</td><td class=\"optionbox wrap\">\n";
     if ($NO_UPDATE_CHAN) {
         echo "<input type=\"checkbox\" checked=\"checked\" name=\"preserve_last_changed\" />\n";
     } else {
         echo "<input type=\"checkbox\" name=\"preserve_last_changed\" />\n";
     }
     echo $pgv_lang["no_update_CHAN"], "<br />\n";
     $event = new Event(get_sub_record(1, "1 CHAN", $gedrec));