示例#1
0
 function getPageHeader()
 {
     global $wgScript;
     $t = Title::makeTitle(NS_SPECIAL, $this->getName());
     $submitbutton = '<input type="submit" value="' . wfMsgHtml('allpagessubmit') . "\" />\n";
     $out = "<div class='namespacesettings'><form method='get' action='{$wgScript}'>\n";
     $out .= '<input type="hidden" name="title" value="' . $t->getPrefixedText() . '" />';
     $out .= '<label for="user">User name:</label> <input type="text" name="user" size="15" value="' . htmlspecialchars($this->userName) . '" />';
     $out .= '&nbsp; <label for="tree">Tree name:</label>' . StructuredData::addSelectToHtml(0, 'tree', $this->allTrees, $this->treeName, '', true);
     if ($this->selectNamespace()) {
         $namespaceselect = StructuredData::addSelectToHtml(0, 'namespace', self::$NAMESPACE_OPTIONS, $this->namespace, '', false);
         $out .= "&nbsp; <label for='namespace'> " . wfMsgHtml('namespace') . "</label> {$namespaceselect} {$submitbutton}";
     }
     $out .= '</form></div><br>';
     return $out;
 }
示例#2
0
 /**
  * Return HTML for displaying search results
  * @return string HTML
  */
 public function getCompareResults()
 {
     global $wgUser;
     $this->setMergeTargets();
     list($compareData, $compareChildren, $maxChildren) = $this->readCompareData();
     $dataLabels = $this->getDataLabels();
     list($compareClass, $husbandScores, $wifeScores, $totalScores) = $this->scoreCompareData($dataLabels, $compareData);
     $output = '';
     $semiProtected = false;
     $isLoggedIn = $wgUser->isLoggedIn();
     if (!$isLoggedIn) {
         $output .= '<p><font color=red>You need to sign in to match and merge pages</font></p>';
     }
     $gedcomExtra = $this->gedcomDataString ? '?gedcomtab=' . htmlspecialchars($this->gedcomTab) . '&gedcomkey=' . htmlspecialchars($this->gedcomKey) : '';
     $output .= "<form id=\"compare\" name=\"compare\" action=\"/wiki/Special:Merge{$gedcomExtra}\" method=\"post\">" . "<input type=\"hidden\" id=\"ns\" name=\"ns\" value=\"{$this->namespace}\">" . "<input type=\"hidden\" id=\"maxpages\" name=\"maxpages\" value=\"" . count($this->compareTitles) . "\">" . ($this->namespace == 'Family' ? "<input id=\"maxchildren\" type=\"hidden\" name=\"maxchildren\" value=\"{$maxChildren}\">" : '') . '<table border="0" cellspacing="0" cellpadding="4">';
     foreach ($dataLabels as $label) {
         $labelClass = CompareForm::getLabelClass($label);
         if ($labelClass == self::$COMPARE_ULC_CLASS) {
             $output .= CompareForm::insertEmptyRow(count($this->compareTitles) + 1);
         }
         $found = !in_array($label, self::$OPTIONAL_LABELS);
         if (!$found) {
             foreach ($this->compareTitles as $t) {
                 if (is_array(@$compareData[$t][$label]) && count($compareData[$t][$label]) > 0) {
                     $found = true;
                     break;
                 }
             }
         }
         if ($found) {
             $output .= "<tr><td class=\"{$labelClass}\">" . CompareForm::formatLabel($label) . "</td>";
             // show target left if gedcom; right otherwise
             $i = $this->gedcomDataString ? 0 : count($this->compareTitles) - 1;
             while ($this->gedcomDataString && $i < count($this->compareTitles) || !$this->gedcomDataString && $i >= 0) {
                 $t = $this->compareTitles[$i];
                 $class = $compareClass[$label][$i];
                 $output .= "<td class=\"{$class}\">";
                 $first = true;
                 if (is_array(@$compareData[$t][$label])) {
                     foreach ($compareData[$t][$label] as $value) {
                         if (!$first) {
                             $output .= '<br>';
                         }
                         $output .= CompareForm::formatValue($label, $value);
                         $first = false;
                     }
                 }
                 if ($first) {
                     $output .= '&nbsp;';
                 }
                 if ($class == self::$COMPARE_PAGE_CLASS) {
                     $titlesCnt = count(@$compareData[$t][$label]);
                     $baseTitlesCnt = count(@$compareData[$this->compareTitles[0]][$label]);
                     if ($titlesCnt > 0) {
                         $value = htmlspecialchars($compareData[$t][$label][0]);
                         if ($label == 'husbandTitle') {
                             $relative = 'husband';
                             $relativeAbbrev = 'h';
                             $score = $husbandScores[$i];
                         } else {
                             if ($label == 'wifeTitle') {
                                 $relative = 'wife';
                                 $relativeAbbrev = 'w';
                                 $score = $wifeScores[$i];
                             } else {
                                 $relative = '';
                                 $relativeAbbrev = '';
                                 $score = 0;
                             }
                         }
                         if (!$compareData[$t]['Exists']) {
                             // base person/family not found
                             if (!$relative) {
                                 $output .= '<br>Not found';
                             }
                         } else {
                             if ($compareData[$t]['Redirect']) {
                                 // base person/family has been merged
                                 if (!$relative) {
                                     $output .= '<br>Already merged';
                                 }
                             } else {
                                 if ($compareData[$t][$relative . 'Redirect']) {
                                     // husband/wife has been merged
                                     $output .= '<br>Already merged';
                                 } else {
                                     if ($i == 0 && $this->gedcomDataString) {
                                         if (@$compareData[$t][$relative . 'GedcomMatchTitle']) {
                                             $skin =& $wgUser->getSkin();
                                             $gedcomMatchTitle = $compareData[$t][$relative . 'GedcomMatchTitle'];
                                             $temp = Title::newFromText($gedcomMatchTitle, StructuredData::endsWith($label, 'familyTitle', true) ? NS_FAMILY : NS_PERSON);
                                             $title = $skin->makeLinkObj($temp, htmlspecialchars($gedcomMatchTitle));
                                             $output .= "<br>Matched with {$title}";
                                         }
                                         $output .= "<input type=\"hidden\" id=\"m{$relativeAbbrev}_{$i}\" name=\"m{$relativeAbbrev}_{$i}\" value=\"{$value}\">";
                                     } else {
                                         if ($titlesCnt == 1 && $baseTitlesCnt <= 1) {
                                             //								if ($i == 0 || $baseTitlesCnt == 0 || $compareData[$this->compareTitles[0]][$label][0] != $compareData[$t][$label][0]) { // don't allow merge if same title
                                             if ($i == 0) {
                                                 $extra = " checked";
                                             } else {
                                                 if ($relative) {
                                                     // always check spouses
                                                     $extra = 'disabled checked';
                                                     //if ($score > self::$SPOUSE_MATCH_THRESHOLD) $extra .= ' checked';
                                                 } else {
                                                     $extra = '';
                                                 }
                                             }
                                             if ($this->namespace == 'Family' && !$relative) {
                                                 $extra .= " onClick=\"compareClick({$i})\"";
                                             }
                                             $output .= "<br><input id=\"m{$relativeAbbrev}_{$i}\" type=\"checkbox\" name=\"m{$relativeAbbrev}_{$i}\" value=\"{$value}\" {$extra}>&nbsp;Match";
                                             //								}
                                         } else {
                                             $output .= "<br>Multiple spouses - merge after merging family";
                                         }
                                     }
                                 }
                             }
                         }
                         $nomergeTitles = $this->getNomergeTitleMatches($compareData, $t, -1, $relative, '<br>');
                         if ($nomergeTitles) {
                             $output .= '<br><b>Do not merge with</b><br>' . $nomergeTitles;
                         }
                         if ((!$this->gedcomDataString || $i > 0) && !$compareData[$t][$relative . 'Updatable']) {
                             $output .= "<br><font color=\"red\">Semi-protected</font> (see below)";
                             $semiProtected = true;
                         }
                     }
                 }
                 $output .= '</td>';
                 $i += $this->gedcomDataString ? 1 : -1;
             }
             $output .= '</tr>';
         }
     }
     if ($this->namespace == 'Family') {
         for ($c = 0; $c < $maxChildren; $c++) {
             foreach (CompareForm::$CHILD_COMPARE_LABELS as $label) {
                 $labelClass = CompareForm::getLabelClass($label);
                 if ($labelClass == self::$COMPARE_ULC_CLASS) {
                     $output .= CompareForm::insertEmptyRow(count($this->compareTitles) + 1);
                 }
                 $found = !in_array($label, self::$OPTIONAL_LABELS);
                 if (!$found) {
                     foreach ($this->compareTitles as $t) {
                         if (is_array(@$compareChildren[$t][$c][$label]) && count($compareChildren[$t][$c][$label]) > 0) {
                             $found = true;
                             break;
                         }
                     }
                 }
                 if ($found) {
                     $output .= "<tr><td class=\"{$labelClass}\">" . CompareForm::formatLabel($label, $c + 1) . "</td>";
                     $baseStdValues =& CompareForm::standardizeValues($label, @$compareChildren[$this->compareTitles[0]][$c][$label]);
                     $i = $this->gedcomDataString ? 0 : count($this->compareTitles) - 1;
                     while ($this->gedcomDataString && $i < count($this->compareTitles) || !$this->gedcomDataString && $i >= 0) {
                         $t = $this->compareTitles[$i];
                         if ($i == 0) {
                             $stdValues = $baseStdValues;
                         } else {
                             $stdValues =& CompareForm::standardizeValues($label, @$compareChildren[$t][$c][$label]);
                         }
                         list($score, $class) = CompareForm::getCompareScoreClass($i == 0, $label, $baseStdValues, $stdValues);
                         $output .= "<td class=\"{$class}\">";
                         $children =& $compareChildren[$t];
                         $first = true;
                         if (count($children) > $c) {
                             if (is_array(@$children[$c][$label])) {
                                 foreach ($children[$c][$label] as $value) {
                                     if (!$first) {
                                         $output .= '<br>';
                                     }
                                     $output .= CompareForm::formatValue($label, $value);
                                     $first = false;
                                 }
                             }
                         }
                         if ($first) {
                             $output .= '&nbsp;';
                         }
                         if ($class == self::$COMPARE_PAGE_CLASS) {
                             if (count(@$compareChildren[$t][$c][$label]) == 1) {
                                 $value = htmlspecialchars($compareChildren[$t][$c][$label][0]);
                                 $output .= "<input type=\"hidden\" id=\"mc_{$i}_{$c}\" name=\"mc_{$i}_{$c}\" value=\"{$value}\">";
                                 if ($compareData[$t]['Redirect']) {
                                     // family has already been merged
                                 } else {
                                     if ($compareChildren[$t][$c]['childRedirect']) {
                                         // child has already been merged
                                         $output .= '<br>Already merged';
                                     } else {
                                         if ($i == 0 && $this->gedcomDataString) {
                                             if (@$compareChildren[$t][$c]['childGedcomMatchTitle']) {
                                                 $skin =& $wgUser->getSkin();
                                                 $gedcomMatchTitle = $compareChildren[$t][$c]['childGedcomMatchTitle'];
                                                 $temp = Title::newFromText($gedcomMatchTitle, StructuredData::endsWith($label, 'familyTitle', true) ? NS_FAMILY : NS_PERSON);
                                                 $title = $skin->makeLinkObj($temp, htmlspecialchars($gedcomMatchTitle));
                                                 $output .= "<br>Matched with {$title}";
                                             }
                                             $c1 = $c + 1;
                                             $output .= "<input type=\"hidden\" id=\"mcr_0_{$c}\" name=\"mcr_0_{$c}\" value=\"{$c1}\">";
                                         } else {
                                             //									else if (@$compareChildren[$this->compareTitles[0]][$c][$label][0] != $compareChildren[$t][$c][$label][0]) { // don't allow merge if same title
                                             //										$mergeChild = (count(@$compareChildren[$this->compareTitles[0]][$c][$label]) == 1 ? $c+1 : 0);
                                             $mergeChild = $c + 1;
                                             $extra = $i == 0 ? '' : 'disabled';
                                             $mergeChildSelectOptions = $this->getMergeChildSelectOptions($c, $maxChildren);
                                             $output .= '<br>' . StructuredData::addSelectToHtml(0, "mcr_{$i}_{$c}", $mergeChildSelectOptions, $mergeChild, $extra, false);
                                         }
                                     }
                                 }
                                 $nomergeTitles = $this->getNomergeTitleMatches($compareChildren, $t, $c, 'child', '<br>');
                                 if ($nomergeTitles) {
                                     $output .= '<br><b>Do not merge with</b><br>' . $nomergeTitles;
                                 }
                                 if ((!$this->gedcomDataString || $i > 0) && !$compareChildren[$t][$c]['childUpdatable']) {
                                     $output .= "<br><font color=\"red\">Semi-protected</font> (see below)";
                                     $semiProtected = true;
                                 }
                             }
                         }
                         $output .= '</td>';
                         $i += $this->gedcomDataString ? 1 : -1;
                     }
                     $output .= '</tr>';
                 }
             }
         }
     }
     if ($this->gedcomDataString) {
         $mergeLabel = 'Prepare to update';
         $mergeFunction = 'doGedcomPrepareToMerge()';
         $notMatchFunction = 'doGedcomNotMatch()';
         $notMatchTitle = 'GEDCOM family does not match any of the families shown';
     } else {
         $mergeLabel = 'Prepare to merge';
         $mergeFunction = 'doPrepareToMerge()';
         $notMatchFunction = 'doNotMatch()';
         $notMatchTitle = 'Notify others not to merge the selected ' . ($this->namespace == 'Family' ? 'families' : 'people');
     }
     $mergeTitle = 'Prepare to combine the selected ' . ($this->namespace == 'Family' ? 'families' : 'people');
     $output .= '<tr><td align=right colspan="' . (count($this->compareTitles) + 1) . '"><input type="hidden" name="formAction">' . ($this->gedcomDataString ? '<input type="button" title="Match people in your GEDCOM to people in the selected family" value="Match" onClick="doGedcomMatch()"/> &nbsp; ' : '') . ($this->gedcomDataString ? '' : "<input type=\"button\" title=\"{$mergeTitle}\" value=\"{$mergeLabel}\" onClick=\"{$mergeFunction}\"/> &nbsp; ") . "<input type=\"button\" title=\"{$notMatchTitle}\" value=\"Not a match\" onClick=\"{$notMatchFunction}\"/>";
     '</td></tr></table></form>';
     if ($semiProtected) {
         $output .= CompareForm::getSemiprotectedMessage(CompareForm::isTrustedMerger($wgUser, $this->gedcomDataString));
     }
     return $output;
 }
