Exemple #1
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;
 }
/**
 * constructor
 */
function wfSpecialShowPedigree()
{
    global $wgOut, $wgRequest, $wgScriptPath, $wgGoogleMapKey, $wrHostName, $wrSidebarHtml;
    $wgOut->setArticleRelated(false);
    $wgOut->setRobotpolicy('noindex,nofollow');
    $titleText = $wgRequest->getVal('pagetitle');
    $error = '';
    if ($titleText) {
        $title = Title::newFromText($titleText);
        if (!$title->exists() && !StructuredData::endsWith($titleText, ')')) {
            $title = Title::newFromText($titleText . ')');
        }
        if (is_null($title) || $title->getNamespace() != NS_PERSON && $title->getNamespace() != NS_FAMILY || !$title->exists()) {
            $error = 'Please enter the title of a person or family page (include the "Person:" or "Family:")';
        } else {
            $wgOut->setPageTitle('Pedigree for ' . $title->getText());
            $wgOut->addLink(array('href' => $wgScriptPath . '/index.php?action=ajax&rs=wfGetPedigreeData&rsargs=' . $title->getPrefixedURL(), 'type' => 'application/json', 'rel' => 'exhibit/data'));
            $wgOut->addScript("<script type=\"text/javascript\" src=\"{$wgScriptPath}/exhibit/src/webapp/api/exhibit-api.2.js\"></script>");
            $wgOut->addScript("<script type=\"text/javascript\" src=\"{$wgScriptPath}/exhibit/src/webapp/extensions/time/time-extension.1.js\"></script>");
            $wgOut->addScript("<script type=\"text/javascript\" src=\"{$wgScriptPath}/exhibit/src/webapp/extensions/map/map-extension.1.js?gmapkey={$wgGoogleMapKey}\"></script>");
            $wgOut->addScript("<script type=\"text/javascript\" src=\"{$wgScriptPath}/exhibit.6.js\"></script>");
            $wrSidebarHtml = <<<END
<div id="wr-pedigreemap-sidebar">
   <div ex:role="facet" ex:facetClass="TextSearch"></div>
   <div ex:role="facet" ex:height="165px" ex:expression=".Line" ex:facetLabel="Line"></div>
   <div ex:role="facet" ex:height="150px" ex:expression=".Generation" ex:facetLabel="Generation"></div>
   <div ex:role="facet" ex:height="75px" ex:facetClass="NumericRange" ex:expression=".BirthYear" ex:interval="10" ex:facetLabel="Birth Year"></div>
   <div ex:role="facet" ex:height="75px" ex:facetClass="NumericRange" ex:expression=".DeathYear" ex:interval="10" ex:facetLabel="Death Year"></div>
</div>   
END;
            $wgOut->addHtml(<<<END
<div ex:role="viewPanel">
   <table ex:role="lens" ex:itemTypes="Person" class="exhibit-lens">
       <tr>
           <td><span ex:if-exists=".ImageURL"><img ex:src-content=".ImageURL" /></span></td>
           <td>
            <div>
               <span ex:if=".FullName <> ''">
                  <span ex:content=".FullName" class="exhibit-name"></span>
                  <span ex:content=".label" class="exhibit-name"></span>
               </span>
            </div>
            <div>
               <span ex:if=".Parents <> ''">
                  <span ex:content=".Parents">
                     <span ex:content="value" ex:formats="item { title: expression('Birth') }"></span>
                  </span>
                  <span>Birth</span>
               </span>:
               <span ex:content=".BirthDate"></span><span ex:if-exists=".BirthPlaceText">,</span>
               <span ex:if=".BirthPlace <> ''">
                  <span><a ex:href-subcontent="http://{$wrHostName}/wiki/{{.BirthPlace}}"><span ex:content=".BirthPlaceText" class="exhibit-place"></span></a></span>
                  <span ex:content=".BirthPlaceText" class="exhibit-place"></span>
               </span>
            </div>
            <span ex:content=".Spouse">
               <div>
                  <span ex:content="value" ex:formats="item { title: expression('Marriage') }"></span>:
                  <span ex:content=".MarriageDate"></span><span ex:if-exists=".MarriagePlaceText">,</span>
                  <span ex:if=".MarriagePlace <> ''">
                     <span><a ex:href-subcontent="http://{$wrHostName}/wiki/{{.MarriagePlace}}"><span ex:content=".MarriagePlaceText" class="exhibit-place"></span></a></span>
                     <span ex:content=".MarriagePlaceText" class="exhibit-place"></span>
                  </span>
               </div>
            </span>
            <div>Death:
               <span ex:content=".DeathDate"></span><span ex:if-exists=".DeathPlaceText">,</span>
               <span ex:if=".DeathPlace <> ''">
                  <span><a ex:href-subcontent="http://{$wrHostName}/wiki/{{.DeathPlace}}"><span ex:content=".DeathPlaceText" class="exhibit-place"></span></a></span>
                  <span ex:content=".DeathPlaceText" class="exhibit-place"></span>
               </span>
            </div>
            <span ex:content=".OtherEvents">
               <div>
                  <span ex:content=".EventType"></span>:
                  <span ex:content=".Date"></span><span ex:if-exists=".PlaceText">,</span>
                  <span ex:if=".Place <> ''">
                     <span><a ex:href-subcontent="http://{$wrHostName}/wiki/{{.Place}}"><span ex:content=".PlaceText" class="exhibit-place"></span></a></span>
                     <span ex:content=".PlaceText" class="exhibit-place"></span>
                  </span>
               </div>
            </span>
            <div class="exhibit-more">
               ( <a ex:href-subcontent="http://{$wrHostName}/wiki/{{.label}}">more...</a> )
            </div>
        </td>
       </tr>
   </table>
   <table ex:role="lens" ex:itemtypes="Family" class="exhibit-lens">
       <tr>
         <td><span ex:if-exists=".ImageURL"><img ex:src-content=".ImageURL" /></span></td>
         <td>
            <span ex:content=".Husband">
               <div>Husband:
                  <span ex:if=".FullName <> ''">
                     <span ex:content="value" ex:formats="item { title: expression(.FullName) }"></span>
                     <span ex:content="value"></span>
                  </span>
               </div>
            </span>
            <span ex:content=".Wife">
               <div>Wife:
                  <span ex:if=".FullName <> ''">
                     <span ex:content="value" ex:formats="item { title: expression(.FullName) }"></span>
                     <span ex:content="value"></span>
                  </span>
               </div>
            </span>
            <div>Marriage:
               <span ex:content=".MarriageDate"></span><span ex:if-exists=".MarriagePlaceText">,</span>
               <span ex:if=".MarriagePlace <> ''">
                  <span><a ex:href-subcontent="http://{$wrHostName}/wiki/{{.MarriagePlace}}"><span ex:content=".MarriagePlaceText" class="exhibit-place"></span></a></span>
                  <span ex:content=".MarriagePlaceText" class="exhibit-place"></span>
               </span>
            </div>
            <span ex:content=".OtherEvents">
               <div>
                  <span ex:content=".EventType"></span>:
                  <span ex:content=".Date"></span><span ex:if-exists=".PlaceText">,</span>
                  <span ex:if=".Place <> ''">
                     <span><a ex:href-subcontent="http://{$wrHostName}/wiki/{{.Place}}"><span ex:content=".PlaceText" class="exhibit-place"></span></a></span>
                     <span ex:content=".PlaceText" class="exhibit-place"></span>
                  </span>
               </div>
            </span>
            <span ex:if-exists=".Child">
               <div>Children:
                  <ol class="exhibit-children">
                     <span ex:content=".Child">
                        <li>
                           <span ex:if=".FullName <> ''">
                              <span ex:content="value" ex:formats="item { title: expression(.FullName) }"></span>
                              <span ex:content="value" ex:formats="item { title: expression(.label) }"></span>
                           </span>
                        </li>
                     </span>
                  </ol>
               </div>
            </span>
            <div class="exhibit-more">
               ( <a ex:href-subcontent="http://{$wrHostName}/wiki/{{.label}}">more...</a> )
            </div>
         </td>
       </tr>
   </table>
   <table ex:role="lens" ex:itemtypes="External" class="exhibit-lens">
       <tr>
           <td>
               <div>
                  <span ex:if=".FullName <> ''">
                     <span ex:content=".FullName" class="exhibit-name"></span>
                     <span ex:content=".label"></span>
                  </span>
               </div>
               <div class="exhibit-more">
                  ( <a ex:href-subcontent="http://{$wrHostName}/wiki/{{.label}}">more...</a> )
               </div>
           </td>
       </tr>
   </table>
   <div ex:role="view"
      ex:viewClass="Template"
      ex:label="Pedigree"
      ex:title="View pedigree"
      ex:template="exhibitPersonPedigreeTemplate"
      ex:lenses="exhibitLenses"
      ex:slotIDPrefix="exhibit-pedigree-"
      ex:slotKey="Position"
      ex:slotClass="exhibit-pedigree-box"
     ex:showSummary="false"
      ex:showToolbox="false">
 </div>
 <div ex:role="view"
     ex:viewClass="Map"
     ex:label="Birth Places"
    ex:title="View birth places on a map"
     ex:latlng=".addressLatLng"
     ex:maxAutoZoom='9'
     ex:mapHeight='435'
     ex:proxy=".BirthPlace"
     ex:icon=".IconURL"
     ex:colorKey=".Surname"
     ex:colorMarkerGenerator="wrExhibitColorMarkerGenerator"
     ex:makeIcon="wrExhibitMakeIcon"
     ex:showSummary="false"
      ex:showToolbox="false">
 </div>
 <div ex:role="view"
     ex:viewClass="Map"
     ex:label="Death Places"
    ex:title="View death places on a map"
     ex:latlng=".addressLatLng"
     ex:maxAutoZoom='9'
     ex:mapHeight='435'
     ex:proxy=".DeathPlace"
     ex:icon=".IconURL"
     ex:colorKey=".Surname"
     ex:colorMarkerGenerator="wrExhibitColorMarkerGenerator"
     ex:makeIcon="wrExhibitMakeIcon"
     ex:showSummary="false"
      ex:showToolbox="false">
 </div>
 <div ex:role="view"
     ex:viewClass="Map"
     ex:label="All Places"
     ex:title="View all event places on a map"
     ex:latlng=".addressLatLng"
     ex:maxAutoZoom='9'
     ex:mapHeight='435'
     ex:proxy=".AllPlaces"
     ex:icon=".IconURL"
     ex:colorKey=".Surname"
     ex:addOverlaysCallback="wrExhibitMapAddOverlays"
     ex:colorMarkerGenerator="wrExhibitColorMarkerGenerator"
     ex:makeIcon="wrExhibitMakeIcon"
     ex:showSummary="false"
     ex:showToolbox="false">
 </div>
 <div ex:role="view"
       ex:viewClass="Timeline"
       ex:label="Timeline"
       ex:title="View people as timeline"
       ex:timelineHeight='435'
       ex:topBandHeight='86'
       ex:bottomBandHeight='14'
       ex:start=".BirthYear"
       ex:end=".DeathYear"
       ex:eventLabel=".FullName"
       ex:topBandUnit="decade"
       ex:topBandPixelsPerUnit="55"
       ex:bottomBandUnit="century"
       ex:bottomBandPixelsPerUnit="135"
       ex:colorKey=".Surname"
     ex:showSummary="false"
      ex:showToolbox="false">
 </div>
 <div ex:role="view"
       ex:viewClass="Thumbnail"
       ex:label="Thumbnails"
       ex:title="View people as thumbnails"
     ex:orders=".Surname"
     ex:possibleOrders=".Surname, .Givenname, .Generation, .BirthYear, .DeathYear"
     ex:grouped="true"
        ex:showSummary="false"
      ex:showToolbox="false">
      <table ex:role="lens" class="exhibit-thumbnail" style="display:none;"><tr><td>
         <div class="center"><span ex:if-exists=".ImageURL"><img ex:src-content=".ImageURL"/></span></div>
         <div><span ex:content="value" ex:formats="item { title: expression(.FullName) }"></span></div>
         <div>b. <span ex:content=".BirthDate"></span></div>
         <div>d. <span ex:content=".DeathDate"></span></div>
      </td></tr></table>
   </div>
    <div ex:role="view"
         ex:viewClass="Tile"
         ex:label="Details"
         ex:title="View details"
        ex:orders=".Surname, .Givenname"
        ex:possibleOrders=".Surname, .Givenname, .Generation, .BirthYear, .DeathYear"
        ex:grouped="false"
        ex:showSummary="false"
         ex:showToolbox="false">
    </div>
 </div>
<div ex:role="collection" ex:itemTypes="Person" style="display:none"></div>
END
);
            return;
        }
    }
    $wgOut->setPageTitle('Show Pedigree');
    if ($error) {
        $wgOut->addHTML("<p><font color=red>{$error}</font></p>");
    }
    $queryBoxStyle = 'width:100%;text-align:center;';
    $form = <<<END
<form name="search" action="/wiki/Special:ShowPedigree" method="get">
<div id="searchFormDiv" style="{$queryBoxStyle}">
Person or Family page title: <input type="text" name="pagetitle" size="24" maxlength="100" value="{$titleText}" onfocus="select()" />
<input type="submit" value="Go" />
</div>
</form>
END;
    $wgOut->addHTML($form);
}
Exemple #3
0
 public static function isGedcomTitle($titleString)
 {
     return StructuredData::endsWith($titleString, " gedcom)");
 }
