@@ 1164-1329 (lines=166) @@ | ||
1161 | * @param: id - id of the item for removing |
|
1162 | * @type: public |
|
1163 | */ |
|
1164 | dhtmlXMenuObject.prototype.removeItem = function(id, _isTId, _recCall) { |
|
1165 | if (!_isTId) id = this.idPrefix + id; |
|
1166 | ||
1167 | var pId = null; |
|
1168 | ||
1169 | if (id != this.idPrefix+this.topId) { |
|
1170 | ||
1171 | if (this.itemPull[id] == null) return; |
|
1172 | ||
1173 | // separator top |
|
1174 | var t = this.itemPull[id]["type"]; |
|
1175 | ||
1176 | if (t == "separator") { |
|
1177 | var item = this.idPull["separator_"+id]; |
|
1178 | if (this.itemPull[id]["parent"] == this.idPrefix+this.topId) { |
|
1179 | item.onclick = null; |
|
1180 | item.onselectstart = null; |
|
1181 | item.id = null; |
|
1182 | item.parentNode.removeChild(item); |
|
1183 | } else { |
|
1184 | item.childNodes[0].childNodes[0].onclick = null; |
|
1185 | item.childNodes[0].childNodes[0].onselectstart = null; |
|
1186 | item.childNodes[0].childNodes[0].id = null; |
|
1187 | item.childNodes[0].removeChild(item.childNodes[0].childNodes[0]); |
|
1188 | item.removeChild(item.childNodes[0]); |
|
1189 | item.parentNode.removeChild(item); |
|
1190 | } |
|
1191 | this.idPull["separator_"+id] = null; |
|
1192 | this.itemPull[id] = null; |
|
1193 | delete this.idPull["separator_"+id]; |
|
1194 | delete this.itemPull[id]; |
|
1195 | item = null; |
|
1196 | } else { |
|
1197 | // item checkbox radio |
|
1198 | pId = this.itemPull[id]["parent"]; |
|
1199 | var item = this.idPull[id]; |
|
1200 | item.onclick = null; |
|
1201 | item.oncontextmenu = null; |
|
1202 | item.onmouseover = null; |
|
1203 | item.onmouseout = null; |
|
1204 | item.onselectstart = null; |
|
1205 | item.id = null; |
|
1206 | while (item.childNodes.length > 0) item.removeChild(item.childNodes[0]); |
|
1207 | item.parentNode.removeChild(item); |
|
1208 | this.idPull[id] = null; |
|
1209 | this.itemPull[id] = null; |
|
1210 | delete this.idPull[id]; |
|
1211 | delete this.itemPull[id]; |
|
1212 | item = null; |
|
1213 | ||
1214 | } |
|
1215 | t = null; |
|
1216 | } |
|
1217 | ||
1218 | // clear nested items |
|
1219 | for (var a in this.itemPull) if (this.itemPull[a]["parent"] == id) this.removeItem(a, true, true); |
|
1220 | ||
1221 | // check if empty polygon left |
|
1222 | var p2 = new Array(id); |
|
1223 | if (pId != null && !_recCall) { |
|
1224 | if (this.idPull["polygon_"+pId] != null) { |
|
1225 | if (this.idPull["polygon_"+pId].tbd.childNodes.length == 0) { |
|
1226 | p2.push(pId); |
|
1227 | this._updateItemComplexState(pId, false, false); |
|
1228 | } |
|
1229 | } |
|
1230 | } |
|
1231 | ||
1232 | // delete nested polygons and parent's if any |
|
1233 | for (var q=0; q<p2.length; q++) { |
|
1234 | if (this.idPull["polygon_"+p2[q]]) { |
|
1235 | var p = this.idPull["polygon_"+p2[q]]; |
|
1236 | p.onclick = null; |
|
1237 | p.oncontextmenu = null; |
|
1238 | p.tbl.removeChild(p.tbd); |
|
1239 | p.tbd = null; |
|
1240 | p.removeChild(p.tbl); |
|
1241 | p.tbl = null; |
|
1242 | p.id = null; |
|
1243 | p.parentNode.removeChild(p); |
|
1244 | p = null; |
|
1245 | if (this._isIE6) { |
|
1246 | var pc = "polygon_"+p2[q]+"_ie6cover"; |
|
1247 | if (this.idPull[pc] != null) { document.body.removeChild(this.idPull[pc]); delete this.idPull[pc]; } |
|
1248 | } |
|
1249 | if (this.idPull["arrowup_"+id] != null && this._removeArrow) this._removeArrow("arrowup_"+id); |
|
1250 | if (this.idPull["arrowdown_"+id] != null && this._removeArrow) this._removeArrow("arrowdown_"+id); |
|
1251 | // |
|
1252 | this.idPull["polygon_"+p2[q]] = null; |
|
1253 | delete this.idPull["polygon_"+p2[q]]; |
|
1254 | } |
|
1255 | } |
|
1256 | p2 = null; |
|
1257 | ||
1258 | ||
1259 | /* |
|
1260 | // get parent |
|
1261 | var parentId = this.itemPull[id]["parent"]; |
|
1262 | // separator |
|
1263 | if (this.itemPull[id]["type"] == "separator") { |
|
1264 | this.idPull["separator_"+id].parentNode.removeChild(this.idPull["separator_"+id]); |
|
1265 | this.idPull["separator_"+id] = null; |
|
1266 | this.itemPull[id] = null; |
|
1267 | delete this.idPull["separator_"+id]; |
|
1268 | delete this.itemPull[id]; |
|
1269 | // return; |
|
1270 | } else { |
|
1271 | // complex/single item |
|
1272 | if (this.itemPull[id]["complex"]) { |
|
1273 | var items = this._getAllParents(id); |
|
1274 | items[items.length] = id; |
|
1275 | var polygons = new Array(); |
|
1276 | for (var q=0; q<items.length; q++) { |
|
1277 | if (this.itemPull[items[q]]["type"] == "separator") { |
|
1278 | this.removeItem(items[q].replace(this.idPrefix,"")); |
|
1279 | } else { |
|
1280 | if (this.itemPull[items[q]]["complex"]) { polygons[polygons.length] = items[q]; } |
|
1281 | this.idPull[items[q]].parentNode.removeChild(this.idPull[items[q]]); |
|
1282 | this.idPull[items[q]] = null; |
|
1283 | this.itemPull[items[q]] = null; |
|
1284 | delete this.idPull[items[q]]; |
|
1285 | delete this.itemPull[items[q]]; |
|
1286 | } |
|
1287 | } |
|
1288 | for (var q=0; q<polygons.length; q++) { |
|
1289 | this.idPull["polygon_"+polygons[q]].parentNode.removeChild(this.idPull["polygon_"+polygons[q]]); |
|
1290 | if (this._isIE6) { |
|
1291 | var pId = "polygon_"+polygons[q]+"_ie6cover"; |
|
1292 | if (this.idPull[pId] != null) { document.body.removeChild(this.idPull[pId]); delete this.idPull[pId]; } |
|
1293 | } |
|
1294 | this.idPull["polygon_"+polygons[q]] = null; |
|
1295 | this.itemPull[polygons[q]] = null; |
|
1296 | delete this.idPull["polygon_"+polygons[q]]; |
|
1297 | delete this.itemPull[polygons[q]]; |
|
1298 | } |
|
1299 | } else { |
|
1300 | this.idPull[id].parentNode.removeChild(this.idPull[id]); |
|
1301 | this.idPull[id] = null; |
|
1302 | this.itemPull[id] = null; |
|
1303 | delete this.idPull[id]; |
|
1304 | delete this.itemPull[id]; |
|
1305 | } |
|
1306 | } |
|
1307 | // checking existing empty polygon |
|
1308 | if (this.idPull["polygon_"+parentId] != null) { |
|
1309 | var p = this.idPull["polygon_"+parentId]; |
|
1310 | if (p.tbd.childNodes.length == 0) { |
|
1311 | p.tbd.parentNode.removeChild(p.tbd); |
|
1312 | p.tbl.parentNode.removeChild(p.tbl); |
|
1313 | document.body.removeChild(p); |
|
1314 | p = null; |
|
1315 | if (this._isIE6) { |
|
1316 | var pId = "polygon_"+parentId+"_ie6cover"; |
|
1317 | if (this.idPull[pId] != null) { |
|
1318 | document.body.removeChild(this.idPull[pId]); |
|
1319 | this.idPull[pId] = null; |
|
1320 | delete this.idPull[pId]; |
|
1321 | } |
|
1322 | } |
|
1323 | this.idPull["polygon_"+parentId] = null; |
|
1324 | delete this.idPull["polygon_"+parentId]; |
|
1325 | this._updateItemComplexState(parentId, false, false); |
|
1326 | } |
|
1327 | } |
|
1328 | */ |
|
1329 | } |
|
1330 | /* collect parents for remove complex item */ |
|
1331 | dhtmlXMenuObject.prototype._getAllParents = function(id) { |
|
1332 | var parents = new Array(); |
@@ 1197-1297 (lines=101) @@ | ||
1194 | * @param: id - id of the item for removing |
|
1195 | * @type: public |
|
1196 | */ |
|
1197 | dhtmlXMenuObject.prototype.removeItem = function(id, _isTId, _recCall) { |
|
1198 | if (!_isTId) id = this.idPrefix + id; |
|
1199 | ||
1200 | var pId = null; |
|
1201 | ||
1202 | if (id != this.idPrefix+this.topId) { |
|
1203 | ||
1204 | if (this.itemPull[id] == null) return; |
|
1205 | ||
1206 | // effects |
|
1207 | if (this.idPull["polygon_"+id] && this.idPull["polygon_"+id]._tmShow) window.clearTimeout(this.idPull["polygon_"+id]._tmShow); |
|
1208 | ||
1209 | // separator top |
|
1210 | var t = this.itemPull[id]["type"]; |
|
1211 | ||
1212 | if (t == "separator") { |
|
1213 | var item = this.idPull["separator_"+id]; |
|
1214 | if (this.itemPull[id]["parent"] == this.idPrefix+this.topId) { |
|
1215 | item.onclick = null; |
|
1216 | item.onselectstart = null; |
|
1217 | item.id = null; |
|
1218 | item.parentNode.removeChild(item); |
|
1219 | } else { |
|
1220 | item.childNodes[0].childNodes[0].onclick = null; |
|
1221 | item.childNodes[0].childNodes[0].onselectstart = null; |
|
1222 | item.childNodes[0].childNodes[0].id = null; |
|
1223 | item.childNodes[0].removeChild(item.childNodes[0].childNodes[0]); |
|
1224 | item.removeChild(item.childNodes[0]); |
|
1225 | item.parentNode.removeChild(item); |
|
1226 | } |
|
1227 | this.idPull["separator_"+id] = null; |
|
1228 | this.itemPull[id] = null; |
|
1229 | delete this.idPull["separator_"+id]; |
|
1230 | delete this.itemPull[id]; |
|
1231 | item = null; |
|
1232 | } else { |
|
1233 | // item checkbox radio |
|
1234 | pId = this.itemPull[id]["parent"]; |
|
1235 | var item = this.idPull[id]; |
|
1236 | item.onclick = null; |
|
1237 | item.oncontextmenu = null; |
|
1238 | item.onmouseover = null; |
|
1239 | item.onmouseout = null; |
|
1240 | item.onselectstart = null; |
|
1241 | item.id = null; |
|
1242 | while (item.childNodes.length > 0) item.removeChild(item.childNodes[0]); |
|
1243 | item.parentNode.removeChild(item); |
|
1244 | this.idPull[id] = null; |
|
1245 | this.itemPull[id] = null; |
|
1246 | delete this.idPull[id]; |
|
1247 | delete this.itemPull[id]; |
|
1248 | item = null; |
|
1249 | ||
1250 | } |
|
1251 | t = null; |
|
1252 | } |
|
1253 | ||
1254 | // clear nested items |
|
1255 | for (var a in this.itemPull) if (this.itemPull[a]["parent"] == id) this.removeItem(a, true, true); |
|
1256 | ||
1257 | // check if empty polygon left |
|
1258 | var p2 = new Array(id); |
|
1259 | if (pId != null && !_recCall) { |
|
1260 | if (this.idPull["polygon_"+pId] != null) { |
|
1261 | if (this.idPull["polygon_"+pId].tbd.childNodes.length == 0) { |
|
1262 | p2.push(pId); |
|
1263 | this._updateItemComplexState(pId, false, false); |
|
1264 | } |
|
1265 | } |
|
1266 | } |
|
1267 | ||
1268 | // delete nested polygons and parent's if any |
|
1269 | for (var q=0; q<p2.length; q++) { |
|
1270 | if (this.idPull["polygon_"+p2[q]]) { |
|
1271 | var p = this.idPull["polygon_"+p2[q]]; |
|
1272 | p.onclick = null; |
|
1273 | p.oncontextmenu = null; |
|
1274 | p.tbl.removeChild(p.tbd); |
|
1275 | p.tbd = null; |
|
1276 | p.removeChild(p.tbl); |
|
1277 | p.tbl = null; |
|
1278 | p.id = null; |
|
1279 | p.parentNode.removeChild(p); |
|
1280 | p = null; |
|
1281 | if (this._isIE6) { |
|
1282 | var pc = "polygon_"+p2[q]+"_ie6cover"; |
|
1283 | if (this.idPull[pc] != null) { document.body.removeChild(this.idPull[pc]); delete this.idPull[pc]; } |
|
1284 | } |
|
1285 | if (this.idPull["arrowup_"+id] != null && this._removeArrow) this._removeArrow("arrowup_"+id); |
|
1286 | if (this.idPull["arrowdown_"+id] != null && this._removeArrow) this._removeArrow("arrowdown_"+id); |
|
1287 | // |
|
1288 | this.idPull["polygon_"+p2[q]] = null; |
|
1289 | delete this.idPull["polygon_"+p2[q]]; |
|
1290 | } |
|
1291 | } |
|
1292 | p2 = null; |
|
1293 | ||
1294 | // update corners |
|
1295 | if (this.skin == "dhx_terrace" && arguments.length == 1) this._improveTerraceSkin(); |
|
1296 | ||
1297 | } |
|
1298 | /* collect parents for remove complex item */ |
|
1299 | dhtmlXMenuObject.prototype._getAllParents = function(id) { |
|
1300 | var parents = new Array(); |