1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
|
<?php
/**
* Add Remote Link Page
*
* Allow a user the ability to add links to people from other servers and other gedcoms.
*
* webtrees: Web based Family History software
* Copyright (C) 2010 webtrees development team.
*
* Derived from PhpGedView
* Copyright (C) 2002 to 2009 PGV Development Team. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* @package webtrees
* @subpackage Charts
* @version $Id$
*/
define('WT_SCRIPT_NAME', 'addremotelink.php');
require './includes/session.php';
require WT_ROOT.'includes/controllers/remotelink_ctrl.php';
$controller=new RemoteLinkController();
$controller->init();
print_simple_header(i18n::translate('Add Remote Link'));
$pid=safe_REQUEST($_REQUEST, 'pid', WT_REGEX_XREF);
$action=safe_POST('action', array('addlink'));
//-- only allow gedcom admins to create remote links
if (!$controller->canAccess()) {
echo '<span class="error">', i18n::translate('<b>Access Denied</b><br />You do not have access to this resource.'), '<br />';
if (!WT_USER_GEDCOM_ADMIN) {
echo i18n::translate('This user name cannot edit this GEDCOM.');
} else if (!$ALLOW_EDIT_GEDCOM) {
echo i18n::translate('Editing this GEDCOM has been disabled by the administrator.');
} else {
echo i18n::translate('Privacy settings prevent you from editing this record.');
if ($pid) {
echo '<br />', i18n::translate('You have no access to'), ' ', $pid;
}
}
echo '</span><br /><br /><div class="center"><a href="javascript://', i18n::translate('Close Window'), '" onclick="window.close();">', i18n::translate('Close Window'), '</a></div>';
print_simple_footer();
exit;
}
$success=$controller->runAction($action);
echo WT_JS_START;
?>
function sameServer() {
alert('<?php echo i18n::translate('You have selected the same site.'); ?>');
}
function remoteServer() {
alert('<?php echo i18n::translate('You have selected a remote site.'); ?>');
}
function swapComponents(btnPressed) {
var labelSite = document.getElementById('labelSite');
var existingContent = document.getElementById('existingContent');
var localContent = document.getElementById('localContent');
var remoteContent = document.getElementById('remoteContent');
if (btnPressed=="remote") {
labelSite.innerHTML = '<?php echo i18n::translate('Site'); ?>';
existingContent.style.display='none';
localContent.style.display='none';
remoteContent.style.display='block';
} else if (btnPressed=="local") {
labelSite.innerHTML = '<?php echo i18n::translate('Database ID'); ?>';
existingContent.style.display='none';
localContent.style.display='block';
remoteContent.style.display='none';
} else {
labelSite.innerHTML = '<?php echo i18n::translate('Site'); ?>';
existingContent.style.display='block';
localContent.style.display='none';
remoteContent.style.display='none';
}
}
function edit_close() {
if (window.opener.showchanges) window.opener.showchanges();
window.close();
}
function checkform(frm) {
if (frm.txtPID.value=='') {
alert('Please enter all fields.');
return false;
}
return true;
}
<?php
echo WT_JS_END;
if (!$success) {
?>
<form method="post" name="addRemoteRelationship" action="addremotelink.php" onsubmit="return checkform(this);">
<input type="hidden" name="action" value="addlink" />
<input type="hidden" name="pid" value="<?php echo $pid; ?>" />
<span class="title">
<?php echo PrintReady($controller->person->getFullName()), ' ', PrintReady("(".$controller->person->getXref().")"); ?>
</span><br /><br />
<table class="facts_table">
<tr>
<td class="title" colspan="2">
<?php echo i18n::translate('Add Remote Link'), help_link('link_remote'); ?>
</td>
</tr>
<tr>
<td class="descriptionbox wrap width20">
<?php echo i18n::translate('Relationship to current person'), help_link('link_remote_rel'); ?>
</td>
<td class="optionbox">
<select id="cbRelationship" name="cbRelationship">
<?php
foreach (array(
'current_person'=>i18n::translate('Same as current'),
'mother' =>i18n::translate('Mother'),
'father' =>i18n::translate('Father'),
'husband' =>i18n::translate('Husband'),
'wife' =>i18n::translate('Wife'),
'son' =>i18n::translate('Son'),
'daughter' =>i18n::translate('Daughter')
) as $rel=>$display) {
echo '<option value="', $rel, '"';
if ($rel==$controller->form_cbRelationship) {
echo ' checked="checked"';
}
echo '>', $display, '</option>';
}
?>
</select>
</td>
</tr>
<?php if ($controller->server_list || $controller->gedcom_list) { ?>
<tr>
<td class="descriptionbox wrap width20">
<?php echo i18n::translate('Site location'), help_link('link_remote_location'); ?>
</td>
<td class="optionbox">
<?php
echo '<input type="radio" id="local" name="location" value="local" onclick="swapComponents(\'local\')"';
if (!$controller->gedcom_list) {
echo ' disabled';
}
if ($controller->form_location=='local') {
echo ' checked="checked"';
}
echo '/>', i18n::translate('Local site'), '  ';
echo '<input type="radio" id="existing" name="location" value="existing" onclick="swapComponents(\'existing\');"';
if (!$controller->server_list) {
echo ' disabled';
}
if ($controller->form_location=='existing') {
echo ' checked="checked"';
}
echo '/>', i18n::translate('Existing remote site'), ' ';
echo '<input type="radio" id="remote" name="location" value="remote" onclick="swapComponents(\'remote\');"';
if ($controller->form_location=='remote') {
echo ' checked="checked"';
}
echo '/>', i18n::translate('New remote site');
?>
</td>
</tr>
<?php } ?>
<tr>
<td class="descriptionbox wrap width20">
<?php echo i18n::translate('Person ID'), help_link('link_person_id'); ?>
</td>
<td class="optionbox">
<input type="text" id="txtPID" name="txtPID" size="14" value="<?php echo $controller->form_txtPID; ?>" />
</td>
</tr>
<tr>
<td class="descriptionbox wrap width20">
<span id="labelSite"><?php echo i18n::translate('Site'); ?></span><?php echo help_link('link_remote_site'); ?>
</td>
<td class="optionbox" id="tdUrlText">
<div id="existingContent">
<?php echo i18n::translate('Existing remote site'); ?><br />
<select id="cbExistingServers" name="cbExistingServers" style="width: 400px;">
<?php
foreach ($controller->server_list as $key=>$server) {
echo '<option value="', $key, '"';
if ($key==$controller->form_cbExistingServers) {
echo ' selected="selected"';
}
echo '/>', PrintReady($server['name']), '</option>';
}
?>
</select><br /><br />
</div>
<div id="remoteContent">
<?php echo i18n::translate('Type in a new site.'); ?>
<table>
<tr>
<td ><?php echo i18n::translate('Title:'); ?></td>
<td><input type="text" id="txtTitle" name="txtTitle" size="66" value="<?php echo $controller->form_txtTitle; ?>" /></td>
</tr><tr>
<td valign="top"><?php echo i18n::translate('Site URL:'); ?></td>
<td><input type="text" id="txtURL" name="txtURL" size="66" value="<?php echo $controller->form_txtURL; ?>" />
</tr><tr>
<td> <?php echo i18n::translate('Example:'); ?></td>
<td>http://www.remotesite.com/phpGedView/genservice.php?wsdl</td>
</tr><tr>
<td><?php echo i18n::translate('Database ID:'); ?></td>
<td><input type="text" id="txtGID" name="txtGID" value="<?php echo $controller->form_txtGID; ?>" /></td>
</tr><tr>
<td><?php echo i18n::translate('Username: '); ?></td>
<td><input type="text" id="txtUsername" name="txtUsername" value="<?php echo $controller->form_txtUsername; ?>" /></td>
</tr><tr>
<td><?php echo i18n::translate('Password: '); ?></td>
<td><input type="password" id="txtPassword" name="txtPassword" value="<?php echo $controller->form_txtPassword; ?>" /></td>
</tr>
</table>
</div>
<div id="localContent">
<table><tr>
<td ><?php echo i18n::translate('Title:'); ?></td>
<td><input type="text" id="txtCB_Title" name="txtCB_Title" size="66" value="<?php echo $controller->form_txtCB_Title; ?>" /></td>
</tr><tr>
<td valign="top"><?php echo i18n::translate('GEDCOM File:'); ?></td>
<td><select id="txtCB_GID" name="txtCB_GID">
<?php
foreach ($controller->gedcom_list as $ged_name) {
echo '<option value="', $ged_name, '"';
if ($ged_name==$controller->form_txtCB_GID) {
echo ' selected="selected"';
}
echo '>', $ged_name, '</option>';
}
?>
</select></td>
</tr></table>
</div>
</td>
</tr>
<?php
if (WT_USER_IS_ADMIN) {
echo "<tr><td class=\"descriptionbox ", $TEXT_DIRECTION, " wrap width25\">";
echo i18n::translate('Admin Option'), help_link('no_update_CHAN'), '</td><td class="optionbox wrap">';
if ($NO_UPDATE_CHAN) {
echo "<input type=\"checkbox\" checked=\"checked\" name=\"preserve_last_changed\" />\n";
} else {
echo "<input type=\"checkbox\" name=\"preserve_last_changed\" />\n";
}
echo i18n::translate('Do not update the CHAN (Last Change) record'), "<br />\n";
$event = new Event(get_sub_record(1, "1 CHAN", ""));
echo format_fact_date($event, false, true);
echo "</td></tr>\n";
}
?>
</table>
<br />
<input type="submit" value="<?php echo i18n::translate('Add Link'); ?>" id="btnSubmit" name="btnSubmit" />
</form>
<?php
echo WT_JS_START, 'swapComponents("', $controller->form_location, '");', WT_JS_END;
}
// autoclose window when update successful unless debug on
if ($success && !WT_DEBUG ) {
echo WT_JS_START, 'edit_close();', WT_JS_END;
} else {
echo '<div class="center"><a href="javascript://', i18n::translate('Close Window'), '" onclick="edit_close();">', i18n::translate('Close Window'), '</a></div>';
print_simple_footer();
}
?>
|