示例#3
0
 protected function addSourceInput($srcNum, $source)
 {
     $id = '';
     $titleString = '';
     $title = null;
     $recordName = '';
     $page = '';
     $quality = '';
     $date = '';
     $images = '';
     $notes = '';
     $text = '';
     $ns = 0;
     $sourceSelected = '';
     $mysourceSelected = '';
     $nosourceSelected = '';
     if (isset($source)) {
         $id = htmlspecialchars((string) $source['id']);
         $titleString = (string) $source['title'];
         $recordName = htmlspecialchars((string) $source['record_name']);
         $page = htmlspecialchars((string) $source['page']);
         $quality = htmlspecialchars((string) $source['quality']);
         if ($quality && @self::$QUALITY_OPTIONS[$quality]) {
             $quality = self::$QUALITY_OPTIONS[$quality];
         }
         // convert old alpha form to numeric
         $date = htmlspecialchars((string) $source['date']);
         $images = htmlspecialchars((string) $source['images']);
         $notes = htmlspecialchars((string) $source['notes']);
         $text = htmlspecialchars((string) $source['text']);
         $text .= htmlspecialchars((string) $source);
         // get from both until we standardize on the latter
     } else {
         $id = 'S' . ($srcNum + 1);
     }
     $titleLower = mb_strtolower($titleString);
     if (mb_strpos($titleLower, 'source:') === 0) {
         $ns = NS_SOURCE;
         $titleString = mb_substr($titleString, strlen('source:'));
         $sourceSelected = ' checked';
         $autocompleteClass = ' source_input';
         $chooseVisibility = 'visible';
     } else {
         if (mb_strpos($titleLower, 'mysource:') === 0) {
             $ns = NS_MYSOURCE;
             $titleString = mb_substr($titleString, strlen('mysource:'));
             $mysourceSelected = ' checked';
             $autocompleteClass = ' mysource_input';
             $chooseVisibility = 'visible';
         } else {
             $ns = 0;
             $autocompleteClass = '';
             $nosourceSelected = ' checked';
             $chooseVisibility = 'hidden';
         }
     }
     $titleString = htmlspecialchars($titleString);
     $rowNum = $srcNum * 5;
     $tempNum = $srcNum + 1;
     return '<tr>' . '<td align="right" style="padding-top:13px"><b>Citation ID</b></td>' . "<td style=\"padding-top:13px\">{$id}<input type=\"hidden\" name=\"source_id{$srcNum}\" value=\"{$id}\"/>&nbsp;&nbsp;&nbsp;<a title=\"Remove this source\" href=\"javascript:void(0);\" onClick=\"removeSource({$tempNum}); return preventDefaultAction(event);\">remove</a></td>" . '</tr><tr>' . '<td align="right">Source</td><td>' . StructuredData::addSelectToHtml(1, "source_namespace{$srcNum}", self::$SOURCE_NAMESPACE_OPTIONS, $ns, 'class="s_select" onChange="changeSourceNamespace(' . $srcNum . ',\'' . $id . '\')"', false) . '</td>' . "<td align=\"right\">Title</td><td colspan=8><input class=\"s_title{$autocompleteClass}\" id=\"{$id}input\" tabindex=\"1\" type=\"text\" name=\"source_title{$srcNum}\" value=\"{$titleString}\"/>" . "&nbsp;<span style=\"font-size: 90%\"><a id=\"{$id}choose\" style=\"visibility:{$chooseVisibility}\" href=\"javascript:void(0);\" onClick=\"choose({$ns},'{$id}input'); return preventDefaultAction(event);\">find/add&nbsp;&raquo;</a></span></td>" . "</tr><tr>" . "<td align=\"right\">Record&nbsp;name</td><td colspan=10><input class=\"s_recordname\" tabindex=\"1\" type=\"text\" name=\"record_name{$srcNum}\" value=\"{$recordName}\"/></td>" . "</tr><tr>" . "<td align=\"right\">Volume / Pages</td><td><input class=\"s_page\" tabindex=\"1\" type=\"text\" name=\"source_page{$srcNum}\" value=\"{$page}\"/></td>" . "<td align=\"right\">Date</td><td><input class=\"s_date\" tabindex=\"1\" type=\"text\" name=\"source_date{$srcNum}\" value=\"{$date}\"/></td>" . "<td align=\"right\">Quality</td><td>" . StructuredData::addSelectToHtml(1, "source_quality{$srcNum}", self::$QUALITY_OPTIONS, $quality, 'class="s_quality"') . '</td>' . "<td colspan=2 align=\"right\">&nbsp;Images&nbsp;<a title='Add an image to this citation' href=\"#imagesSection\" onClick=\"addRef('source_input'," . ($rowNum + 2) . ",7,newImage());\">+</a></td><td><input class=\"s_ref\" tabindex=\"1\" type=\"text\" name=\"source_images{$srcNum}\" value=\"{$images}\"/></td>" . "<td align=\"right\">Notes&nbsp;<a title='Add a note to this citation' href=\"#notesSection\" onClick=\"addRef('source_input'," . ($rowNum + 2) . ",9,newNote());\">+</a></td><td><input class=\"s_ref\" tabindex=\"1\" type=\"text\" name=\"source_notes{$srcNum}\" value=\"{$notes}\"/></td>" . "</tr><tr>" . "<td align=\"right\">Text /<br/>Transcription<br/>location</td><td colspan=10><textarea class=\"s_text\" tabindex=\"1\" name=\"source_text{$srcNum}\" rows=\"3\">{$text}</textarea></td>" . "</tr>";
     //		return '<tr>'.
     //				"<td align=\"center\">$id<input type=\"hidden\" name=\"source_id$srcNum\" value=\"$id\"/></td>".
     //				"<td rowspan=2 style=\"vertical-align: top\"><span style=\"white-space: nowrap; font-size: 90%\">".
     //					"<input type=\"radio\" name=\"source_namespace$srcNum\" value=\"".NS_SOURCE."\"$sourceSelected onClick=\"setSourceNs(".NS_SOURCE.",'$id')\">Source<br>".
     //					"<input type=\"radio\" name=\"source_namespace$srcNum\" value=\"".NS_MYSOURCE."\"$mysourceSelected onClick=\"setSourceNs(".NS_MYSOURCE.",'$id')\">MySource<br>".
     //					"<input type=\"radio\" name=\"source_namespace$srcNum\" value=\"0\"$nosourceSelected onClick=\"setSourceNs(0,'$id')\">Title only".
     //					"</span></td>".
     //				"<td><input id=\"{$id}input\"$autocompleteClass tabindex=\"1\" type=\"text\" size=30 name=\"source_title$srcNum\" value=\"$titleString\"/></td>".
     //				"<td><a id=\"{$id}choose\" style=\"display:$chooseDisplay\" href=\"javascript:void(0);\" onClick=\"choose($ns,'{$id}input'); return preventDefaultAction(event);\">choose&nbsp;&raquo;</a>&nbsp;&nbsp;</td>".
     //				"<td><input tabindex=\"1\" type=\"text\" size=5 name=\"source_page$srcNum\" value=\"$page\"/></td>".
     //				"<td><input tabindex=\"1\" type=\"text\" size=5 name=\"source_quality$srcNum\" value=\"$quality\"/></td>".
     //				"<td><input tabindex=\"1\" type=\"text\" size=11 name=\"source_date$srcNum\" value=\"$date\"/></td>".
     //				"<td><a title='Add an image for this source' href=\"javascript:void(0);\" onClick=\"addRef('source_input',$rowNum,6,newImage()); return preventDefaultAction(event);\">+</a></td>".
     //				"<td><input tabindex=\"1\" type=\"text\" size=8 name=\"source_images$srcNum\" value=\"$images\"/></td>".
     //				"<td><a title='Add a note for this source' href=\"javascript:void(0);\" onClick=\"addRef('source_input',$rowNum,8,newNote()); return preventDefaultAction(event);\">+</a></td>".
     //				"<td><input tabindex=\"1\" type=\"text\" size=8 name=\"source_notes$srcNum\" value=\"$notes\"/></td>".
     //				"<td><a title='Remove this source' href=\"javascript:void(0);\" onClick=\"removeSource($tempNum); return preventDefaultAction(event);\">remove</a></td>".
     //				"</tr><tr><td></td><td>Record Name:<input tabindex=\"1\" type=\"text\" size=20 name=\"record_name$srcNum\" value=\"$recordName\"/></td>".
     //				'<td align="right">Text /<br/>Where&nbsp;found:</td>'.
     //				"<td colspan=7><textarea tabindex=\"1\" name=\"source_text$srcNum\" rows=\"3\" cols=\"65\">$text</textarea></td>".
     //				'</tr>';
 }
