summaryrefslogtreecommitdiff
path: root/modules/GEDFact_assistant/_MEDIA/media_7_parse_addLinksTbl.php
blob: fa53c7fa149d04d3c179566d6d66fdf11f8a7547 (plain)
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
<?php
/**
 * Media Link Assistant Control module for phpGedView
 *
 * Media Link information about an individual
 *
 * webtrees: Web based Family History software
 * Copyright (C) 2010 webtrees development team.
 *
 * Derived from PhpGedView
 * Copyright (C) 2002 to 2008  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 Census Assistant
 * @version $Id$
 */
?>

<script>
function parseAddLinks() {
	str = "";
	var tbl = document.getElementById('addlinkQueue');
	for(var i=1; i<tbl.rows.length; i++){ // start at i=1 because we need to avoid header
		var tr = tbl.rows[i];
		var strRow = ''; 
		for(var j=1; j<tr.cells.length; j++){ // Start at col 1 (j=1)
			if (j>=2) {
				//	dont show 	 col 0	 index
				//  SHOW		 col 1	 id
				//	miss out	 col 2	 name
				//	miss out	 col 3	 relationship
				//	miss out	 col 4	 delete button
				continue;
			}else{
				if (IE) {
					strRow += (strRow==''?'':'') + tr.cells[j].childNodes[0].innerHTML;
				}else{
					strRow += (strRow==''?'':'') + tr.cells[j].childNodes[0].textContent;
				}
			}
		}
		str += (str==''?'':', ') + strRow;
	}
	// str += (str==''?'':'' '); // Adds just final single quote at end of string (\')
}

function parseRemLinks() {
	remstr = "";
	var tbl = document.getElementById('existLinkTbl');
	for(var i=1; i<tbl.rows.length; i++){ // start at i=1 because we need to avoid header
		var remtr = tbl.rows[i];
		var remstrRow = ''; 
		for(var j=1; j<remtr.cells.length; j++){ // Start at col 1 (j=1)
			if (j!=4 ) {
				//	dont show col	0	index
				//	miss out  col	2	name
				//	miss out  col	3	keep radio button
				//	choose    col	4	remove radio button
				continue;
			}else{
				 if (remtr.cells[j].childNodes[0].checked)  {
					remstrRow += (remstrRow==''?'':'') + remtr.cells[j].childNodes[0].name + ', ';
				 }
			}
		}
		remstr += (remstr==''?'':'') + remstrRow;
	}
	// remstr += (remstr==''?'':','); // Adds just final comma at end of string (\')
}

function preview() {
	parseAddLinks();
	alert (str);
}

function shiftlinks() {

	parseRemLinks();
	//	alert('remstring = '+ remstr);
	if (remstr) {
		document.link.exist_links.value = remstr;
	}
	
	parseAddLinks();
	//	alert('string = '+ str);
	if (str) {
		document.link.more_links.value = str;
	}else{
		// leave hidden input morelinks as "No Values"
		var inputField = document.getElementById('gid');
	//	alert(inputField.value)
		if (inputField) {
			document.link.more_links.value = inputField.value+',';
		}
	}
	if (winNav) {
		winNav.close();
	}
}


</script>