| [ PHPXref.com ] | [ Generated: Sun Jul 20 19:39:24 2008 ] | [ PhpGedView 4.0 ] |
| [ Index ] [ Variables ] [ Functions ] [ Classes ] [ Constants ] [ Statistics ] | ||
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * Displays the details about a repository record. 4 * Also shows how many sources reference this repository. 5 * 6 * phpGedView: Genealogy Viewer 7 * Copyright (C) 2002 to 2005 John Finlay and Others 8 * 9 * This program is free software; you can redistribute it and/or modify 10 * it under the terms of the GNU General Public License as published by 11 * the Free Software Foundation; either version 2 of the License, or 12 * (at your option) any later version. 13 * 14 * This program is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 * GNU General Public License for more details. 18 * 19 * You should have received a copy of the GNU General Public License 20 * along with this program; if not, write to the Free Software 21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 * 23 * @package PhpGedView 24 * @subpackage Lists 25 * @version $Id: repo.php,v 1.1.2.27 2006/05/15 10:26:15 canajun2eh Exp $ 26 */ 27 28 require ("config.php"); 29 require_once 'includes/functions_print_facts.php'; 30 require_once ("includes/functions_print_lists.php"); 31 require($factsfile["english"]); 32 if (file_exists( $factsfile[$LANGUAGE])) require $factsfile[$LANGUAGE]; 33 34 if ($SHOW_SOURCES<getUserAccessLevel(getUserName())) { 35 header("Location: index.php"); 36 exit; 37 } 38 39 if (empty($action)) $action=""; 40 if (empty($show_changes)) $show_changes = "yes"; 41 if (empty($rid)) $rid = " "; 42 $rid = clean_input($rid); 43 44 global $PGV_IMAGES; 45 46 $accept_success=false; 47 if (userCanAccept(getUserName())) { 48 if ($action=="accept") { 49 require_once ("includes/functions_import.php"); 50 if (accept_changes($rid."_".$GEDCOM)) { 51 $show_changes="no"; 52 $accept_success=true; 53 } 54 } 55 } 56 57 $nonfacts = array(); 58 59 $repo = find_repo_record($rid); 60 //-- make sure we have the true id from the record 61 $ct = preg_match("/0 @(.*)@/", $repo, $match); 62 if ($ct>0) $rid = trim($match[1]); 63 64 $name = get_repo_descriptor($rid); 65 $add_descriptor = get_add_repo_descriptor($rid); 66 if ($add_descriptor) $name .= " - ".$add_descriptor; 67 68 69 print_header("$name - $rid - ".$pgv_lang["repo_info"]); 70 71 ?> 72 <script language="JavaScript" type="text/javascript"> 73 <!-- 74 function show_gedcom_record() { 75 var recwin = window.open("gedrecord.php?pid=<?php print $rid ?>", "_blank", "top=50,left=50,width=600,height=400,scrollbars=1,scrollable=1,resizable=1"); 76 } 77 function showchanges() { 78 window.location = '<?php print $SCRIPT_NAME."?".$QUERY_STRING."&show_changes=yes"; ?>'; 79 } 80 //--> 81 </script> 82 <table width="100%"><tr><td> 83 <?php 84 if ($accept_success) print "<b>".$pgv_lang["accept_successful"]."</b><br />"; 85 print "\n\t<span class=\"name_head\">".PrintReady($name); 86 87 if ($SHOW_ID_NUMBERS) print " ‎($rid)‎"; 88 print "</span><br />"; 89 if (userCanEdit(getUserName())) { 90 if ($view!="preview") { 91 if (isset($pgv_changes[$rid."_".$GEDCOM])) { 92 if (!isset($show_changes)) { 93 print "<a href=\"repo.php?rid=$rid&show_changes=yes\">".$pgv_lang["show_changes"]."</a>"." "; 94 } 95 else { 96 if (userCanAccept(getUserName())) print "<a href=\"repo.php?rid=$rid&action=accept\">".$pgv_lang["accept_all"]."</a> | "; 97 print "<a href=\"repo.php?rid=$rid\">".$pgv_lang["hide_changes"]."</a>"." "; 98 } 99 print_help_link("show_changes_help", "qm"); 100 print "<br />"; 101 } 102 print "<a href=\"javascript:;\" onclick=\"return edit_raw('$rid');\">".$pgv_lang["edit_raw"]."</a>"; 103 print_help_link("edit_raw_gedcom_help", "qm"); 104 print " | "; 105 print "<a href=\"javascript:;\" onclick=\"return deleterepository('$rid');\">".$pgv_lang["delete_repo"]."</a>"; 106 print_help_link("delete_repo_help", "qm"); 107 print "<br />\n"; 108 } 109 if (isset($show_changes)) { 110 $newrepo = trim(find_record_in_file($rid)); 111 } 112 } 113 print "<br />"; 114 115 $repo = array(); 116 if (isset($repo_id_list[$rid])) $repo = $repo_id_list[$rid]; 117 else { 118 print " <span class=\"warning\"><i>".$pgv_lang["no_results"]."</i></span>"; 119 print "<br /><br /><br /><br /><br /><br />\n"; 120 print_footer(); 121 exit; 122 } 123 $repofacts = array(); 124 $gedlines = preg_split("/\n/", $repo["gedcom"]); 125 $lct = count($gedlines); 126 $factrec = ""; // -- complete fact record 127 $line = ""; // -- temporary line buffer 128 $linenum = 1; 129 for($i=1; $i<=$lct; $i++) { 130 if ($i<$lct) $line = $gedlines[$i]; 131 else $line=" "; 132 if (empty($line)) $line=" "; 133 if (($i==$lct)||($line{0}==1)) { 134 if (!empty($factrec) ) { 135 $repofacts[] = array($factrec, $linenum); 136 } 137 $factrec = $line; 138 $linenum = $i; 139 } 140 else $factrec .= "\n".$line; 141 } 142 143 //-- get new repo records 144 if (!empty($newrepo)) { 145 $newrepofacts = array(); 146 $gedlines = preg_split("/\n/", $newrepo); 147 $lct = count($gedlines); 148 $factrec = ""; // -- complete fact record 149 $line = ""; // -- temporary line buffer 150 $linenum = 0; 151 for($i=1; $i<=$lct; $i++) { 152 if ($i<$lct) $line = $gedlines[$i]; 153 else $line=" "; 154 if (empty($line)) $line=" "; 155 if (($i==$lct)||($line{0}==1)) { 156 $newrepofacts[] = array($factrec, $linenum); 157 $factrec = $line; 158 $linenum = $i; 159 } 160 else $factrec .= "\n".$line; 161 } 162 163 if (!empty($show_changes)) { 164 //-- update old facts 165 foreach($repofacts as $key=>$fact) { 166 $found = false; 167 foreach($newrepofacts as $indexval => $newfact) { 168 if (trim($newfact[0])==trim($fact[0])) { 169 $found = true; 170 break; 171 } 172 } 173 if (!$found) { 174 $repofacts[$key][0].="\nPGV_OLD\n"; 175 } 176 } 177 //-- look for new facts 178 foreach($newrepofacts as $key=>$newfact) { 179 $found = false; 180 foreach($repofacts as $indexval => $fact) { 181 if (trim($newfact[0])==trim($fact[0])) { 182 $found = true; 183 break; 184 } 185 } 186 if (!$found) { 187 $newfact[0].="\nPGV_NEW\n"; 188 $repofacts[]=$newfact; 189 } 190 } 191 } 192 } 193 print "\n<table class=\"facts_table\">"; 194 foreach($repofacts as $indexval => $fact) { 195 $factrec = $fact[0]; 196 $linenum = $fact[1]; 197 // $ft = preg_match("/1\s(_?\w+)\s(.*)/", $factrec, $match); 198 $ft = preg_match("/1\s(\w+)\s(.*)/", $factrec, $match); 199 if ($ft>0) $fact = $match[1]; 200 else $fact=""; 201 $fact = trim($fact); 202 if (!empty($fact)) { 203 if (showFact($fact, $rid)) { 204 if ($fact=="OBJE") { 205 print_main_media($rid); 206 } 207 else if ($fact=="NOTE") { 208 print_main_notes($factrec, 1, $rid, $linenum); 209 } 210 else { 211 print_fact($factrec, $rid, $linenum); 212 } 213 } 214 } 215 } 216 //-- new fact link 217 if (($view!="preview") &&(userCanEdit(getUserName()))) { 218 print_add_new_fact($rid, $repofacts, "REPO"); 219 } 220 print "</table>\n\n"; 221 print "\n\t\t<br /><br /><span class=\"label\">".$pgv_lang["other_repo_records"]."</span>"; 222 flush(); 223 224 $query = "REPO @$rid@"; 225 // -- array of sources 226 $mysourcelist = array(); 227 228 $mysourcelist = search_sources($query); 229 uasort($mysourcelist, "itemsort"); 230 $cs=count($mysourcelist); 231 232 if ($cs>0) { 233 print_help_link("repos_listbox_help", "qm"); 234 print "\n\t<table class=\"list_table $TEXT_DIRECTION\">\n\t\t<tr><td class=\"list_label\""; 235 if($cs>12) print " colspan=\"2\""; 236 print "><img src=\"".$PGV_IMAGE_DIR."/".$PGV_IMAGES["source"]["small"]."\" border=\"0\" title=\"".$pgv_lang["titles_found"]."\" alt=\"".$pgv_lang["titles_found"]."\" /> "; 237 print $pgv_lang["titles_found"]; 238 print "</td></tr><tr><td class=\"$TEXT_DIRECTION list_value_wrap\"><ul>"; 239 if (count($mysourcelist)>0) { 240 $i=1; 241 // -- print the array 242 foreach ($mysourcelist as $key => $value) { 243 print_list_source($key, $value); 244 if ($i==ceil($cs/2) && $cs>12) print "</ul></td><td class=\"list_value_wrap\"><ul>\n"; 245 $i++; 246 } 247 } 248 249 print "\n\t\t</ul></td>\n\t\t"; 250 251 print "</tr><tr>"; 252 print "</tr>\n\t</table>"; 253 } 254 else print " <span class=\"warning\"><i>".$pgv_lang["no_results"]."</span>"; 255 256 print "<br /><br /></td><td valign=\"top\">"; 257 258 if ($view!="preview") { 259 print "\n\t<table cellspacing=\"10\" align=\"right\"><tr>"; 260 if ($SHOW_GEDCOM_RECORD) { 261 print "\n\t\t<td align=\"center\" valign=\"top\"><span class=\"link\"><a href=\"javascript:show_gedcom_record();\"><img class=\"icon\" src=\"".$PGV_IMAGE_DIR."/".$PGV_IMAGES["gedcom"]["small"]."\" border=\"0\" alt=\"\" /><br />".$pgv_lang["view_gedcom"]."</a>"; 262 print_help_link("show_repo_gedcom_help", "qm"); 263 print "</span></td>"; 264 } 265 if($SHOW_GEDCOM_RECORD && ($ENABLE_CLIPPINGS_CART>=getUserAccessLevel())){ 266 print "</tr>\n\t\t<tr>"; 267 } 268 if ($ENABLE_CLIPPINGS_CART>=getUserAccessLevel()) { 269 print "<td align=\"center\" valign=\"top\"><span class=\"link\"><a href=\"clippings.php?action=add&id=$rid&type=repository\"><img class=\"icon\" src=\"".$PGV_IMAGE_DIR."/".$PGV_IMAGES["clippings"]["small"]."\" border=\"0\" alt=\"\" /><br />".$pgv_lang["add_to_cart"]."</a>"; 270 print_help_link("add_repository_clip_help", "qm"); 271 print "</span></td>"; 272 } 273 if(!$SHOW_GEDCOM_RECORD && ($ENABLE_CLIPPINGS_CART<getUserAccessLevel())){ 274 print "<td> </td>"; 275 } 276 print "</tr></table>"; 277 } 278 print " </td></tr></table>\n"; 279 print_footer(); 280 281 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| [ Powered by PHPXref - Served by Debian GNU/Linux ] |