示例#4
0
    public function getFormHtml()
    {
        global $wgLang, $wgUser;
        $target = $this->target;
        if (!$target) {
            $target = 'AddPage';
        }
        $buttonValue = 'Next';
        $nsText = $wgLang->getFormattedNsText($this->namespace);
        if ($this->namespace == NS_PERSON) {
            $givenname = htmlspecialchars($this->givenname);
            $surname = htmlspecialchars($this->surname);
            $birthSelect = StructuredData::addSelectToHtml(1, 'bt', AddPageForm::$BIRTH_TYPE_OPTIONS, $this->birthType);
            $birthdate = htmlspecialchars($this->birthdate);
            $birthplace = htmlspecialchars($this->birthplace);
            $deathSelect = StructuredData::addSelectToHtml(1, 'dt', AddPageForm::$DEATH_TYPE_OPTIONS, $this->deathType);
            $deathdate = htmlspecialchars($this->deathdate);
            $deathplace = htmlspecialchars($this->deathplace);
            $genderSelect = StructuredData::addSelectToHtml(1, 'gnd', Person::$GENDER_OPTIONS, $this->gender);
            $parentFamily = htmlspecialchars($this->parentFamily);
            $spouseFamily = htmlspecialchars($this->spouseFamily);
            $wifegivenname = htmlspecialchars($this->wifeGivenname);
            // if we're adding a father we need to remember the mother's name
            $wifesurname = htmlspecialchars($this->wifeSurname);
            $result = <<<END
<form name="search" action="/wiki/Special:Search" method="get">
<input type="hidden" name="target" value="{$target}"/>
<input type="hidden" id="ns" name="ns" value="{$nsText}"/>
<input type="hidden" id="input_pf" name="pf" value="{$parentFamily}"/>
<input type="hidden" id="input_sf" name="sf" value="{$spouseFamily}"/>
<input type="hidden" id="input_wg" name="wg" value="{$wifegivenname}"/>
<input type="hidden" id="input_ws" name="ws" value="{$wifesurname}"/>
<table class="searchform">
<tr><td align="right">Given name: </td><td><input type="text" id="givenname_input" name="g" size=15 maxlength="50" value="{$givenname}" tabindex="1"/></td>
  <td align="right">Surname: </td><td><input type="text" name="s" size=35 maxlength="50" value="{$surname}" tabindex="1"/></td></tr>
<tr><td align="right">Gender: </td><td>{$genderSelect}</td></tr>
<tr><td align="right">{$birthSelect} date: </td><td><input type="text" name="bd" size=15 maxlength="25" value="{$birthdate}"  tabindex="1" /></td>
  <td align="right">Place: </td><td><input class="place_input" type="text" name="bp" size=35 maxlength="130" value="{$birthplace}" tabindex="1" /></td></tr>
<tr><td align="right">{$deathSelect} date: </td><td><input type="text" name="dd" size=15 maxlength="25" value="{$deathdate}" tabindex="1" /></td>
  <td align="right">Place: </td><td><input class="place_input" type="text" name="dp" size=35 maxlength="130" value="{$deathplace}" tabindex="1" /></td></tr>
<tr><td colspan=4 align="right"><input type="submit" name="add" value="{$buttonValue}" tabindex="1"/></td></tr></table>
</form>
END;
        } else {
            if ($this->namespace == NS_FAMILY) {
                $gender = htmlspecialchars($this->gender);
                $husbandgivenname = htmlspecialchars($this->husbandGivenname);
                $husbandsurname = htmlspecialchars($this->husbandSurname);
                $wifegivenname = htmlspecialchars($this->wifeGivenname);
                $wifesurname = htmlspecialchars($this->wifeSurname);
                $marriagedate = htmlspecialchars($this->marriagedate);
                $marriageplace = htmlspecialchars($this->marriageplace);
                $husbandTitle = htmlspecialchars($this->husbandTitle);
                $wifeTitle = htmlspecialchars($this->wifeTitle);
                $childTitle = htmlspecialchars($this->childTitle);
                $result = <<<END
<form name="search" action="/wiki/Special:Search" method="get">
<input type="hidden" name="target" value="{$target}"/>
<input type="hidden" id = "ns" name="ns" value="{$nsText}"/>
<input type="hidden" id="input_gnd" name="gnd" value="{$gender}"/>
<input type="hidden" id="input_ht" name="ht" value="{$husbandTitle}"/>
<input type="hidden" id="input_wt" name="wt" value="{$wifeTitle}"/>
<input type="hidden" id="input_ct" name="ct" value="{$childTitle}"/>
<table class="searchform">
<tr id="husband_row"><td align="right">Husband given name: </td><td><input type="text" name="hg" size=15 maxlength="50" value="{$husbandgivenname}" tabindex="1" /></td>
  <td align="right">Surname: </td><td><input type="text" name="hs" size=25 maxlength="50" value="{$husbandsurname}" tabindex="1" /></td></tr>
<tr><td align="right">Wife given name: </td><td><input type="text" name="wg" size=15 maxlength="50" value="{$wifegivenname}" tabindex="1" /></td>
  <td align="right">Maiden name: </td><td><input type="text" name="ws" size=25 maxlength="50" value="{$wifesurname}" tabindex="1" /></td></tr>
<tr><td align="right">Marriage date: </td><td><input type="text" name="md" size=15 maxlength="25" value="{$marriagedate}" tabindex="1" /></td>
  <td align="right">Place: </td><td><input class="place_input" type="text" name="mp" size=25 maxlength="130" value="{$marriageplace}" tabindex="1" /></td></tr>
<tr><td colspan=4 align="right"><input type="submit" name="add" value="{$buttonValue}" tabindex="1" /></td></tr></table>
</form>
END;
            } else {
                if ($this->namespace == NS_SOURCE) {
                    $title = htmlspecialchars($this->sourceTitle);
                    $author = htmlspecialchars($this->author);
                    $place = htmlspecialchars($this->place);
                    $placeIssued = htmlspecialchars($this->placeIssued);
                    $publisher = htmlspecialchars($this->publisher);
                    $select = StructuredData::addSelectToHtml(1, 'sty', Source::$ADD_SOURCE_TYPE_OPTIONS, $this->sourceType);
                    $result = <<<END
<form name="search" action="/wiki/Special:Search" method="get">
<input type="hidden" name="target" value="{$target}"/>
<input type="hidden" id = "ns" name="ns" value="{$nsText}"/>
<table class="searchform">
<tr><td align="right">Source type:</td><td align="left">{$select}</td><td></td></tr>
<tr id="author_row"><td align="right">Author:</td><td align="left"><input type="text" name="a" size="35" value="{$author}" tabindex="1" /></td><td>&nbsp;<i>surname, given name(s) of first author</i></td></tr>
<tr><td align="right">Title:</td><td align="left"><input type="text" name="st" size="35" value="{$title}" tabindex="1" /></td><td>&nbsp;<i>title only, no subtitle</i></td></tr>
<tr><td align="right">Place covered:</td><td align="left"><input class="place_input" type="text" name="p" size="35" value="{$place}" tabindex="1" /></td><td>&nbsp;<i>for government/church records</i></td></tr>
<tr><td align="right">Publisher:</td><td align="left"><input type="text" name="pu" size="35" value="{$publisher}" tabindex="1" /></td><td></td></tr>
<tr><td align="right">Place issued:</td><td align="left"><input type="text" name="pi" size="35" value="{$placeIssued}" tabindex="1" /></td><td></td></tr>
<tr><td colspan=3 align="right"><input type="submit" name="add" value="{$buttonValue}" tabindex="1" /></td></tr>
</table></form>
END;
                } else {
                    if ($this->namespace == NS_MYSOURCE) {
                        $author = htmlspecialchars($this->author);
                        $title = htmlspecialchars($this->titleText);
                        $result = <<<END
<form name="search" action="/wiki/Special:Search" method="get">
<input type="hidden" name="target" value="{$target}"/>
<input type="hidden" id = "ns" name="ns" value="{$nsText}"/>
<table class="searchform">
<tr><td align="right">Title:</td><td align="left"><input type="text" name="t" size="35" value="{$title}" tabindex="1" /></td></tr>
<tr><td colspan=2 align="right"><input type="submit" name="add" value="{$buttonValue}" tabindex="1" /></td></tr>
</table></form>
END;
                    } else {
                        if ($this->namespace == NS_PLACE) {
                            $placeName = htmlspecialchars($this->placeName);
                            $locatedIn = htmlspecialchars($this->locatedIn);
                            $result = <<<END
<form name="search" action="/wiki/Special:Search" method="get">
<input type="hidden" name="target" value="{$target}"/>
<input type="hidden" id = "ns" name="ns" value="{$nsText}"/>
<table class="searchform">
<tr id="placename_row"><td align="right">Place name:</td><td align="left"><input type="text" name="pn" size="20" value="{$placeName}" tabindex="1" /></td><td>Name of the place to add</td></tr>
<tr><td align="right">Located in:</td><td align="left"><input class="place_input" type="text" name="li" size="35" value="{$locatedIn}" tabindex="1" /></td><td>County, District, or State in which the place is located</td></tr>
<tr><td colspan=3 align="right"><input type="submit" name="add" value="{$buttonValue}" tabindex="1" /></td></tr>
</table></form>
END;
                        } else {
                            $title = htmlspecialchars($this->titleText);
                            if (strlen($this->namespace) == 0) {
                                $hiddenField = '';
                                $namespaceselect = "<tr><td align=\"right\">Namespace:</td><td align=\"left\">" . HTMLnamespaceselector('', null) . "</tr>";
                            } else {
                                $hiddenField = "<input type=\"hidden\" name=\"namespace\" value=\"{$this->namespace}\"/>";
                                $namespaceselect = '';
                            }
                            $result = <<<END
<form name="search" action="/wiki/Special:AddPage" method="get">
<input type="hidden" name="confirm" value="true"/>
{$hiddenField}
<table class="searchform">
{$namespaceselect}<tr id="title_row"><td align="right">Title:</td><td align="left"><input id="titleinput" type="text" name="t" size="40" maxlength="160" value="{$title}" />
</td><td><input type="submit" name="add" value="{$buttonValue}"/>
</td></tr></table></form>
END;
                        }
                    }
                }
            }
        }
        //      $treeCheckboxes = '';
        //      if ($this->namespace == NS_PERSON || $this->namespace == NS_FAMILY) {
        //         $treeCheckboxes = '<p>'.FamilyTreeUtil::generateTreeCheckboxes($wgUser, null, true).'</p>';
        //      }
        $addPageCache = $this->namespace == NS_SOURCE || $this->namespace == NS_MYSOURCE || $this->namespace == NS_PERSON || $this->namespace == NS_FAMILY ? '<div id="addpage_cache" style="display:none"></div>' : '';
        // was $treeCheckboxes inside div
        return '<center>' . $result . '</center>' . $addPageCache;
    }