Exemple #4
0
 private function getEditText(&$request, &$text)
 {
     // If there is a redirect, don't add anything, even the surrounding tag.
     // This makes #redirect directives still work, since redirect pages don't have any data in the edit fields,
     // so the #redirect directive remains the first (and only) thing on the page
     if (!StructuredData::isRedirect($text)) {
         if ($this->footer && mb_strpos($text, $this->footer) === false) {
             $ftr = ($text && !StructuredData::endsWith($text, "\n") ? "\n" : '') . $this->footer;
         } else {
             $ftr = '';
         }
         $xmlElementsString = $this->fromEditFields($request);
         return "<{$this->tagName}>\n{$xmlElementsString}</{$this->tagName}>\n{$text}{$ftr}";
     } else {
         return $text;
     }
 }
    /**
     * Return HTML for displaying search results
     * @return string HTML
     */
    public function getReviewResults()
    {
        $data = array();
        $roles = array();
        $this->getCompareData($data, $roles);
        $cols = count($data[0]);
        $tblCols = $cols + 1;
        $childNum = 0;
        $output = <<<END
<form name="unmerge" action="/wiki/Special:ReviewMerge/{$this->mergeId}" method="get">
<input type="hidden" name="action" value="unmerge"/>
<table border="0" cellspacing="0" cellpadding="4">
END;
        for ($i = 0; $i < count($data); $i++) {
            $output .= CompareForm::insertEmptyRow($tblCols);
            if ($roles[0] == 'Person') {
                $labels = self::$PERSON_COMPARE_LABELS;
            } else {
                if ($i == 0) {
                    $labels = self::$FAMILY_COMPARE_LABELS;
                } else {
                    $labels = self::$FAMILY_MEMBER_COMPARE_LABELS;
                }
            }
            foreach ($labels as $label) {
                $found = !in_array($label, self::$OPTIONAL_LABELS);
                if (!$found) {
                    for ($j = 0; $j < $cols; $j++) {
                        if (is_array(@$data[$i][$j][$label]) && count($data[$i][$j][$label]) > 0) {
                            $found = true;
                            break;
                        }
                    }
                }
                if ($found) {
                    $baseStdValues =& CompareForm::standardizeValues($label, @$data[$i][1][$label]);
                    if ($label == 'Title') {
                        $role = $roles[$i];
                        if ($role == 'child') {
                            $roleLabel = $role . $label;
                            $childNum++;
                        } else {
                            if ($role == 'Person' || $role == 'Family') {
                                $roleLabel = $label;
                            } else {
                                $roleLabel = $role . $label;
                            }
                        }
                    } else {
                        $roleLabel = $label;
                    }
                    if ($label == 'familyTitle') {
                        $revidLabel = 'Revid';
                    } else {
                        if (strpos($label, 'Title') !== false) {
                            $revidLabel = str_replace('Title', 'Revid', $label);
                        } else {
                            $revidLabel = '';
                        }
                    }
                    $labelClass = CompareForm::getLabelClass($roleLabel);
                    $output .= "<tr><td class=\"{$labelClass}\">" . CompareForm::formatLabel($roleLabel, $childNum) . "</td>";
                    for ($j = $cols - 1; $j >= 0; $j--) {
                        if ($j == 1) {
                            $stdValues = $baseStdValues;
                        } else {
                            $stdValues =& CompareForm::standardizeValues($label, @$data[$i][$j][$label]);
                        }
                        list($score, $class) = CompareForm::getCompareScoreClass($j == 0 || $j == 1, $label, $baseStdValues, $stdValues);
                        $output .= "<td class=\"{$class}\">";
                        $valueFound = false;
                        if (is_array(@$data[$i][$j][$label])) {
                            for ($v = 0; $v < count($data[$i][$j][$label]); $v++) {
                                $value = $data[$i][$j][$label][$v];
                                if (strpos($label, 'Title') !== false) {
                                    if (($label == 'familyTitle' || $label == 'Title') && @$data[$i][$j]['mergeresult']) {
                                        $formattedValue = 'Merge<br>result';
                                    } else {
                                        if (GedcomUtil::getGedcomMergeLogKey(@$data[$i][$j]['Revid'][$v])) {
                                            $formattedValue = '<b>GEDCOM page</b>';
                                        } else {
                                            $formattedValue = CompareForm::formatValue($label, $value, StructuredData::endsWith($label, 'FamilyTitle') ? '' : 'oldid=' . $data[$i][$j][$revidLabel][$v]);
                                        }
                                    }
                                } else {
                                    $formattedValue = CompareForm::formatValue($label, $value);
                                }
                                if ($v) {
                                    $output .= '<hr>';
                                }
                                $output .= $formattedValue;
                                $valueFound = true;
                            }
                        }
                        if (!$valueFound) {
                            $output .= '&nbsp;';
                        }
                        if ($class == CompareForm::$COMPARE_PAGE_CLASS) {
                            $titlesCnt = count(@$data[$i][$j][$label]);
                            if ($titlesCnt > 0) {
                                if (!$data[$i][$j]['Exists']) {
                                    // person/family not found
                                    $output .= '<br>Not found';
                                } else {
                                    if ($data[$i][$j]['Redirect']) {
                                        // person/family has been merged
                                        $output .= '<br>Already merged';
                                    } else {
                                        if ($data[$i][$j]['mergeTarget']) {
                                            $output .= '<br>' . ($data[$i][$j][$label][0] == $data[$i][$j]['mergeTarget'] ? 'Same as ' : 'Merged with ') . htmlspecialchars($data[$i][$j]['mergeTarget']);
                                        } else {
                                            if ($j == 1 && @$data[$i][0]['mergeresult']) {
                                                $output .= '<br>(merge target)';
                                            }
                                        }
                                    }
                                }
                            } else {
                                if (@$data[$i][$j]['deleted']) {
                                    $output .= 'Page has been deleted';
                                }
                            }
                        }
                        $output .= '</td>';
                    }
                    $output .= '</tr>';
                }
            }
        }
        if ($this->unmergeTimestamp) {
            $unmergeButton = 'Merge has been undone';
        } else {
            $unmergeButton = 'Unmerge reason: <input type="text" name="comment" size=36/><br><input type="submit" value="Unmerge"/>';
        }
        $output .= <<<END
<tr><td align=right colspan="{$tblCols}">{$unmergeButton}</td></tr>
</table>
</form>
END;
        return $output;
    }
