Line # Revision Author
1 3 ahitrov@rambler.ru function ShowDestAtom ( aDiv, i, nID, sClass, sName ) {
2
3 var oFrame = parent.frames.sourcefrm.document;
4
5 var tName = oFrame.createElement('p');
6 tName.id = "dest_name_" + i;
7 tName.className = "caption";
8 tName.innerHTML = '<a href="/contenido/document.html?id=' + nID + '&class=' + sClass + '" target="_blank">' + sName + '</a> <span style="color:gray">(' + sClass + ')</span>&nbsp;';
9 aDiv.appendChild(tName);
10
11 var aDel = oFrame.createElement('a');
12 aDel.id = 'del_item_' + i;
13 aDel.href = 'javascript:RemoveDest(' + i + ')';
14 aDel.style.color = 'red';
15 aDel.innerHTML = '[x]';
16 tName.appendChild(aDel);
17
18 var iID = oFrame.createElement('input');
19 iID.id = "dest_id_" + i;
20 iID.name = "dest_id_" + i;
21 iID.type = 'hidden';
22 iID.value = nID;
23 aDiv.appendChild(iID);
24
25 var iClass = oFrame.createElement('input');
26 iClass.id = "dest_class_" + i;
27 iClass.name = "dest_class_" + i;
28 iClass.type = 'hidden';
29 iClass.value = sClass;
30 aDiv.appendChild(iClass);
31
32 var iName = oFrame.createElement('input');
33 iName.id = "dest_name_" + i;
34 iName.name = "dest_name_" + i;
35 iName.type = 'hidden';
36 iName.value = sName;
37 aDiv.appendChild(iName);
38
39 }
40
41 function AppendDest ( nID, sClass, sName ) {
42 var oFrame = parent.frames.sourcefrm.document;
43 var oParent = oFrame.getElementById('link_list');
44 var count = 0;
45 for ( var i=0; i < 500; i++ ) {
46 var oD = oFrame.getElementById("dest_id_" + i);
47 var oC = oFrame.getElementById("dest_class_" + i);
48 if ( oD && oC ) {
49 count++;
50 if ((oD.value == nID) && (oC.value == sClass)) {
51 alert ('������� ��� ������������ � ������');
52 return false;
53 }
54 } else {
55 break;
56 }
57 }
58
59 var aDiv = oFrame.createElement('div');
60 aDiv.id = "link_dest_" + count;
61 aDiv.className = "link_string";
62 oParent.appendChild(aDiv);
63 ShowDestAtom ( aDiv, count, nID, sClass, sName );
64
65 return false;
66 }
67
68 function RemoveDest ( nInd ) {
69 var oFrame = parent.frames.sourcefrm.document;
70 var oParent = oFrame.getElementById('link_list');
71 var oForm = oFrame.forms['destform'];
72 var Atom = new Array();
73 var count = 0;
74 for ( var i=0; i < 500; i++ ) {
75 var sD = "dest_id_" + i;
76 var sC = "dest_class_" + i;
77 var sV = "dest_name_" + i;
78 var oD = oForm.elements[sD];
79 var oC = oForm.elements[sC];
80 var oV = oForm.elements[sV];
81 if ( oD && oC ) {
82 if ( i != nInd ) {
83 Atom[count++] = new Array (oD.value, oC.value, oV.value);
84 }
85 } else {
86 break;
87 }
88 }
89 oParent.innerHTML = '';
90 for ( var i=0; i < count; i++ ) {
91 var aDiv = document.createElement('div');
92 aDiv.id = "link_dest_" + count;
93 aDiv.className = "link_string";
94 oParent.appendChild(aDiv);
95 ShowDestAtom ( aDiv, i, Atom[i][0], Atom[i][1], Atom[i][2] );
96 }
97 }
98
99
100
101 function ShowSourceAtom ( aDiv, i, nID, sClass, sName ) {
102
103 var oFrame = parent.frames.destfrm.document;
104
105 var tName = oFrame.createElement('p');
106 tName.id = "source_name_" + i;
107 tName.className = "caption";
108 tName.innerHTML = '<a href="/contenido/document.html?id=' + nID + '&class=' + sClass + '" target="_blank">' + sName + '</a> <span style="color:gray">(' + sClass + ')</span>&nbsp;';
109 aDiv.appendChild(tName);
110
111 var aDel = oFrame.createElement('a');
112 aDel.id = 'del_item_' + i;
113 aDel.href = 'javascript:RemoveSource(' + i + ')';
114 aDel.style.color = 'red';
115 aDel.innerHTML = '[x]';
116 tName.appendChild(aDel);
117
118 var iID = oFrame.createElement('input');
119 iID.id = "source_id_" + i;
120 iID.name = "source_id_" + i;
121 iID.type = 'hidden';
122 iID.value = nID;
123 aDiv.appendChild(iID);
124
125 var iClass = oFrame.createElement('input');
126 iClass.id = "source_class_" + i;
127 iClass.name = "source_class_" + i;
128 iClass.type = 'hidden';
129 iClass.value = sClass;
130 aDiv.appendChild(iClass);
131
132 var iName = oFrame.createElement('input');
133 iName.id = "source_name_" + i;
134 iName.name = "source_name_" + i;
135 iName.type = 'hidden';
136 iName.value = sName;
137 aDiv.appendChild(iName);
138
139 }
140
141 function AppendSource ( nID, sClass, sName ) {
142 var oFrame = parent.frames.destfrm.document;
143 var oParent = oFrame.getElementById('link_list');
144 var count = 0;
145 for ( var i=0; i < 500; i++ ) {
146 var oD = oFrame.getElementById("source_id_" + i);
147 var oC = oFrame.getElementById("source_class_" + i);
148 if ( oD && oC ) {
149 count++;
150 if ((oD.value == nID) && (oC.value == sClass)) {
151 alert ('������� ��� ������������ � ������');
152 return false;
153 }
154 } else {
155 break;
156 }
157 }
158
159 var aDiv = oFrame.createElement('div');
160 aDiv.id = "link_source_" + count;
161 aDiv.className = "link_string";
162 oParent.appendChild(aDiv);
163 ShowSourceAtom ( aDiv, count, nID, sClass, sName );
164
165 return false;
166 }
167
168 function RemoveSource ( nInd ) {
169 var oFrame = parent.frames.destfrm.document;
170 var oParent = oFrame.getElementById('link_list');
171 var oForm = oFrame.forms['sourceform'];
172 var Atom = new Array();
173 var count = 0;
174 for ( var i=0; i < 500; i++ ) {
175 var sD = "source_id_" + i;
176 var sC = "source_class_" + i;
177 var sV = "source_name_" + i;
178 var oD = oForm.elements[sD];
179 var oC = oForm.elements[sC];
180 var oV = oForm.elements[sV];
181 if ( oD && oC ) {
182 if ( i != nInd ) {
183 Atom[count++] = new Array (oD.value, oC.value, oV.value);
184 }
185 } else {
186 break;
187 }
188 }
189 oParent.innerHTML = '';
190 for ( var i=0; i < count; i++ ) {
191 var aDiv = document.createElement('div');
192 aDiv.id = "link_source_" + count;
193 aDiv.className = "link_string";
194 oParent.appendChild(aDiv);
195 ShowSourceAtom ( aDiv, i, Atom[i][0], Atom[i][1], Atom[i][2] );
196 }
197 }