示例#5
0
 /**
  * Show a namespace selection form for filtering
  *
  * @return string
  */
 function getPageHeader()
 {
     $thisTitle = Title::makeTitle(NS_SPECIAL, $this->getName());
     $form = wfOpenElement('form', array('method' => 'get', 'action' => $thisTitle->getLocalUrl()));
     $form .= wfElement('label', array('for' => 'status'), 'Status') . ' ';
     $form .= StructuredData::addSelectToHtml(0, 'status', self::$STATUS_OPTIONS, $this->status, '', false);
     # Preserve the offset and limit
     $form .= wfElement('input', array('type' => 'hidden', 'name' => 'offset', 'value' => $this->offset));
     $form .= wfElement('input', array('type' => 'hidden', 'name' => 'limit', 'value' => $this->limit));
     $form .= wfElement('input', array('type' => 'submit', 'name' => 'submit', 'id' => 'submit', 'value' => wfMsg('allpagessubmit')));
     $form .= wfCloseElement('form');
     return $form;
 }
示例#6
0
    public function getFormHtml()
    {
        global $wgUser;
        $target = htmlspecialchars($this->target);
        $givenname = htmlspecialchars($this->givenname);
        $surname = htmlspecialchars($this->surname);
        $place = htmlspecialchars($this->place);
        $birthdate = htmlspecialchars($this->birthdate);
        $birthplace = htmlspecialchars($this->birthplace);
        $deathdate = htmlspecialchars($this->deathdate);
        $deathplace = htmlspecialchars($this->deathplace);
        $fathergivenname = htmlspecialchars($this->fatherGivenname);
        $fathersurname = htmlspecialchars($this->fatherSurname);
        $mothergivenname = htmlspecialchars($this->motherGivenname);
        $mothersurname = htmlspecialchars($this->motherSurname);
        $spousegivenname = htmlspecialchars($this->spouseGivenname);
        $spousesurname = htmlspecialchars($this->spouseSurname);
        $husbandgivenname = htmlspecialchars($this->husbandGivenname);
        $husbandsurname = htmlspecialchars($this->husbandSurname);
        $wifegivenname = htmlspecialchars($this->wifeGivenname);
        $wifesurname = htmlspecialchars($this->wifeSurname);
        $marriagedate = htmlspecialchars($this->marriagedate);
        $marriageplace = htmlspecialchars($this->marriageplace);
        $placename = htmlspecialchars($this->placename);
        $locatedinplace = htmlspecialchars($this->locatedinplace);
        $title = htmlspecialchars($this->title);
        $author = htmlspecialchars($this->author);
        $sourcetitle = htmlspecialchars($this->sourceTitle);
        $keywords = htmlspecialchars($this->keywords);
        // generate form
        if ($wgUser->isLoggedIn()) {
            $watchSelectExtra = '';
        } else {
            $watchSelectExtra = 'disabled';
        }
        $watchSelect = StructuredData::addSelectToHtml(0, "watch", self::$WATCH_OPTIONS, $this->watch, $watchSelectExtra, false);
        $hiddenFields = '';
        if ($target || $this->match) {
            if ($target) {
                $hiddenFields .= '<input type="hidden" name="target" value="' . $target . '"/>';
            } else {
                $hiddenFields .= '<input type="hidden" name="match" value="true"/><input type="hidden" name="pagetitle" value="' . htmlspecialchars($this->pagetitle) . '"/>';
            }
            $hiddenFields .= '<input id="ns" type="hidden" name="ns" value="' . htmlspecialchars($this->namespace) . '"/>';
            $nsSelectField = 'dummy';
            // disabled fields don't get passed back
            $nsSelectExtra = 'disabled';
        } else {
            $nsSelectField = 'ns';
            $nsSelectExtra = 'onChange="showSearchFields()"';
        }
        $hiddenFields .= $this->addHiddenInput('gnd', $this->personGender);
        $hiddenFields .= $this->addHiddenInput('bt', $this->birthType);
        $hiddenFields .= $this->addHiddenInput('dt', $this->deathType);
        $hiddenFields .= $this->addHiddenInput('sty', $this->sourceType);
        $hiddenFields .= $this->addHiddenInput('pi', $this->placeIssued);
        $hiddenFields .= $this->addHiddenInput('pu', $this->publisher);
        $hiddenFields .= $this->addHiddenInput('ct', $this->childTitle);
        $hiddenFields .= $this->addHiddenInput('ht', $this->husbandTitle);
        $hiddenFields .= $this->addHiddenInput('wt', $this->wifeTitle);
        $hiddenFields .= $this->addHiddenInput('pf', $this->parentFamily);
        $hiddenFields .= $this->addHiddenInput('sf', $this->spouseFamily);
        $nsSelect = StructuredData::addSelectToHtml(0, $nsSelectField, self::$NAMESPACE_OPTIONS, $this->namespace, $nsSelectExtra, false);
        if ($this->ecp == 'p') {
            $this->sort = 'score';
        }
        $sortSelect = StructuredData::addSelectToHtml(0, "sort", self::$SORT_OPTIONS, $this->sort, '', false);
        // TODO
        //$talkSpan = '<span id="talk_input"><input type="checkbox" name="talk"'.($this->talk ? ' checked' : '').'/>Include talk</span>';
        $talkSpan = '';
        $subChecked = $this->sub ? ' checked' : '';
        $supChecked = $this->sup ? ' checked' : '';
        $birthRangeSelect = StructuredData::addSelectToHtml(0, 'br', self::$DATE_RANGE_OPTIONS, $this->birthrange, '', false);
        $deathRangeSelect = StructuredData::addSelectToHtml(0, 'dr', self::$DATE_RANGE_OPTIONS, $this->deathrange, '', false);
        $marriageRangeSelect = StructuredData::addSelectToHtml(0, 'mr', self::$DATE_RANGE_OPTIONS, $this->marriagerange, '', false);
        $sourceSubjectSelect = StructuredData::addSelectToHtml(0, 'su', Source::$SOURCE_SUBJECT_OPTIONS, $this->sourceSubject);
        $sourceAvailabilitySelect = StructuredData::addSelectToHtml(0, 'sa', Source::$SOURCE_AVAILABILITY_OPTIONS, $this->sourceAvailability);
        $rowsSelector = StructuredData::addSelectToHtml(0, 'rows', self::$ROWS_OPTIONS, $this->rows, '', false);
        $ecpSelector = StructuredData::addSelectToHtml(0, 'ecp', self::$ECP_OPTIONS, $this->ecp, '', false);
        $heading = $this->target && $this->namespace != 'Image' ? '<h2 style="padding-bottom:4px">Review possible matches. Select a match or click Add Page</h2>' : '';
        $condensedChecked = $this->condensedView ? ' checked="checked"' : '';
        if ($this->target) {
            $relativeRows = '';
        } else {
            $relativeRows = <<<END
<tr id="father_row">
<td align=right>Father given: </td><td colspan=2><input id="input_fg" class="input_medium" type="text" name="fg" maxlength=50 value="{$fathergivenname}" onfocus="select()"/></td>
<td align=right>Surname: </td><td colspan=2><input id="input_fs" class="input_wider" type="text" name="fs" maxlength=50 value="{$fathersurname}" onfocus="select()"/></td>
</tr><tr id="mother_row">
<td align=right>Mother given: </td><td colspan=2><input id="input_mg" class="input_medium" type="text" name="mg" maxlength=50 value="{$mothergivenname}" onfocus="select()"/></td>
<td align=right>Surname: </td><td colspan=2><input id="input_ms" class="input_wider" type="text" name="ms" maxlength=50 value="{$mothersurname}" onfocus="select()"/></td>
</tr><tr id="spouse_row">
<td align=right>Spouse given: </td><td colspan=2><input id="input_sg" class="input_medium" type="text" name="sg" maxlength=50 value="{$spousegivenname}" onfocus="select()"/></td>
<td align=right>Surname: </td><td colspan=2><input id="input_ss" class="input_wider" type="text" name="ss" maxlength=50 value="{$spousesurname}" onfocus="select()"/></td>
</tr>
END;
        }
        $result = <<<END
{$heading}
<form id="search_form" name="search" action="/wiki/Special:Search" method="get">
{$hiddenFields}
<table id="searchform" class="searchform"><tr>
<td colspan=6 align=right><span class="sort_label">Sort by</span>{$sortSelect}</td>
</tr><tr>
<td align=right>Namespace: </td><td>{$nsSelect}</td><td>{$talkSpan}</td>
<td colspan=3 align=right>{$watchSelect}</td>
</tr><tr id="author_row">
<td align=right>Author: </td><td colspan=5><input id="input_a" class="input_long" type="text" name="a" maxlength=100 value="{$author}" onfocus="select()"/></td>
</tr><tr id="source_title_row">
<td align=right>Title: </td><td colspan=5><input id="input_st" class="input_long" type="text" name="st" maxlength=100 value="{$sourcetitle}" onfocus="select()"/></td>
</tr><tr id="coverage_row">
<td align=right></td><td colspan=5>Covers:</td>
</tr><tr id="name_row">
<td id="givenname_cell1" align=right>Given name: </td><td id="givenname_cell2" colspan=2><input id="input_g" class="input_medium" type="text" name="g" maxlength=50 value="{$givenname}" onfocus="select()"/></td>
<td align=right>Surname: </td><td colspan=2><input id="input_s" class="input_wider" type="text" name="s" maxlength=50 value="{$surname}" onfocus="select()"/></td>
</tr><tr id="place_row">
<td align=right>Place: </td><td colspan=5><input id="input_p" class="input_long place_input" type="text" name="p" maxlength=130 value="{$place}" onfocus="select()"/></td>
</tr><tr id="source_place_row">
<td align=right></td><td colspan=5>&nbsp; Include sources for <input type="checkbox" name="sub"{$subChecked}/>subordinate places <input type="checkbox" name="sup"{$supChecked}/>superior places</td>
</tr><tr id="birth_row">
<td align=right>Birth/Chr date: </td><td colspan=2><input id="input_bd" class="input_short" type="text" name="bd" size=14 maxlength=25 value="{$birthdate}" onfocus="select()"/> &nbsp;{$birthRangeSelect}</td>
<td align=right>Place: </td><td colspan=2><input id="input_bp" class="input_wider place_input" type="text" name="bp" maxlength=130 value="{$birthplace}" onfocus="select()"/></td>
</tr><tr id="death_row">
<td align=right>Death/Bur date: </td><td colspan=2><input id="input_dd" class="input_short" type="text" name="dd" size=14 maxlength=25 value="{$deathdate}" onfocus="select()"/> &nbsp;{$deathRangeSelect}</td>
<td align=right>Place: </td><td colspan=2><input id="input_dp" class="input_wider place_input" type="text" name="dp" maxlength=130 value="{$deathplace}" onfocus="select()"/></td>
</tr>
{$relativeRows}
<tr id="husband_row">
<td align=right>Husband given: </td><td colspan=2><input id="input_hg" class="input_medium" type="text" name="hg" maxlength=50 value="{$husbandgivenname}" onfocus="select()"/></td>
<td align=right>Surname: </td><td colspan=2><input id="input_hs" class="input_wider" type="text" name="hs" maxlength=50 value="{$husbandsurname}" onfocus="select()"/></td>
</tr><tr id="wife_row">
<td align=right>Wife given: </td><td colspan=2><input id="input_wg" class="input_medium" type="text" name="wg" maxlength=50 value="{$wifegivenname}" onfocus="select()"/></td>
<td align=right>Surname: </td><td colspan=2><input id="input_ws" class="input_wider" type="text" name="ws" maxlength=50 value="{$wifesurname}" onfocus="select()"/></td>
</tr><tr id="marriage_row">
<td align=right>Marriage date: </td><td colspan=2><input id="input_md" class="input_short" type="text" name="md" size=14 maxlength=25 value="{$marriagedate}" onfocus="select()"/> &nbsp;{$marriageRangeSelect}</td>
<td align=right>Place: </td><td colspan=2><input id="input_mp" class="input_wider place_input" type="text" name="mp" maxlength=130 value="{$marriageplace}" onfocus="select()"/></td>
</tr><tr id="placename_row">
<td align=right>Place name: </td><td colspan=2><input id="input_pn" class="input_medium" type="text" name="pn" maxlength=50 value="{$placename}" onfocus="select()"/></td>
<td align=right>Located in: </td><td colspan=2><input id="input_li" class="input_wider place_input" type="text" name="li" maxlength=130 value="{$locatedinplace}" onfocus="select()"/></td>
</tr><tr id="subject_row">
<td align=right>Subject: </td><td colspan=2>{$sourceSubjectSelect}</td>
<td align=right>Availability: </td><td colspan=2>{$sourceAvailabilitySelect}</td>
</tr><tr id="title_row">
<td align=right>Page title: </td><td colspan=5><input id="input_t" class="input_long" type="text" name="t" maxlength=100 value="{$title}" onfocus="select()"/></td>
</tr><tr>
<td align=right>Keywords: </td><td colspan=5><input id="input_k" class="input_long" type="text" name="k" maxlength=100 value="{$keywords}" onfocus="select()"/></td>
</tr><tr>
<td colspan=2>{$rowsSelector} results per page <input type="checkbox" name="cv"{$condensedChecked}>condensed</td><td align="right" colspan=4>{$ecpSelector} <input type="submit" value="Search"/></td>
</tr></table></form>
END;
        return $result;
    }