Exemple #6
0
 private static function getPlaceLevel($titleString)
 {
     if (StructuredData::endsWith($titleString, ", United States") || StructuredData::endsWith($titleString, ", Preußen, Germany") || StructuredData::endsWith($titleString, ", Greece") || StructuredData::endsWith($titleString, ", Italy") || StructuredData::endsWith($titleString, ", Spain") || StructuredData::endsWith($titleString, ", Philippines") || StructuredData::endsWith($titleString, ", Scotland")) {
         return 3;
     } else {
         if (StructuredData::endsWith($titleString, ", Anguilla") || StructuredData::endsWith($titleString, ", American Samoa") || StructuredData::endsWith($titleString, ", Antigua and Barbuda") || StructuredData::endsWith($titleString, ", Aruba") || StructuredData::endsWith($titleString, ", Bahrain") || StructuredData::endsWith($titleString, ", Bermuda") || StructuredData::endsWith($titleString, ", Bhutan") || StructuredData::endsWith($titleString, ", British Virgin Islands") || StructuredData::endsWith($titleString, ", Cayman Islands") || StructuredData::endsWith($titleString, ", Croatia") || StructuredData::endsWith($titleString, ", Estonia") || StructuredData::endsWith($titleString, ", Falkland Islands") || StructuredData::endsWith($titleString, ", French Polynesia") || StructuredData::endsWith($titleString, ", Gibraltar") || StructuredData::endsWith($titleString, ", Guam") || StructuredData::endsWith($titleString, ", Guernsey") || StructuredData::endsWith($titleString, ", Haiti") || StructuredData::endsWith($titleString, ", Isle of Man") || StructuredData::endsWith($titleString, ", Jersey") || StructuredData::endsWith($titleString, ", Kiribati") || StructuredData::endsWith($titleString, ", Latvia") || StructuredData::endsWith($titleString, ", Lithuania") || StructuredData::endsWith($titleString, ", Moldova") || StructuredData::endsWith($titleString, ", Maldives") || StructuredData::endsWith($titleString, ", Malta") || StructuredData::endsWith($titleString, ", Marshall Islands") || StructuredData::endsWith($titleString, ", Mauritius") || StructuredData::endsWith($titleString, ", Mayotte") || StructuredData::endsWith($titleString, ", Monaco") || StructuredData::endsWith($titleString, ", Nauru") || StructuredData::endsWith($titleString, ", Netherlands Antilles") || StructuredData::endsWith($titleString, ", New Caledonia") || StructuredData::endsWith($titleString, ", Niue") || StructuredData::endsWith($titleString, ", Norfolk Island") || StructuredData::endsWith($titleString, ", Northern Cyprus") || StructuredData::endsWith($titleString, ", Northern Mariana Islands") || StructuredData::endsWith($titleString, ", Palau") || StructuredData::endsWith($titleString, ", Palestinian Territories") || StructuredData::endsWith($titleString, ", Pitcairn Islands") || StructuredData::endsWith($titleString, ", Réunion") || StructuredData::endsWith($titleString, ", Saint Helena") || StructuredData::endsWith($titleString, ", Saint Kitts and Nevis") || StructuredData::endsWith($titleString, ", Saint Lucia") || StructuredData::endsWith($titleString, ", Saint Pierre et Miquelon") || StructuredData::endsWith($titleString, ", Samoa") || StructuredData::endsWith($titleString, ", San Marino") || StructuredData::endsWith($titleString, ", Seychelles") || StructuredData::endsWith($titleString, ", Singapore") || StructuredData::endsWith($titleString, ", Slovenia") || StructuredData::endsWith($titleString, ", São Tomé and Príncipe") || StructuredData::endsWith($titleString, ", Tokelau") || StructuredData::endsWith($titleString, ", Trinidad and Tobago") || StructuredData::endsWith($titleString, ", Turks and Caicos Islands") || StructuredData::endsWith($titleString, ", Tuvalu") || StructuredData::endsWith($titleString, ", Uganda") || StructuredData::endsWith($titleString, ", United States Virgin Islands") || StructuredData::endsWith($titleString, ", Wallis and Futuna") || StructuredData::endsWith($titleString, ", Yemen")) {
             return 1;
         } else {
             return 2;
         }
     }
 }