示例#7
0
    /**
     * Displays the main upload form, optionally with a highlighted
     * error message up at the top.
     *
     * @param string $msg as HTML
     * @access private
     */
    function mainUploadForm($msg = '')
    {
        global $wgOut, $wgUser;
        global $wgUseCopyrightUpload;
        // set up page
        $wgOut->setPagetitle('Import GEDCOM');
        $wgOut->setArticleRelated(false);
        $wgOut->setRobotpolicy('noindex,nofollow');
        if ('' != $msg) {
            $sub = 'Import Error';
            $wgOut->addHTML("<h2>{$sub}</h2>\n" . "<span class='error'>{$msg}</span>\n");
        }
        $wgOut->addScript(<<<END
<script type='text/javascript'>/*<![CDATA[*/
function hideNewTreeName() {
\tsel = document.getElementById('wrTreeName');
\ttreeName = sel.options[sel.selectedIndex].value;
   \$('span.wrNewTreeName').css('display',treeName == '[new]' ? 'inline' : 'none');
}
/*]]>*/</script>
END
);
        $sk = $wgUser->getSkin();
        $country = $this->mDefaultCountry ? $this->mDefaultCountry : 'United States';
        $defaultCountryControl = StructuredData::addSelectToHtml(0, 'wrDefaultCountry', GedcomImport::$DEFAULT_COUNTRIES, $country, '', false);
        $treeFound = false;
        $trees = FamilyTreeUtil::getFamilyTrees($wgUser->getName(), false);
        $treeList = '<select name="wrTreeName" id="wrTreeName" onchange="hideNewTreeName()">';
        for ($i = 0; $i < count($trees); $i++) {
            $encTreeName = htmlspecialchars($trees[$i]['name']);
            if ($trees[$i]['name'] == $this->mTreeName) {
                $treeFound = true;
                $selected = ' selected="selected"';
            } else {
                $selected = '';
            }
            $treeList .= "<option value=\"{$encTreeName}\"{$selected}>{$encTreeName}</option>";
        }
        if ($treeFound || strlen($this->mTreeName) == 0 && count($trees) > 0) {
            $selected = '';
            $display = 'none';
            $encNewTreeName = '';
        } else {
            $selected = ' selected="selected"';
            $display = 'inline';
            $encNewTreeName = htmlspecialchars($this->mNewTreeName);
        }
        $treeList .= "<option value=\"[new]\"{$selected}>&lt;New tree&gt;</option>";
        $treeList .= '</select>';
        $sourcefilename = 'GEDCOM filename';
        $importIntoTree = 'Import into tree';
        $newTreeName = 'Tree name';
        $importGedcom = 'Import GEDCOM';
        $titleObj = Title::makeTitle(NS_SPECIAL, 'ImportGedcom');
        $action = $titleObj->escapeLocalURL();
        $wgOut->addHTML(<<<END
<form id='import' method='post' enctype='multipart/form-data' action="{$action}">
<table border='0'>
<tr>
 <td align='right'><label for='wrUploadFile'>{$sourcefilename}:</label></td>
 <td align='left'><input type='file' name='wrUploadFile' id='wrUploadFile' size='30' /></td>
</tr>
<tr>
 <td align="right"><label for="wrDefaultCountry">Default country:</label></td>
 <td align="left" style="font-size: 11px; line-height:2em">{$defaultCountryControl} &nbsp; if places in your GEDCOM don't have countries, this country will be assumed</td>
</tr>
<tr>
 <td align='right'><label for='wrTreeName'>{$importIntoTree}</label></td>
 <td align='left'>{$treeList}
\t<span class='wrNewTreeName' style='display:{$display}'><label for='wrNewTreeName'>{$newTreeName}</label></span>
   <span class='wrNewTreeName' style='display:{$display}'><input type='text' name='wrNewTreeName' size='29' value="{$encNewTreeName}"/></span>
   &nbsp;<input type='submit' id='wrImport' name='wrImport' value="{$importGedcom}" /></td>
</tr>
</table>
</form>
END
);
        $wgOut->addWikiText(wfMsg('importgedcomtext'));
    }
示例#8
0
    public function getFormHtml()
    {
        $name = htmlspecialchars($this->name);
        $nameTypeSelect = StructuredData::addSelectToHtml(0, "type", self::$TYPE_OPTIONS, $this->type, '', false);
        $namesend = preg_replace('#</?p>#', '', wfMsgWikiHtml('namesend'));
        $result = <<<END
<form id="names_form" action="/wiki/Special:Names" method="get">
<table id="namesform" class="namesform"><tr>
<td align=right>{$nameTypeSelect}</td>
<td><input id="input_name" class="input_name" type="text" name="name" maxlength=100 value="{$name}" onfocus="select()"/></td>
<td><input type="submit" value="Go"/></td>
<td style="padding-left:15px">{$namesend}</td>
</tr></table></form>
END;
        return $result;
    }
示例#9
0
 /**
  * Create edit fields from xml property
  * textbox1 passed by reference for efficiency; don't change it
  */
 protected function toEditFields(&$textbox1)
 {
     global $wgOut, $wgScriptPath, $wgESINHandler, $wgRequest;
     $result = '';
     //      $target = $wgRequest->getVal('target');
     // add javascript functions
     $wgOut->addScript("<script type=\"text/javascript\" src=\"{$wgScriptPath}/jquery.tablednd_0_5.yui.1.js\"></script>");
     $wgOut->addScript("<script type=\"text/javascript\" src=\"{$wgScriptPath}/personfamily.31.js\"></script>");
     $wgOut->addScript("<script type=\"text/javascript\" src=\"{$wgScriptPath}/autocomplete.10.js\"></script>");
     $tm = new TipManager();
     $name = null;
     $altNames = null;
     $invalidStyle = ' style="background-color:#fdd;"';
     $genderStyle = '';
     $childOfFamilyStyle = '';
     $spouseOfFamilyStyle = '';
     $genderString = '';
     $childOfFamilies = array();
     $spouseOfFamilies = array();
     $exists = isset($this->xml);
     if (!$exists) {
         // && !StructuredData::isRedirect($textbox1)) {
         // construct <person> text from What Links Here and from request
         $oldText = $this->getPageTextFromWLH(true, $wgRequest);
         $this->xml = StructuredData::getXml('person', $oldText);
     }
     if (isset($this->xml)) {
         $name = $this->xml->name;
         $altNames = $this->xml->alt_name;
         $genderString = (string) $this->xml->gender;
         $childOfFamilies = StructuredData::getTitlesAsArray($this->xml->child_of_family);
         $spouseOfFamilies = StructuredData::getTitlesAsArray($this->xml->spouse_of_family);
     }
     $this->addRequestMembers('pf', $childOfFamilies);
     $this->addRequestMembers('sf', $spouseOfFamilies);
     if (ESINHandler::isLiving($this->xml)) {
         $result .= "<p><font color=red>This person was born/christened less than 110 years ago and does not have a death/burial date.  Living people cannot be entered into WeRelate.org.</font></p>";
     } else {
         if (!$this->isGedcomPage && !StructuredData::titleStringHasId($this->titleString)) {
             $result .= "<p><font color=red>The page title does not have an ID; please create a page with an ID using <a href='/wiki/Special:AddPage/Person'>Add page</a></font></p>";
         }
     }
     if ($exists && !$genderString) {
         $result .= "<p><font color=red>You must select a gender</font></p>";
         $genderStyle = $invalidStyle;
     }
     if (StructuredData::titlesOverlap($childOfFamilies, $spouseOfFamilies)) {
         $result .= "<p><font color=red>This person cannot be a child of and a spouse of the same family</font></p>";
         $childOfFamilyStyle = $invalidStyle;
         $spouseOfFamilyStyle = $invalidStyle;
     }
     if (!$this->isGedcomPage && (StructuredData::titlesMissingId($childOfFamilies) || !StructuredData::titlesExist(NS_FAMILY, $childOfFamilies))) {
         $result .= "<p><font color=red>Parents family page not found; please remove it, save this page, then add a new one</font></p>";
     }
     if (!$this->isGedcomPage && (StructuredData::titlesMissingId($spouseOfFamilies) || !StructuredData::titlesExist(NS_FAMILY, $spouseOfFamilies))) {
         $result .= "<p><font color=red>Spouse family page not found; please remove it, save this page, then add a new one</font></p>";
     }
     if (ESINHandler::hasAmbiguousDates($this->xml)) {
         $result .= "<p><font color=red>Please write dates in \"<i>D MMM YYYY</i>\" format so they are unambiguous (ie 5 Jan 1900)</font></p>";
     }
     // add name input table
     $rows = '';
     $display = 'none';
     if (isset($altNames)) {
         $i = 1;
         foreach ($altNames as $altName) {
             $display = 'inline';
             $rows .= $this->addNameInput($i, $altName);
             $i++;
         }
     }
     $result .= '<h2>Name</h2>';
     $result .= '<table id="name_input" border=0 cellpadding=3>' . '<tr><th></th><th>Name&nbsp;prefix' . $tm->addMsgTip('TitlePrefix') . '</th><th>Given' . $tm->addMsgTip('GivenName') . '</th><th>Surname' . $tm->addMsgTip('Surname') . '</th>' . '<th>Name&nbsp;suffix' . $tm->addMsgTip('TitleSuffix') . '</th>' . '<th></th><th>Source(s)' . $tm->addMsgTip('NameSourceIDs') . '</th><th></th><th>Note(s)' . $tm->addMsgTip('NameNoteIDs') . '</th></tr>' . $this->addNameInput(0, $name, $display) . $rows . '</table><div class="addESINLink"><a href="javascript:void(0);" onClick="addName(\'' . implode(',', self::$NAME_TYPES) . '\'); return preventDefaultAction(event);">Add alternate name</a></div>';
     // add gender input
     $result .= '<br><br><label for="gender">Gender: </label>' . StructuredData::addSelectToHtml(1, 'gender', Person::$GENDER_OPTIONS, $genderString, $genderStyle) . '<br><br>';
     // add child of family input
     $result .= $this->addFamilyInput($childOfFamilies, 'child_of_family', 'Parents and siblings family', 'ChildOfFamily', $childOfFamilyStyle, $tm, $invalidStyle);
     //, substr($target, 0, 5) == 'child');
     // add spouse of family input
     $result .= $this->addFamilyInput($spouseOfFamilies, 'spouse_of_family', 'Spouse and children family', 'SpouseOfFamily', $spouseOfFamilyStyle, $tm, $invalidStyle);
     //, substr($target, 0, 4) == 'wife' || substr($target, 0, 7) == 'husband');
     // add event_fact input table
     $result .= $wgESINHandler->addEventsFactsInput($this->xml, self::$STD_EVENT_TYPES, self::$OTHER_EVENT_TYPES);
     // add sources, images, notes input tables
     $result .= $wgESINHandler->addSourcesImagesNotesInput($this->xml);
     $result .= $tm->getTipTexts();
     $result .= '<h2>Personal History</h2>';
     return $result;
 }
示例#10
0
文件: Hooks.php 项目: k-hasan-19/wiki
function wrDoContentActions($action, $article)
{
    global $wgUser, $wgOut, $wgRequest;
    if ($action != 'treeUpdate' && $action != 'treeUpdateConfirm') {
        return true;
        // handle by another content action handler
    }
    if ($wgUser->isAnon()) {
        $wgOut->showErrorPage('treenologintitle', 'treenologintext');
        return false;
    }
    if (!FamilyTreeUtil::isTreePage($article->getTitle()->getNamespace(), $article->getTitle()->getDBkey())) {
        $wgOut->showErrorPage('treenonamespacetitle', 'treenonamespacetext');
        return false;
    }
    if (wfReadOnly()) {
        $wgOut->readOnlyPage();
        return false;
    }
    $allTrees = FamilyTreeUtil::getFamilyTrees($wgUser->getName());
    $treeOwnerIds = FamilyTreeUtil::getOwnerTrees($wgUser, $article->getTitle(), false);
    $checkedTreeIds = FamilyTreeUtil::readTreeCheckboxes($allTrees, $wgRequest);
    $ancGenerations = $wgRequest->getVal('ancestorgenerations');
    $includeAncestorChildren = $wgRequest->getCheck('includeancestorchildren');
    $descGenerations = $wgRequest->getVal('descendantgenerations');
    $wgOut->setRobotpolicy('noindex,nofollow');
    if ($action == 'treeUpdateConfirm' && ($ancGenerations == 0 && $descGenerations == 0 || count($checkedTreeIds) > 0)) {
        $dbw =& wfGetDB(DB_MASTER);
        $result = FamilyTreeUtil::updateTrees($dbw, $article->getTitle(), $article->getRevIdFetched(), $allTrees, $treeOwnerIds, $checkedTreeIds);
        if ($result) {
            $dbw->commit();
        } else {
            $dbw->rollback();
        }
        if ($ancGenerations > 0 || $descGenerations > 0) {
            $job = new AddTreePagesJob(array('trees' => join(',', $checkedTreeIds), 'user' => $wgUser->getName(), 'title' => $article->getTitle()->getPrefixedText(), 'ancGenerations' => $ancGenerations, 'includeAncestorChildren' => $includeAncestorChildren, 'descGenerations' => $descGenerations));
            $job->insert();
            $treesUpdatedMsg = 'treesupdatedtextdeferred';
        } else {
            $treesUpdatedMsg = 'treesupdatedtext';
        }
        $wgOut->setPagetitle(wfMsg('treesupdatedtitle'));
        $wgOut->addWikiText(wfMsg($treesUpdatedMsg));
        $wgOut->returnToMain(true, $article->getTitle()->getPrefixedText());
    } else {
        if (count($allTrees) == 0) {
            $wgOut->showErrorPage('treenonetitle', 'treenonetext');
        } else {
            // show form
            $wgOut->setPagetitle(wfMsg('treeupdatetitle'));
            if ($action == 'treeUpdateConfirm') {
                $wgOut->addHTML('<font color="red">Please check the box next to the tree(s) you want to add the pages to.</font>');
            }
            $wgOut->addWikiText('==Trees==');
            $wgOut->addWikiText(wfMsg('treeupdatetext'));
            // TODO show form
            $action = $article->getTitle()->escapeLocalURL('action=treeUpdateConfirm');
            $wgOut->addHTML(<<<END
<form id="treeUpdate" method="post" action="{$action}" enctype="multipart/form-data">
END
);
            $wgOut->addHTML(FamilyTreeUtil::generateTreeCheckboxes($wgUser, $article->getTitle(), false, $allTrees, $treeOwnerIds));
            if ($article->getTitle()->getNamespace() == NS_PERSON || $article->getTitle()->getNamespace() == NS_FAMILY) {
                $wgOut->addWikiText('==Include relatives==');
                $wgOut->addWikiText(":'''''Warning''': including relatives can add potentially many people to your tree and to your watchlist.''");
                $wgOut->addWikiText(':Add the following relatives to the checked trees.');
                $options = array();
                for ($i = 0; $i <= 20; $i++) {
                    $options["{$i}"] = $i;
                }
                $ancGenerations = StructuredData::addSelectToHtml(0, 'ancestorgenerations', $options, 0);
                $options = array();
                for ($i = 0; $i <= 5; $i++) {
                    $options["{$i}"] = $i;
                }
                $descGenerations = StructuredData::addSelectToHtml(0, 'descendantgenerations', $options, 0);
                $wgOut->addHTML(<<<END
<dl><dd>Include ancestors for {$ancGenerations} generations
\t<dl><dd><input type="checkbox" name="includeancestorchildren"/>Also include ancestors' children</dd></dl></dd>
<dd>&nbsp;</dd>
<dd>Include descendants for {$descGenerations} generations</dd>
</dl>
END
);
            }
            $updateButton = array('id' => 'wrTreeUpdate', 'name' => 'wrTreeUpdate', 'type' => 'submit', 'value' => wfMsg('treeupdatebutton'), 'title' => wfMsg('treeupdatebuttontip'));
            $wgOut->addHTML(wfElement('input', $updateButton, ''));
            $wgOut->addHTML("</form>\n");
        }
    }
    return false;
    // stop processing
}
示例#11
0
 /**
  * Create edit fields from xml property
  */
 protected function toEditFields(&$textbox1)
 {
     global $wgOut, $wgScriptPath, $wgRequest;
     $result = '';
     $target = $wgRequest->getVal('target');
     // add javascript functions
     $wgOut->addScript("<script type=\"text/javascript\" src=\"{$wgScriptPath}/autocomplete.10.js\"></script>");
     //      if ($target && $target != 'AddPage') {
     //         $result .= "<p><font color=red>Add any additional information you have about the source".
     //                     ($target == 'gedcom' ? ' and save the page' : ', save the page, then close this window').
     //                    ".</font></p>";
     //      }
     $wgOut->addScript("<script type=\"text/javascript\" src=\"{$wgScriptPath}/jquery.multiSelect.yui.1.js\"></script>");
     $wgOut->addScript("<script type=\"text/javascript\" src=\"{$wgScriptPath}/source.18.js\"></script>");
     $tm = new TipManager();
     $sourceType = '';
     $authors = '';
     $sourceTitle = '';
     $subtitle = '';
     $publisher = '';
     $dateIssued = '';
     $placeIssued = '';
     $seriesName = '';
     $pages = '';
     $references = '';
     $surnames = '';
     $places = '';
     $subjects = array();
     $ethnicity = '';
     $religion = '';
     $occupation = '';
     $fromYear = '';
     $toYear = '';
     $invalidStyle = ' style="background-color:#fdd;"';
     $fromYearStyle = '';
     $toYearStyle = '';
     $exists = isset($this->xml);
     if (!$exists) {
         // construct <source> text from request
         $text = Source::getPageText($wgRequest->getVal('sty'), $wgRequest->getVal('st'), $wgRequest->getVal('a'), $wgRequest->getVal('p'), $wgRequest->getVal('pi'), $wgRequest->getVal('pu'));
         $this->xml = StructuredData::getXml('source', $text);
     }
     if (isset($this->xml)) {
         $sourceType = htmlspecialchars((string) $this->xml->source_type);
         foreach ($this->xml->author as $author) {
             $authors .= htmlspecialchars((string) $author) . "\n";
         }
         $sourceTitle = htmlspecialchars((string) $this->xml->source_title);
         if (!$sourceTitle) {
             $sourceTitle = htmlspecialchars($this->titleString);
         }
         $subtitle = htmlspecialchars((string) $this->xml->subtitle);
         $publisher = htmlspecialchars((string) $this->xml->publisher);
         if (!$publisher) {
             $publisher = htmlspecialchars((string) $this->xml->publication_info);
         }
         $dateIssued = htmlspecialchars((string) $this->xml->date_issued);
         $placeIssued = htmlspecialchars((string) $this->xml->place_issued);
         $seriesName = htmlspecialchars((string) $this->xml->series_name);
         $volumes = htmlspecialchars((string) $this->xml->volumes);
         $pages = htmlspecialchars((string) $this->xml->pages);
         $references = htmlspecialchars((string) $this->xml->references);
         foreach ($this->xml->surname as $surname) {
             $surnames .= htmlspecialchars((string) $surname) . "\n";
         }
         foreach ($this->xml->place as $place) {
             $places .= htmlspecialchars((string) $place) . "\n";
         }
         foreach ($this->xml->subject as $subject) {
             $subjects[] = htmlspecialchars((string) $subject);
         }
         if (count($subjects) == 0 && (string) $this->xml->source_category) {
             $subjects[] = htmlspecialchars((string) $this->xml->source_category);
         }
         $ethnicity = htmlspecialchars((string) $this->xml->ethnicity);
         $religion = htmlspecialchars((string) $this->xml->religion);
         $occupation = htmlspecialchars((string) $this->xml->occupation);
         $fromYear = htmlspecialchars((string) $this->xml->from_year);
         $toYear = htmlspecialchars((string) $this->xml->to_year);
         $url = htmlspecialchars((string) $this->xml->url);
         // old
         $callNumber = htmlspecialchars((string) $this->xml->call_number);
         // old
         $repoName = htmlspecialchars((string) $this->xml->repository_name);
         // old
         $repoAddr = htmlspecialchars((string) $this->xml->repository_addr);
         // old
     }
     $missingAvailability = false;
     if (isset($this->xml)) {
         foreach ($this->xml->repository as $repository) {
             // the source_location condition is temporary
             if (!(string) $repository['availability'] && stripos((string) $repository['source_location'], 'www.familysearch.org/Eng/Library/fhlcatalog') === false) {
                 $missingAvailability = true;
             }
         }
         if ($url && stripos($url, 'www.familysearch.org/Eng/Library/fhlcatalog') === false) {
             $missingAvailability = true;
         }
     }
     if ($missingAvailability) {
         $result .= "<p><font color=red>Please select an Availability</font></p>";
     }
     if (!StructuredData::isValidYear($fromYear) || !StructuredData::isValidYear($toYear)) {
         if (!StructuredData::isValidYear($fromYear)) {
             $fromYearStyle = $invalidStyle;
         }
         if (!StructuredData::isValidYear($toYear)) {
             $toYearStyle = $invalidStyle;
         }
         $result .= "<p><font color=red>The year range is not valid</font></p>";
     }
     // display edit fields
     $result .= "<h2>Source information</h2><table>" . '<tr><td align=right>Type:</td><td align=left>' . StructuredData::addSelectToHtml(1, 'source_type', self::$SOURCE_TYPE_OPTIONS, $sourceType, 'onChange="showSourceFields()"') . $tm->addMsgTip('SourceType') . '</td></tr>' . '<tr id="authors_row"><td align=right>Authors:<br/><font size=\\"-1\\"><i>one per line<br/>surname, given</i></font></td>' . "<td align=left><textarea tabindex=\"1\" name=\"authors\" rows=\"3\" cols=\"60\">{$authors}</textarea></td></tr>" . "<tr id=\"source_title_row\"><td align=right>Title:</td><td align=left><input tabindex=\"1\" name=\"source_title\" value=\"{$sourceTitle}\" size=\"60\"/></td></tr>" . "<tr id=\"subtitle_row\"><td align=right>Subtitle:</td><td align=left><input tabindex=\"1\" name=\"subtitle\" value=\"{$subtitle}\" size=\"60\"/></td></tr>" . "<tr id=\"publisher_row\"><td align=right>Publisher:</td><td align=left><input tabindex=\"1\" name=\"publisher\" value=\"{$publisher}\" size=\"60\"/></td></tr>" . "<tr id=\"date_issued_row\"><td align=right>Date issued:</td><td align=left><input tabindex=\"1\" name=\"date_issued\" value=\"{$dateIssued}\" size=\"20\"/></td></tr>" . "<tr id=\"place_issued_row\"><td align=right>Place issued:</td><td align=left><input tabindex=\"1\" name=\"place_issued\" value=\"{$placeIssued}\" size=\"60\"/></td></tr>" . "<tr id=\"series_name_row\"><td align=right>Periodical/Series name:</td><td align=left><input tabindex=\"1\" class=\"source_input\" name=\"series_name\" value=\"{$seriesName}\" size=\"60\"/></td></tr>" . "<tr id=\"volumes_row\"><td align=right>Number of volumes:</td><td align=left><input tabindex=\"1\" name=\"volumes\" value=\"{$volumes}\" size=\"10\"/></td></tr>" . "<tr id=\"pages_row\"><td align=right>Volume/Film#/Pages:</td><td align=left><input tabindex=\"1\" name=\"pages\" value=\"{$pages}\" size=\"20\"/></td></tr>" . "<tr id=\"references_row\"><td align=right>References/Cites:</td><td align=left><input tabindex=\"1\" name=\"references\" value=\"{$references}\" size=\"60\"/></td></tr>" . "</table>";
     $result .= '<h2>Coverage</h2><table>' . "<tr><td align=right>Surnames covered:<br/><i>one per line</i></td><td align=left><textarea tabindex=\"1\" name=\"surnames\" rows=\"3\" cols=\"60\">{$surnames}</textarea></td></tr>" . "<tr><td align=right>Places covered:<br/><i>one per line</i></td><td align=left><textarea class=\"place_input\" tabindex=\"1\" name=\"places\" rows=\"3\" cols=\"60\">{$places}</textarea></td></tr>" . "<tr><td align=right>Year range:</td><td align=left><input tabindex=\"1\" name=\"fromYear\" value=\"{$fromYear}\" size=\"5\"{$fromYearStyle}/>" . "&nbsp;&nbsp;-&nbsp;<input tabindex=\"1\" name=\"toYear\" value=\"{$toYear}\" size=\"5\"{$toYearStyle}/></td></tr>" . "<tr><td align=right>Subject:</td><td align=left>" . StructuredData::addSelectToHtml(1, 'subject', self::$SOURCE_SUBJECT_OPTIONS, $subjects, 'multiple="multiple"') . "</td></tr>" . "<tr id=\"ethnicity_row\"><td align=right>Ethnicity/Culture:</td><td align=left>" . StructuredData::addSelectToHtml(1, 'ethnicity', self::$ETHNICITY_OPTIONS, $ethnicity) . "</td></tr>" . "<tr id=\"religion_row\"><td align=right>Religion:</td><td align=left>" . StructuredData::addSelectToHtml(1, 'religion', self::$RELIGION_OPTIONS, $religion) . "</td></tr>" . "<tr id=\"occupation_row\"><td align=right>Occupation:</td><td align=left>" . StructuredData::addSelectToHtml(1, 'occupation', self::$OCCUPATION_OPTIONS, $occupation) . "</td></tr>" . "</table>";
     $rows = '';
     $i = 0;
     if (isset($this->xml)) {
         foreach ($this->xml->repository as $repository) {
             $rows .= $this->addRepositoryInput($i, htmlspecialchars((string) $repository['title']), htmlspecialchars((string) $repository['source_location']), htmlspecialchars((string) $repository['availability']), (string) $repository['availability'] ? '' : $invalidStyle);
             $i++;
         }
         if ($url) {
             $rows .= $this->addRepositoryInput($i, '', $url, '', $invalidStyle);
             $i++;
         }
         if ($callNumber || $repoName) {
             $rows .= $this->addRepositoryInput($i, $repoName, $callNumber, '', $invalidStyle);
             $i++;
         }
     }
     if ($i == 0) {
         $rows .= $this->addRepositoryInput($i, '', '', '', '');
         $i++;
     }
     $result .= '<h2>Repositories</h2>';
     $result .= '<table id="repository_table" border="0" width="500px" style="display:block">';
     $result .= '<tr><th></th><th>Repository name</th><th>Location (call#, URL) of source within repository</th><th>Availability</th></tr>';
     $result .= "{$rows}</table><a href=\"javascript:void(0)\" onClick=\"addRepository('" . implode(',', self::$SOURCE_AVAILABILITY_OPTIONS) . "'); return preventDefaultAction(event);\">Add Repository</a>";
     $result .= $tm->getTipTexts();
     $result .= "<br><br>Text:<br>";
     return $result;
 }