| 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 |
var brettz9 = function () { |
|---|
| 31 |
|
|---|
| 32 |
|
|---|
| 33 |
|
|---|
| 34 |
var that = this; |
|---|
| 35 |
|
|---|
| 36 |
|
|---|
| 37 |
|
|---|
| 38 |
|
|---|
| 39 |
function _ColDisplayStrategy () { |
|---|
| 40 |
} |
|---|
| 41 |
_ColDisplayStrategy.prototype.addColumnEntryName = function (appendEl, colElement) { |
|---|
| 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 |
appendEl.innerHTML = colElement.nodeName; |
|---|
| 67 |
} |
|---|
| 68 |
|
|---|
| 69 |
|
|---|
| 70 |
|
|---|
| 71 |
_ColDisplayStrategy.prototype.addColumnEntryTitle = function (appendEl, colElement) { |
|---|
| 72 |
|
|---|
| 73 |
|
|---|
| 74 |
return null; |
|---|
| 75 |
} |
|---|
| 76 |
|
|---|
| 77 |
|
|---|
| 78 |
|
|---|
| 79 |
function _getNodeInfo (nodes, spanclass) { |
|---|
| 80 |
var commentsproc = ''; |
|---|
| 81 |
if (spanclass === undefined) { |
|---|
| 82 |
spanclass = 'colbrows_characteristic'; |
|---|
| 83 |
} |
|---|
| 84 |
for (var i = 0; i < nodes.length; i++) { |
|---|
| 85 |
if (nodes[i]) { |
|---|
| 86 |
switch (nodes[i].nodeType) { |
|---|
| 87 |
case 1: |
|---|
| 88 |
|
|---|
| 89 |
break; |
|---|
| 90 |
|
|---|
| 91 |
|
|---|
| 92 |
|
|---|
| 93 |
|
|---|
| 94 |
case 3: |
|---|
| 95 |
if (!nodes[i].nodeValue.match(/^\s+$/) && 1) { |
|---|
| 96 |
commentsproc += '<span class="'+spanclass+'">Text:<\/span> '+brettz9.XML.escapeString(nodes[i].nodeValue)+'<br />'; |
|---|
| 97 |
} |
|---|
| 98 |
break; |
|---|
| 99 |
case 4: |
|---|
| 100 |
commentsproc += '<span class="'+spanclass+'">CDATA section:<\/span> '+brettz9.XML.escapeString(nodes[i].nodeValue)+'<br />'; |
|---|
| 101 |
break; |
|---|
| 102 |
|
|---|
| 103 |
|
|---|
| 104 |
|
|---|
| 105 |
|
|---|
| 106 |
|
|---|
| 107 |
|
|---|
| 108 |
|
|---|
| 109 |
|
|---|
| 110 |
|
|---|
| 111 |
|
|---|
| 112 |
case 7: |
|---|
| 113 |
commentsproc += '<span class="'+spanclass+'">Proc Inst:<\/span> <?'+nodes[i].nodeName +' '+ nodes[i].nodeValue+'?><br />'; |
|---|
| 114 |
break; |
|---|
| 115 |
case 8: |
|---|
| 116 |
commentsproc += '<span class="'+spanclass+'">Comment:<\/span> '+nodes[i].nodeValue+'<br />'; |
|---|
| 117 |
break; |
|---|
| 118 |
|
|---|
| 119 |
|
|---|
| 120 |
|
|---|
| 121 |
|
|---|
| 122 |
case 10: |
|---|
| 123 |
|
|---|
| 124 |
break; |
|---|
| 125 |
|
|---|
| 126 |
|
|---|
| 127 |
|
|---|
| 128 |
|
|---|
| 129 |
|
|---|
| 130 |
|
|---|
| 131 |
default: |
|---|
| 132 |
throw 'Unexpected element: '+nodes[i].nodeType; |
|---|
| 133 |
} |
|---|
| 134 |
} |
|---|
| 135 |
} |
|---|
| 136 |
return commentsproc; |
|---|
| 137 |
} |
|---|
| 138 |
|
|---|
| 139 |
|
|---|
| 140 |
|
|---|
| 141 |
|
|---|
| 142 |
function _MetaInfoStrategy (defaultXmlString) { |
|---|
| 143 |
|
|---|
| 144 |
|
|---|
| 145 |
} |
|---|
| 146 |
_MetaInfoStrategy.prototype.populateMetaInfo = function (thisitem) { |
|---|
| 147 |
if (!thisitem) { |
|---|
| 148 |
return; |
|---|
| 149 |
} |
|---|
| 150 |
|
|---|
| 151 |
|
|---|
| 152 |
|
|---|
| 153 |
var attdisplay = ''; |
|---|
| 154 |
if (thisitem.attributes) { |
|---|
| 155 |
var attrs = thisitem.attributes; |
|---|
| 156 |
if (attrs.length > 0) { |
|---|
| 157 |
attdisplay += '<table class="colbrows_att"><th class="colbrows_att">Name<\/th><th class="colbrows_att">Value<\/th>'; |
|---|
| 158 |
for (var i = 0; i < attrs.length; i++) { |
|---|
| 159 |
attdisplay += "<tr class='colbrows_att'><td class='colbrows_attrname'>"+attrs[i].nodeName+"<\/td>"; |
|---|
| 160 |
attdisplay += "<td class='colbrows_attrval'>"+brettz9.XML.escapeString(attrs[i].nodeValue)+"<\/td><\/tr>"; |
|---|
| 161 |
} |
|---|
| 162 |
attdisplay += '<\/table>'; |
|---|
| 163 |
} |
|---|
| 164 |
} |
|---|
| 165 |
|
|---|
| 166 |
var colbrows_attributes = document.getElementById('colbrows_attributes'); |
|---|
| 167 |
colbrows_attributes.innerHTML = attdisplay; |
|---|
| 168 |
|
|---|
| 169 |
|
|---|
| 170 |
var colbrows_text = document.getElementById('colbrows_text'); |
|---|
| 171 |
var thisitemTextContent = _colbrowser.MSIE ? thisitem.text : thisitem.textContent; |
|---|
| 172 |
|
|---|
| 173 |
colbrows_text.innerHTML = '<textarea rows="5" cols="40">'+brettz9.XML.escapeString(thisitemTextContent)+'<\/textarea>'; |
|---|
| 174 |
|
|---|
| 175 |
|
|---|
| 176 |
var renderedXML = XML.serialize(thisitem); |
|---|
| 177 |
|
|---|
| 178 |
|
|---|
| 179 |
|
|---|
| 180 |
var colbrows_textchild = document.getElementById('colbrows_textchild'); |
|---|
| 181 |
colbrows_textchild.innerHTML = '<textarea rows="5" cols="40">'+brettz9.XML.escapeString(renderedXML)+'<\/textarea>'; |
|---|
| 182 |
|
|---|
| 183 |
|
|---|
| 184 |
var colbrows_rendered = document.getElementById('colbrows_rendered'); |
|---|
| 185 |
colbrows_rendered.innerHTML = renderedXML; |
|---|
| 186 |
|
|---|
| 187 |
|
|---|
| 188 |
var children = thisitem.childNodes; |
|---|
| 189 |
var commentsProcTextCdata = _getNodeInfo(children); |
|---|
| 190 |
var colbrows_commentsprocinst = document.getElementById('colbrows_commentsprocinst'); |
|---|
| 191 |
colbrows_commentsprocinst.innerHTML = commentsProcTextCdata; |
|---|
| 192 |
}; |
|---|
| 193 |
|
|---|
| 194 |
_MetaInfoStrategy.prototype.populateDocInfo = function (xml) { |
|---|
| 195 |
var docel = xml.documentElement ? xml.documentElement : xml.ownerDocument.documentElement; |
|---|
| 196 |
|
|---|
| 197 |
var colbrows_doc = document.getElementById('colbrows_document'); |
|---|
| 198 |
|
|---|
| 199 |
|
|---|
| 200 |
|
|---|
| 201 |
colbrows_doc.innerHTML = '<span class="colbrows_characteristic">Root node:<\/span> '+docel.nodeName+', <span class="colbrows_rootns">Namespace<\/span>: '+docel.namespaceURI+'<br />'+ |
|---|
| 202 |
'<span class="colbrows_characteristic">Internal subset:<\/span> '+(xml.doctype ? brettz9.XML.escapeString(xml.doctype.internalSubset) : 'none')+'<br />'+ |
|---|
| 203 |
'<span class="colbrows_characteristic">Public ID:<\/span> '+(xml.doctype ? brettz9.XML.escapeString(xml.doctype.publicId) : 'none') + '<br />'+ |
|---|
| 204 |
'<span class="colbrows_characteristic">System ID:<\/span> '+(xml.doctype ? brettz9.XML.escapeString(xml.doctype.systemId) : 'none') + '<br />'; |
|---|
| 205 |
|
|---|
| 206 |
|
|---|
| 207 |
|
|---|
| 208 |
var nodedata; |
|---|
| 209 |
var i=0; |
|---|
| 210 |
var rootprevtemp = docel; |
|---|
| 211 |
var rootposttemp = docel; |
|---|
| 212 |
var rootpre = []; |
|---|
| 213 |
var rootpost = []; |
|---|
| 214 |
while (rootprevtemp) { |
|---|
| 215 |
rootpre[i] = rootprevtemp.previousSibling; |
|---|
| 216 |
i++; |
|---|
| 217 |
rootprevtemp = rootprevtemp.previousSibling; |
|---|
| 218 |
} |
|---|
| 219 |
|
|---|
| 220 |
rootpre = brettz9.PHP.array_reverse(rootpre); |
|---|
| 221 |
|
|---|
| 222 |
colbrows_doc.innerHTML += '<span class="colbrows_preroot">Before the root<\/span><br />'; |
|---|
| 223 |
colbrows_doc.innerHTML += _getNodeInfo(rootpre, 'colbrows_prepostnodes'); |
|---|
| 224 |
|
|---|
| 225 |
i=0; |
|---|
| 226 |
while (rootposttemp) { |
|---|
| 227 |
rootpost[i] = rootposttemp.nextSibling; |
|---|
| 228 |
i++; |
|---|
| 229 |
rootposttemp = rootposttemp.nextSibling; |
|---|
| 230 |
} |
|---|
| 231 |
colbrows_doc.innerHTML += '<span class="colbrows_postroot">After the root<\/span><br />'; |
|---|
| 232 |
colbrows_doc.innerHTML += _getNodeInfo(rootpost, 'colbrows_prepostnodes'); |
|---|
| 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 |
var colbrows_procinsts = document.getElementById('colbrows_procinsts'); |
|---|
| 272 |
|
|---|
| 273 |
var allprocinsts = XML.getNodes(xml, '//processing-instruction()', null, xml); |
|---|
| 274 |
|
|---|
| 275 |
var procinsts = ''; |
|---|
| 276 |
for (i = 0; i < allprocinsts.length; i++) { |
|---|
| 277 |
procinsts += '<?'+allprocinsts[i].nodeName+' '+allprocinsts[i].nodeValue+'?>\n'; |
|---|
| 278 |
} |
|---|
| 279 |
colbrows_procinsts.innerHTML = '<textarea rows="5" cols="40">'+procinsts+'<\/textarea>'; |
|---|
| 280 |
|
|---|
| 281 |
|
|---|
| 282 |
var colbrows_comments = document.getElementById('colbrows_comments'); |
|---|
| 283 |
var allcomments = XML.getNodes(xml, '//comment()', null, xml); |
|---|
| 284 |
|
|---|
| 285 |
var comments = ''; |
|---|
| 286 |
for (i = 0; i < allcomments.length; i++) { |
|---|
| 287 |
comments += '<!--'+allcomments[0].nodeValue+'-->\n'; |
|---|
| 288 |
} |
|---|
| 289 |
colbrows_comments.innerHTML = '<textarea rows="5" cols="40">'+comments+'<\/textarea>'; |
|---|
| 290 |
}; |
|---|
| 291 |
_MetaInfoStrategy.prototype.populateAllInfo = function (targvalue, URLtoXMLDoc) { |
|---|
| 292 |
if (!targvalue) { |
|---|
| 293 |
return; |
|---|
| 294 |
} |
|---|
| 295 |
|
|---|
| 296 |
var pattern = _colbrowser.XPathPlus; |
|---|
| 297 |
var doc = targvalue.match(pattern); |
|---|
| 298 |
var xml; |
|---|
| 299 |
if (doc) { |
|---|
| 300 |
var docFileXLink = doc[1]; |
|---|
| 301 |
var fileXLinkAndXPath = doc[3]+(doc[4]?doc[4]:''); |
|---|
| 302 |
var currentXPath = doc[6]; |
|---|
| 303 |
var fileXLink = doc[3]; |
|---|
| 304 |
} |
|---|
| 305 |
|
|---|
| 306 |
if (doc && fileXLink) { |
|---|
| 307 |
if (fileXLink.match(/^this\./)) { |
|---|
| 308 |
xml = URLtoXMLDoc[docFileXLink]; |
|---|
| 309 |
} |
|---|
| 310 |
else if (URLtoXMLDoc[fileXLinkAndXPath]) { |
|---|
| 311 |
xml = URLtoXMLDoc[fileXLinkAndXPath]; |
|---|
| 312 |
} |
|---|
| 313 |
targvalue = currentXPath; |
|---|
| 314 |
} |
|---|
| 315 |
|
|---|
| 316 |
targvalue = (targvalue === '') ? '/*' : targvalue; |
|---|
| 317 |
|
|---|
| 318 |
|
|---|
| 319 |
var thislevel = XML.getNodes(xml, targvalue, null, xml); |
|---|
| 320 |
var thisitem = thislevel[0]; |
|---|
| 321 |
|
|---|
| 322 |
this.populateMetaInfo(thisitem); |
|---|
| 323 |
|
|---|
| 324 |
this.populateDocInfo(xml); |
|---|
| 325 |
}; |
|---|
| 326 |
|
|---|
| 327 |
|
|---|
| 328 |
|
|---|
| 329 |
|
|---|
| 330 |
|
|---|
| 331 |
|
|---|
| 332 |
|
|---|
| 333 |
|
|---|
| 334 |
function _colbrowser ( defaultXml, UserMetaInfoStrat, ColDisplayStrat) { |
|---|
| 335 |
|
|---|
| 336 |
|
|---|
| 337 |
|
|---|
| 338 |
|
|---|
| 339 |
|
|---|
| 340 |
|
|---|
| 341 |
|
|---|
| 342 |
|
|---|
| 343 |
this.idCounter = 0; |
|---|
| 344 |
this.tabIndex = true; |
|---|
| 345 |
|
|---|
| 346 |
|
|---|
| 347 |
this.colbrows_prfx = 'colbrows_'; |
|---|
| 348 |
this.colbrows_suffix = 'colbrowser'; |
|---|
| 349 |
this.css_prfx = 'colbrows_'; |
|---|
| 350 |
|
|---|
| 351 |
|
|---|
| 352 |
|
|---|
| 353 |
this.colbrows_style_top = '50px'; |
|---|
| 354 |
this.colbrows_style_left = '60px'; |
|---|
| 355 |
this.colbrows_style_height = '250px'; |
|---|
| 356 |
this.colbrows_style_width = '640px'; |
|---|
| 357 |
this.colbrows_style_position = 'relative'; |
|---|
| 358 |
this.colbrows_style_overflow = 'auto'; |
|---|
| 359 |
|
|---|
| 360 |
|
|---|
| 361 |
this.select_size = '10'; |
|---|
| 362 |
this.select_style_top = '80px'; |
|---|
| 363 |
this.select_style_width = '200px'; |
|---|
| 364 |
this.select_style_left = 0; |
|---|
| 365 |
this.select_start_selindex = 0; |
|---|
| 366 |
|
|---|
| 367 |
|
|---|
| 368 |
|
|---|
| 369 |
this.pattern_img = /(.*\.js)(\?.*\.(jpg|jpeg|png|gif|bmp|ico))$/i; |
|---|
| 370 |
this.pattern_iframe = new RegExp ('(.*\\.js)(\\?.*\\.(html|htm|dhtml|svg|xml|xul|rdf'+(!this.MSIE ? '|xhtml':'')+'))$', 'i'); |
|---|
| 371 |
this.pattern_text = /(.*\.js)(\?.*\.(txt|rtf|js|css|php|dtd|url|lrc|properties|htaccess|xsl))$/i; |
|---|
| 372 |
this.pattern_obj = /(.*\.js)(\?.*\.(mov))$/i; |
|---|
| 373 |
this.pattern_mp3 = /(.*\.js)(\?.*\.(mp3))$/i; |
|---|
| 374 |
|
|---|
| 375 |
|
|---|
| 376 |
if (defaultXml === '' || defaultXml === null) { |
|---|
| 377 |
defaultXml = undefined; |
|---|
| 378 |
} |
|---|
| 379 |
|
|---|
| 380 |
switch (typeof defaultXml) { |
|---|
| 381 |
case 'undefined': |
|---|
| 382 |
this.xmlstring = _colbrowser.sampleXml; |
|---|
| 383 |
break; |
|---|
| 384 |
case 'string': |
|---|
| 385 |
this.xmlstring = defaultXml; |
|---|
| 386 |
break; |
|---|
| 387 |
case 'object': |
|---|
| 388 |
this.xmlstring = XML.parse(defaultXml); |
|---|
| 389 |
break; |
|---|
| 390 |
default: |
|---|
| 391 |
this.xmlstring = _colbrowser.sampleXml; |
|---|
| 392 |
break; |
|---|
| 393 |
} |
|---|
| 394 |
|
|---|
| 395 |
|
|---|
| 396 |
|
|---|
| 397 |
|
|---|
| 398 |
|
|---|
| 399 |
|
|---|
| 400 |
|
|---|
| 401 |
|
|---|
| 402 |
|
|---|
| 403 |
|
|---|
| 404 |
|
|---|
| 405 |
|
|---|
| 406 |
|
|---|
| 407 |
|
|---|
| 408 |
|
|---|
| 409 |
this.origxmlstring = this.xmlstring; |
|---|
| 410 |
|
|---|
| 411 |
|
|---|
| 412 |
if (brettz9.JSClassUtil.classHasInterface(UserMetaInfoStrat, 'InfoStrategy')) { |
|---|
| 413 |
this.InfoStrategy = new UserMetaInfoStrat(this.xmlstring); |
|---|
| 414 |
} |
|---|
| 415 |
else { |
|---|
| 416 |
this.InfoStrategy = new _MetaInfoStrategy(this.xmlstring); |
|---|
| 417 |
} |
|---|
| 418 |
if (brettz9.JSClassUtil.classHasInterface(ColDisplayStrat, 'ColDisplayStrategy')) { |
|---|
| 419 |
this.colDisplayStrategy = new ColDisplayStrat(); |
|---|
| 420 |
} |
|---|
| 421 |
else { |
|---|
| 422 |
this.colDisplayStrategy = new _ColDisplayStrategy(); |
|---|
| 423 |
} |
|---|
| 424 |
|
|---|
| 425 |
} |
|---|
| 426 |
|
|---|
| 427 |
|
|---|
| 428 |
|
|---|
| 429 |
|
|---|
| 430 |
_colbrowser.prototype.init = function (e, |
|---|
| 431 |
noColViewHandlers) { |
|---|
| 432 |
|
|---|
| 433 |
|
|---|
| 434 |
var that = this; |
|---|
| 435 |
|
|---|
| 436 |
function _setColbrowserStyle (colbrows) { |
|---|
| 437 |
colbrows.style.height = that.colbrows_style_height; |
|---|
| 438 |
colbrows.style.width = that.colbrows_style_width; |
|---|
| 439 |
colbrows.style.top = that.colbrows_style_top; |
|---|
| 440 |
colbrows.style.left = that.colbrows_style_left; |
|---|
| 441 |
colbrows.style.position = that.colbrows_style_position; |
|---|
| 442 |
colbrows.style.overflow = that.colbrows_style_overflow; |
|---|
| 443 |
} |
|---|
| 444 |
|
|---|
| 445 |
|
|---|
| 446 |
this.select_style_left_orig = this.select_style_left; |
|---|
| 447 |
this.idCounter_orig = this.idCounter; |
|---|
| 448 |
|
|---|
| 449 |
|
|---|
| 450 |
|
|---|
| 451 |
this.xmlstring = XML.serialize(brettz9.DOM.resolveXIncludes(XML.parse(this.xmlstring))); |
|---|
| 452 |
|
|---|
| 453 |
this.URLtoXMLDoc = {'show^embed^doc^this.xmlstring^' : XML.parse(this.xmlstring)}; |
|---|
| 454 |
|
|---|
| 455 |
|
|---|
| 456 |
function resetXMLCache () { |
|---|
| 457 |
that.URLtoXMLDoc = {'show^embed^doc^this.xmlstring^' : XML.parse(that.xmlstring)}; |
|---|
| 458 |
} |
|---|
| 459 |
brettz9.DOM.addEvent('colbrowser_hide_hidden_files', 'click', resetXMLCache, false); |
|---|
| 460 |
|
|---|
| 461 |
|
|---|
| 462 |
_colbrowser.colbrowsCount++; |
|---|
| 463 |
|
|---|
| 464 |
|
|---|
| 465 |
|
|---|
| 466 |
var colbrows = document.getElementById(this.colbrows_prfx+this.colbrows_suffix); |
|---|
| 467 |
|
|---|
| 468 |
_setColbrowserStyle(colbrows); |
|---|
| 469 |
|
|---|
| 470 |
|
|---|
| 471 |
var colbrows_colview = document.getElementById('colbrows_colview'); |
|---|
| 472 |
|
|---|
| 473 |
function _goToColumnView (e) { |
|---|
| 474 |
var count = 1; |
|---|
| 475 |
var sel = document.getElementById(that.colbrows_prfx+count); |
|---|
| 476 |
|
|---|
| 477 |
while(document.getElementById(that.colbrows_prfx+ (++count))) { |
|---|
| 478 |
sel = document.getElementById(that.colbrows_prfx+(count-1)); |
|---|
| 479 |
} |
|---|
| 480 |
|
|---|
| 481 |
if (sel.selectedIndex === -1 || |
|---|
| 482 |
(_colbrowser.MOZ && |
|---|
| 483 |
sel.selectedIndex === (sel.options.length-1) |
|---|
| 484 |
) |
|---|
| 485 |
) { |
|---|
| 486 |
sel.selectedIndex = that.select_start_selindex; |
|---|
| 487 |
} |
|---|
| 488 |
sel.focus(); |
|---|
| 489 |
} |
|---|
| 490 |
if (!noColViewHandlers) { |
|---|
| 491 |
brettz9.DOM.addEvent(colbrows_colview, 'click', _goToColumnView); |
|---|
| 492 |
brettz9.DOM.addEvent(colbrows_colview, 'keypress', _goToColumnView); |
|---|
| 493 |
} |
|---|
| 494 |
|
|---|
| 495 |
|
|---|
| 496 |
|
|---|
| 497 |
function _clickOffInputBox (e) { |
|---|
| 498 |
var inputarea = Tooltip.tooltip.tooltip; |
|---|
| 499 |
if (inputarea.style.visibility === 'visible') { |
|---|
| 500 |
if (inputarea.parentNode) { |
|---|
| 501 |
inputarea.parentNode.removeChild(inputarea); |
|---|
| 502 |
} |
|---|
| 503 |
} |
|---|
| 504 |
|
|---|
| 505 |
} |
|---|
| 506 |
brettz9.DOM.addEvent(document, 'click', _clickOffInputBox); |
|---|
| 507 |
|
|---|
| 508 |
|
|---|
| 509 |
|
|---|
| 510 |
function _updateColbrowserFromXMLTextBox (e) { |
|---|
| 511 |
var targ = _colbrowser.MSIE ? e.srcElement : e.target; |
|---|
| 512 |
that.xmlstring = targ.value; |
|---|
| 513 |
while (colbrows.childNodes.length > 0) { |
|---|
| 514 |
colbrows.removeChild(colbrows.firstChild); |
|---|
| 515 |
} |
|---|
| 516 |
that.select_style_left = that.select_style_left_orig; |
|---|
| 517 |
that.idCounter = that.idCounter_orig; |
|---|
| 518 |
that.URLtoXMLDoc = {'show^embed^doc^this.xmlstring^' : XML.parse(that.xmlstring)}; |
|---|
| 519 |
that._buildCol(colbrows, false, 'show^embed^doc^this.xmlstring^', targ.value); |
|---|
| 520 |
colbrows.firstChild.selectedIndex = 0; |
|---|
| 521 |
colbrows.firstChild.focus(); |
|---|
| 522 |
} |
|---|
| 523 |
brettz9.DOM.addEvent(document.getElementById('colbrows_xmldocbox'), |
|---|
| 524 |
'change', _updateColbrowserFromXMLTextBox); |
|---|
| 525 |
|
|---|
| 526 |
|
|---|
| 527 |
|
|---|
| 528 |
|
|---|
| 529 |
|
|---|
| 530 |
function _newItem (e) { |
|---|
| 531 |
|
|---|
| 532 |
|
|---|
| 533 |
|
|---|
| 534 |
|
|---|
| 535 |
|
|---|
| 536 |
var optval; |
|---|
| 537 |
var targ = _colbrowser.MSIE ? e.srcElement : e.target; |
|---|
| 538 |
switch (targ.nodeName.toLowerCase()) { |
|---|
| 539 |
case 'option': |
|---|
| 540 |
optval = targ.value; |
|---|
| 541 |
break; |
|---|
| 542 |
case 'input': |
|---|
| 543 |
var newitem = document.getElementById('newitem'); |
|---|
| 544 |
optval = newitem.options[newitem.selectedIndex].value; |
|---|
| 545 |
break; |
|---|
| 546 |
default : |
|---|
| 547 |
throw('Unexpected element'); |
|---|
| 548 |
} |
|---|
| 549 |
|
|---|
| 550 |
|
|---|
| 551 |
if (!document.getElementById(_colbrowser.currFocus.id)) { |
|---|
| 552 |
that.xmlstring = '<'+optval+'></'+optval+'>'; |
|---|
| 553 |
try { |
|---|
| 554 |
that._buildCol(colbrows, false, 'show^embed^doc^this.xmlstring^'); |
|---|
| 555 |
} catch (e) { |
|---|
| 556 |
alert(e.message?e.message:e); |
|---|
| 557 |
} |
|---|
| 558 |
} |
|---|
| 559 |
if (_colbrowser.currFocus.id.match(/_1$/)) { |
|---|
| 560 |
return; |
|---|
| 561 |
} |
|---|
| 562 |
|
|---|
| 563 |
var option = _colbrowser.currFocus.options[_colbrowser.currFocus.selectedIndex]; |
|---|
| 564 |
var option2 = brettz9.DOM.createElementNSwrapper(_colbrowser.HTMLNS, 'option'); |
|---|
| 565 |
|
|---|
| 566 |
|
|---|
| 567 |
|
|---|
| 568 |
|
|---|
| 569 |
|
|---|
| 570 |
|
|---|
| 571 |
|
|---|
| 572 |
|
|---|
| 573 |
|
|---|
| 574 |
|
|---|
| 575 |
|
|---|
| 576 |
var pattern = _colbrowser.XPathPlus; |
|---|
| 577 |
var doc = option.value.match(pattern); |
|---|
| 578 |
if (doc) { |
|---|
| 579 |
var docFileXLink = doc[1]; |
|---|
| 580 |
var fileXLinkAndXPath = doc[3]+(doc[4]?doc[4]:''); |
|---|
| 581 |
var currentXPath = doc[6]; |
|---|
| 582 |
var fileXLink = doc[3]; |
|---|
| 583 |
|
|---|
| 584 |
var newXPath = doc[5]; |
|---|
| 585 |
} |
|---|
| 586 |
var xml, key; |
|---|
| 587 |
if (doc && fileXLink) { |
|---|
| 588 |
if (fileXLink.match(/^this\./)) { |
|---|
| 589 |
key = docFileXLink; |
|---|
| 590 |
xml = that.URLtoXMLDoc[key]; |
|---|
| 591 |
} |
|---|
| 592 |
else if (URLtoXMLDoc[fileXLinkAndXPath]) { |
|---|
| 593 |
key = fileXLinkAndXPath; |
|---|
| 594 |
xml = that.URLtoXMLDoc[fileXLinkAndXPath]; |
|---|
| 595 |
} |
|---|
| 596 |
} |
|---|
| 597 |
|
|---|
| 598 |
var node = XML.getNode(xml, currentXPath, null, xml); |
|---|
| 599 |
|
|---|
| 600 |
var newEl = brettz9.DOM.createElementNSwrapper('', 'dir', xml); |
|---|
| 601 |
node.parentNode.insertBefore(newEl, node.nextSibling); |
|---|
| 602 |
|
|---|
| 603 |
|
|---|
| 604 |
|
|---|
| 605 |
|
|---|
| 606 |
|
|---|
| 607 |
if (optval === '') {return;} |
|---|
| 608 |
option2.innerHTML = optval; |
|---|
| 609 |
option2.value = '(null)'; |
|---|
| 610 |
|
|---|
| 611 |
|
|---|
| 612 |
|
|---|
| 613 |
|
|---|
| 614 |
option.parentNode.insertBefore(option2, option.nextSibling); |
|---|
| 615 |
|
|---|
| 616 |
|
|---|
| 617 |
if (option.value === '(null)') { |
|---|
| 618 |
option.parentNode.removeChild(option); |
|---|
| 619 |
} |
|---|
| 620 |
|
|---|
| 621 |
|
|---|
| 622 |
|
|---|
| 623 |
|
|---|
| 624 |
} |
|---|
| 625 |
|
|---|
| 626 |
var newitem = document.getElementById('newitem'); |
|---|
| 627 |
for (var i=0; i < newitem.options.length; i++) { |
|---|
| 628 |
brettz9.DOM.addCommandEvent(newitem.options[i], _newItem); |
|---|
| 629 |
} |
|---|
| 630 |
var createitem = document.getElementById('createitem'); |
|---|
| 631 |
brettz9.DOM.addCommandEvent(createitem, _newItem); |
|---|
| 632 |
|
|---|
| 633 |
|
|---|
| 634 |
function _deleteItem (e) { |
|---|
| 635 |
|
|---|
| 636 |
var option = _colbrowser.currFocus.options[_colbrowser.currFocus.selectedIndex]; |
|---|
| 637 |
|
|---|
| 638 |
option.parentNode.removeChild(option); |
|---|
| 639 |
|
|---|
| 640 |
|
|---|
| 641 |
var currid = _colbrowser.currFocus.id.replace(new RegExp(that.colbrows_prfx), ''); |
|---|
| 642 |
if (_colbrowser.currFocus.options.length === 1) { |
|---|
| 643 |
currid--; |
|---|
| 644 |
} |
|---|
| 645 |
var origid = currid; |
|---|
| 646 |
var nextid; |
|---|
| 647 |
var nextcol = document.getElementById(that.colbrows_prfx + (++currid)); |
|---|
| 648 |
var selwidth = that.select_style_width; |
|---|
| 649 |
|
|---|
| 650 |
while (nextcol) { |
|---|
| 651 |
nextcol.parentNode.removeChild(nextcol); |
|---|
| 652 |
nextcol = document.getElementById(that.colbrows_prfx + (++currid)); |
|---|
| 653 |
that.select_style_left -= parseInt(selwidth.substr(0, selwidth.length-2), 10); |
|---|
| 654 |
} |
|---|
| 655 |
that.idCounter = origid; |
|---|
| 656 |
var currcol = document.getElementById(that.colbrows_prfx + (origid)); |
|---|
| 657 |
|
|---|
| 658 |
if (currcol) { |
|---|
| 659 |
currcol.focus(); |
|---|
| 660 |
_colbrowser.currFocus = currcol; |
|---|
| 661 |
} |
|---|
| 662 |
} |
|---|
| 663 |
var deleteitem = document.getElementById('deleteitem'); |
|---|
| 664 |
brettz9.DOM.addCommandEvent(deleteitem, _deleteItem); |
|---|
| 665 |
|
|---|
| 666 |
|
|---|
| 667 |
|
|---|
| 668 |
document.getElementById('colbrows_xmldocbox').value = this.xmlstring; |
|---|
| 669 |
|
|---|
| 670 |
|
|---|
| 671 |
|
|---|
| 672 |
|
|---|
| 673 |
this.InfoStrategy.populateAllInfo('show^embed^doc^this.xmlstring^', this.URLtoXMLDoc); |
|---|
| 674 |
|
|---|
| 675 |
|
|---|
| 676 |
this._buildCol(colbrows, false, 'show^embed^doc^this.xmlstring^'); |
|---|
| 677 |
|
|---|
| 678 |
|
|---|
| 679 |
|
|---|
| 680 |
colbrows.firstChild.selectedIndex = this.select_start_selindex; |
|---|
| 681 |
|
|---|
| 682 |
|
|---|
| 683 |
if (!noColViewHandlers) { |
|---|
| 684 |
colbrows.firstChild.focus(); |
|---|
| 685 |
} |
|---|
| 686 |
}; |
|---|
| 687 |
|
|---|
| 688 |
|
|---|
| 689 |
|
|---|
| 690 |
|
|---|
| 691 |
_colbrowser.prototype._buildCol = function (colbrows, col2rmv, fullXPathText, xml) { |
|---|
| 692 |
var that = this; |
|---|
| 693 |
|
|---|
| 694 |
|
|---|
| 695 |
var pattern = _colbrowser.XPathPlus; |
|---|
| 696 |
var doc = fullXPathText.match(pattern); |
|---|
| 697 |
if (doc) { |
|---|
| 698 |
|
|---|
| 699 |
var fileXLinkAndXPath = doc[3]+(doc[4]?doc[4]:''); |
|---|
| 700 |
var currentXPath = doc[6]; |
|---|
| 701 |
var newXPath = doc[5]; |
|---|
| 702 |
var fileXLink = doc[3]; |
|---|
| 703 |
var jsmatch = fileXLink.match(/(.*\.js)(\?.*)?$/); |
|---|
| 704 |
if (jsmatch) { |
|---|
| 705 |
var jslink = jsmatch[0]; |
|---|
| 706 |
var parsedfile = brettz9.URI.parse(jsmatch[2]).key.f; |
|---|
| 707 |
} |
|---|
| 708 |
} |
|---|
| 709 |
var hideHiddenFiles = false; |
|---|
| 710 |
if (document.getElementById('colbrowser_hide_hidden_files').checked) { |
|---|
| 711 |
hideHiddenFiles = true; |
|---|
| 712 |
} |
|---|
| 713 |
|
|---|
| 714 |
|
|---|
| 715 |
|
|---|
| 716 |
|
|---|
| 717 |
function _storeXMLPreparer (xmldoc) { |
|---|
| 718 |
that._storeXML(xmldoc, newXPath, fileXLinkAndXPath, jsmatch); |
|---|
| 719 |
} |
|---|
| 720 |
|
|---|
| 721 |
|
|---|
| 722 |
|
|---|
| 723 |
|
|---|
| 724 |
if (doc && fileXLinkAndXPath) { |
|---|
| 725 |
if (this.URLtoXMLDoc[fileXLinkAndXPath]) { |
|---|
| 726 |
xml = this.URLtoXMLDoc[fileXLinkAndXPath]; |
|---|
| 727 |
} |
|---|
| 728 |
else if (fileXLink.match(/^this\./)) { |
|---|
| 729 |
|
|---|
| 730 |
xml = this.xmlstring; |
|---|
| 731 |
xml = XML.parse(xml); |
|---|
| 732 |
this.URLtoXMLDoc[fileXLinkAndXPath] = xml; |
|---|
| 733 |
} |
|---|
| 734 |
else { |
|---|
| 735 |
if (_colbrowser.MOZ) { |
|---|
| 736 |
try { |
|---|
| 737 |
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserRead'); |
|---|
| 738 |
} |
|---|
| 739 |
catch (e) { |
|---|
| 740 |
alert("Permission UniversalBrowserRead denied. You must install this file and its attached scripts "+ |
|---|
| 741 |
"on your local drive and find 'file:///' references in the code and change to lead to XML "+ |
|---|
| 742 |
"files you wish to try out; for Firefox, you could type about:config in the URL window and set "+ |
|---|
| 743 |
"signed.applets.codebase_principal_support to true in Firefox or if in Explorer, go to Tools -> "+ |
|---|
| 744 |
"Options -> Security -> Custom Level -> ActiveX Controls and Plugins -> 'Initialize and script "+ |
|---|
| 745 |
"ActiveX control not marked as safe.' Miscellaneous -> 'Access data sources across domains' "+ |
|---|
| 746 |
"should also be marked as 'prompt' or 'enable'. Note that this may be less secure for your system!"); |
|---|
| 747 |
} |
|---|
| 748 |
} |
|---|
| 749 |
var fso, file, all; |
|---|
| 750 |
if (jsmatch) { |
|---|
| 751 |
if (fileXLink.match(/\.\w+$/)) {return;} |
|---|
| 752 |
var fileXLinkFileURL; |
|---|
| 753 |
if (_colbrowser.MSIE && fileXLink.indexOf('file://') === 0) { |
|---|
| 754 |
fso = new ActiveXObject('Scripting.FileSystemObject'); |
|---|
| 755 |
fileXLink = jsmatch[1]; |
|---|
| 756 |
fileXLinkFileURL = fileXLink.replace(/file\:\/\/\//g, '') |
|---|
| 757 |
if (_colbrowser.OS === 'Windows') { |
|---|
| 758 |
fileXLinkFileURL = fileXLinkFileURL.replace(/\//g, '\\'); |
|---|
| 759 |
} |
|---|
| 760 |
file = fso.OpenTextFile(fileXLinkFileURL, 1); |
|---|
| 761 |
|
|---|
| 762 |
all = file.ReadAll(); |
|---|
| 763 |
file.Close(); |
|---|
| 764 |
eval(all); |
|---|
| 765 |
_storeXMLPreparer(XML.parse(brettz9.XML.XMLOutput)); |
|---|
| 766 |
} |
|---|
| 767 |
else { |
|---|
| 768 |
HTTP.getText(fileXLink, _storeXMLPreparer, false); |
|---|
| 769 |
} |
|---|
| 770 |
} |
|---|
| 771 |
else if (_colbrowser.MSIE && fileXLink.indexOf('file://') === 0) { |
|---|
| 772 |
fso = new ActiveXObject('Scripting.FileSystemObject'); |
|---|
| 773 |
fileXLinkFileURL = fileXLink.replace(/file\:\/\/\//g, '') |
|---|
| 774 |
if (_colbrowser.OS === 'Windows') { |
|---|
| 775 |
fileXLinkFileURL = fileXLinkFileURL.replace(/\//g, '\\'); |
|---|
| 776 |
} |
|---|
| 777 |
file = fso.OpenTextFile(fileXLinkFileURL, 1 ); |
|---|
| 778 |
|
|---|
| 779 |
all = file.ReadAll(); |
|---|
| 780 |
file.Close(); |
|---|
| 781 |
_storeXMLPreparer(XML.parse(all)); |
|---|
| 782 |
} |
|---|
| 783 |
else { |
|---|
| 784 |
HTTP.getXML(fileXLink, _storeXMLPreparer, false); |
|---|
| 785 |
} |
|---|
| 786 |
|
|---|
| 787 |
xml = this.URLtoXMLDoc[fileXLinkAndXPath]; |
|---|
| 788 |
|
|---|
| 789 |
} |
|---|
| 790 |
|
|---|
| 791 |
} |
|---|
| 792 |
|
|---|
| 793 |
else if (typeof xml === 'string') { |
|---|
| 794 |
|
|---|
| 795 |
xml = XML.parse(xml); |
|---|
| 796 |
this.URLtoXMLDoc['show^embed^doc^this.xmlstring^'] = xml; |
|---|
| 797 |
} |
|---|
| 798 |
|
|---|
| 799 |
|
|---|
| 800 |
|
|---|
| 801 |
function _rightHandle (el, keyid, e) { |
|---|
| 802 |
that._rightHandle(el, keyid, e, xml); |
|---|
| 803 |
} |
|---|
| 804 |
|
|---|
| 805 |
|
|---|
| 806 |
|
|---|
| 807 |
|
|---|
| 808 |
|
|---|
| 809 |
function _ctrlShiftN (el, keyid, e) { |
|---|
| 810 |
that._ctrlShiftN(el, keyid, e); |
|---|
| 811 |
} |
|---|
| 812 |
function _deleteHandle (el, keyid, e) { |
|---|
| 813 |
that._deleteHandle(el, keyid, e); |
|---|
| 814 |
} |
|---|
| 815 |
function _endHandle (el, keyid, e) { |
|---|
| 816 |
that._endHandle(el, keyid, e); |
|---|
| 817 |
} |
|---|
| 818 |
function _homeHandle (el, keyid, e) { |
|---|
| 819 |
that._homeHandle(el, keyid, e); |
|---|
| 820 |
} |
|---|
| 821 |
function _pageDownHandle (el, keyid, e) { |
|---|
| 822 |
that._pageDownHandle(el, keyid, e); |
|---|
| 823 |
} |
|---|
| 824 |
function _pageUpHandle (el, keyid, e) { |
|---|
| 825 |
that._pageUpHandle(el, keyid, e); |
|---|
| 826 |
} |
|---|
| 827 |
function _returnHandle (el, keyid, e) { |
|---|
| 828 |
that._returnHandle(el, keyid, e); |
|---|
| 829 |
} |
|---|
| 830 |
function _downHandle (el, keyid, e) { |
|---|
| 831 |
that._downHandle(el, keyid, e); |
|---|
| 832 |
} |
|---|
| 833 |
function _upHandle (el, keyid, e) { |
|---|
| 834 |
that._upHandle(el, keyid, e); |
|---|
| 835 |
} |
|---|
| 836 |
function _leftHandle (el, keyid, e) { |
|---|
| 837 |
that._leftHandle(el, keyid, e); |
|---|
| 838 |
} |
|---|
| 839 |
|
|---|
| 840 |
var selwidth = this.select_style_width; |
|---|
| 841 |
|
|---|
| 842 |
|
|---|
| 843 |
if (col2rmv) { |
|---|
| 844 |
var num0 = parseInt(col2rmv.id.substr(this.colbrows_prfx.length), 10); |
|---|
| 845 |
++num0; |
|---|
| 846 |
var nextcolumn = document.getElementById(this.colbrows_prfx+num0); |
|---|
| 847 |
while (nextcolumn) { |
|---|
| 848 |
|
|---|
| 849 |
nextcolumn.parentNode.removeChild(nextcolumn); |
|---|
| 850 |
|
|---|
| 851 |
--this.idCounter; |
|---|
| 852 |
this.select_style_left -= parseInt(selwidth.substr(0, selwidth.length-2), 10); |
|---|
| 853 |
nextcolumn = document.getElementById(this.colbrows_prfx + (++num0)); |
|---|
| 854 |
} |
|---|
| 855 |
} |
|---|
| 856 |
|
|---|
| 857 |
|
|---|
| 858 |
|
|---|
| 859 |
|
|---|
| 860 |
|
|---|
| 861 |
|
|---|
| 862 |
|
|---|
| 863 |
|
|---|
| 864 |
|
|---|
| 865 |
|
|---|
| 866 |
|
|---|
| 867 |
|
|---|
| 868 |
|
|---|
| 869 |
|
|---|
| 870 |
|
|---|
| 871 |
|
|---|
| 872 |
|
|---|
| 873 |
|
|---|
| 874 |
|
|---|
| 875 |
|
|---|
| 876 |
|
|---|
| 877 |
|
|---|
| 878 |
|
|---|
| 879 |
|
|---|
| 880 |
|
|---|
| 881 |
|
|---|
| 882 |
|
|---|
| 883 |
|
|---|
| 884 |
|
|---|
| 885 |
|
|---|
| 886 |
|
|---|
| 887 |
var selectCol = brettz9.DOM.createElementNSwrapper(_colbrowser.HTMLNS, 'select'); |
|---|
| 888 |
selectCol.style.width = selwidth; |
|---|
| 889 |
selectCol.style.top = this.select_style_top; |
|---|
| 890 |
selectCol.style.left = this.select_style_left+'px'; |
|---|
| 891 |
this.select_style_left += parseInt(selwidth.substr(0, selwidth.length-2), 10); |
|---|
| 892 |
|
|---|
| 893 |
selectCol.setAttribute('multiple', 'multiple'); |
|---|
| 894 |
if (this.select_size) { |
|---|
| 895 |
selectCol.setAttribute('size', this.select_size); |
|---|
| 896 |
} |
|---|
| 897 |
selectCol.setAttribute(_colbrowser.CLASSATT, this.css_prfx+'col'); |
|---|
| 898 |
|
|---|
| 899 |
|
|---|
| 900 |
|
|---|
| 901 |
|
|---|
| 902 |
|
|---|
| 903 |
selectCol.setAttribute('id', this.colbrows_prfx + (++this.idCounter)); |
|---|
| 904 |
|
|---|
| 905 |
|
|---|
| 906 |
|
|---|
| 907 |
if (this.idCounter === 1) { |
|---|
| 908 |
_colbrowser.currFocus = selectCol; |
|---|
| 909 |
|
|---|
| 910 |
} |
|---|
| 911 |
|
|---|
| 912 |
|
|---|
| 913 |
if (this.tabIndex === true) { |
|---|
| 914 |
|
|---|
| 915 |
|
|---|
| 916 |
selectCol.setAttribute('tabindex', _colbrowser.colbrowsCount); |
|---|
| 917 |
this.tabIndex = false; |
|---|
| 918 |
} |
|---|
| 919 |
else if (this.tabIndex) { |
|---|
| 920 |
selectCol.setAttribute('tabindex', this.tabIndex); |
|---|
| 921 |
this.tabIndex = false; |
|---|
| 922 |
} |
|---|
| 923 |
|
|---|
| 924 |
|
|---|
| 925 |
|
|---|
| 926 |
|
|---|
| 927 |
var bindings = {ctrl_shift_n:_ctrlShiftN, "delete":_deleteHandle, end:_endHandle, |
|---|
| 928 |
home:_homeHandle, pagedown:_pageDownHandle, |
|---|
| 929 |
pageup:_pageUpHandle, returnname:_returnHandle, down:_downHandle, |
|---|
| 930 |
up:_upHandle, left:_leftHandle, right:_rightHandle}; |
|---|
| 931 |
var keymap = new Keymap(bindings); |
|---|
| 932 |
keymap.install(selectCol); |
|---|
| 933 |
|
|---|
| 934 |
|
|---|
| 935 |
selectCol = this._makeOptions(selectCol, xml, currentXPath); |
|---|
| 936 |
if (!selectCol) { |
|---|
| 937 |
|
|---|
| 938 |
|
|---|
| 939 |
|
|---|
| 940 |
|
|---|
| 941 |
|
|---|
| 942 |
return; |
|---|
| 943 |
} |
|---|
| 944 |
|
|---|
| 945 |
|
|---|
| 946 |
if (_colbrowser.MOZ) { |
|---|
| 947 |
|
|---|
| 948 |
|
|---|
| 949 |
|
|---|
| 950 |
var option2 = brettz9.DOM.createElementNSwrapper(_colbrowser.HTMLNS, 'option'); |
|---|
| 951 |
option2.setAttribute('style', 'display:none;'); |
|---|
| 952 |
option2.setAttribute('value', 'null'); |
|---|
| 953 |
selectCol.appendChild(option2); |
|---|
| 954 |
} |
|---|
| 955 |
|
|---|
| 956 |
|
|---|
| 957 |
function _selectClickPreparer (e) { |
|---|
| 958 |
that._selectClick(e, xml); |
|---|
| 959 |
} |
|---|
| 960 |
brettz9.DOM.addEvent(selectCol, 'click', _selectClickPreparer); |
|---|
| 961 |
|
|---|
| 962 |
function _selectChangePreparer (e) { |
|---|
| 963 |
that._selectChange(e, xml); |
|---|
| 964 |
} |
|---|
| 965 |
brettz9.DOM.addEvent(selectCol, 'change', _selectChangePreparer); |
|---|
| 966 |
|
|---|
| 967 |
|
|---|
| 968 |
colbrows.appendChild(selectCol); |
|---|
| 969 |
|
|---|
| 970 |
|
|---|
| 971 |
|
|---|
| 972 |
|
|---|
| 973 |
|
|---|
| 974 |
|
|---|
| 975 |
|
|---|
| 976 |
|
|---|
| 977 |
|
|---|
| 978 |
|
|---|
| 979 |
}; |
|---|
| 980 |
|
|---|
| 981 |
_colbrowser.prototype._makeOptions = function (select, xml, currentXPath) { |
|---|
| 982 |
|
|---|
| 983 |
var option; |
|---|
| 984 |
|
|---|
| 985 |
if (currentXPath !== '') { |
|---|
| 986 |
|
|---|
| 987 |
var notXlinkPath = currentXPath + '[@*[not((local-name() = "href" or local-name() = "type") and namespace-uri() = "http://www.w3.org/1999/xlink")]]'; |
|---|
| 988 |
var notXlinkEls = XML.getNodes(xml, notXlinkPath, null, xml); |
|---|
| 989 |
var notXlinkEl = notXlinkEls[0]; |
|---|
| 990 |
|
|---|
| 991 |
|
|---|
| 992 |
var xlinkPath = currentXPath + '[@*[(local-name() = "href" or local-name() = "type") and namespace-uri() = "http://www.w3.org/1999/xlink"]]'; |
|---|
| 993 |
var xlinkEls = XML.getNodes(xml, xlinkPath, null, xml); |
|---|
| 994 |
var xlinkEl = xlinkEls[0]; |
|---|
| 995 |
|
|---|
| 996 |
if (xlinkEl) { |
|---|
| 997 |
|
|---|
| 998 |
option = brettz9.DOM.createElementNSwrapper(_colbrowser.HTMLNS, 'option'); |
|---|
| 999 |
this.a++; |
|---|
| 1000 |
|
|---|
| 1001 |
|
|---|
| 1002 |
var xlinkselect = this.processXLinkType(xlinkEl, select, option, xml); |
|---|
| 1003 |
if (xlinkselect && xlinkselect.nodeName && xlinkselect.nodeName.toLowerCase() === 'select') { |
|---|
| 1004 |
return xlinkselect; |
|---|
| 1005 |
} |
|---|
| 1006 |
else if (xlinkselect) { |
|---|
| 1007 |
return false; |
|---|
| 1008 |
} |
|---|
| 1009 |
else { |
|---|
| 1010 |
alert('Unexpected error 7'); |
|---|
| 1011 |
} |
|---|
| 1012 |
} |
|---|
| 1013 |
} |
|---|
| 1014 |
|
|---|
| 1015 |
|
|---|
| 1016 |
|
|---|
| 1017 |
|
|---|
| 1018 |
var thislevel = XML.getNodes(xml, currentXPath+'/*', null, xml); |
|---|
| 1019 |
var thisitem = thislevel[0]; |
|---|
| 1020 |
var thisitemTextContent; |
|---|
| 1021 |
|
|---|
| 1022 |
|
|---|
| 1023 |
|
|---|
| 1024 |
|
|---|
| 1025 |
|
|---|
| 1026 |
if (!thisitem) { |
|---|
| 1027 |
|
|---|
| 1028 |
if (notXlinkEl) { |
|---|
| 1029 |
thisitem = notXlinkEl; |
|---|
| 1030 |
} |
|---|
| 1031 |
else { |
|---|
| 1032 |
if (!currentXPath) {currentXPath = '/*';} |
|---|
| 1033 |
thislevel = XML.getNodes(xml, currentXPath, null, xml); |
|---|
| 1034 |
thisitem = thislevel[0]; |
|---|
| 1035 |
|
|---|
| 1036 |
} |
|---|
| 1037 |
|
|---|
| 1038 |
|
|---|
| 1039 |
option = brettz9.DOM.createElementNSwrapper(_colbrowser.HTMLNS, 'option'); |
|---|
| 1040 |
thisitemTextContent = _colbrowser.MSIE ? thisitem.text : thisitem.textContent; |
|---|
| 1041 |
|
|---|
| 1042 |
option.innerHTML = '('+brettz9.XML.escapeString(thisitemTextContent)+')'; |
|---|
| 1043 |
option.value = '(null)'; |
|---|
| 1044 |
|
|---|
| 1045 |
|
|---|
| 1046 |
select.appendChild(option); |
|---|
| 1047 |
|
|---|
| 1048 |
return select; |
|---|
| 1049 |
} |
|---|
| 1050 |
|
|---|
| 1051 |
|
|---|
| 1052 |
for (var i = 0; i < thislevel.length; i++) { |
|---|
| 1053 |
thisitem = thislevel[i]; |
|---|
| 1054 |
option = brettz9.DOM.createElementNSwrapper(_colbrowser.HTMLNS, 'option'); |
|---|
| 1055 |
|
|---|
| 1056 |
|
|---|
| 1057 |
this.colDisplayStrategy.addColumnEntryName(option, thisitem); |
|---|
| 1058 |
this.colDisplayStrategy.addColumnEntryTitle(option, thisitem); |
|---|
| 1059 |
|
|---|
| 1060 |
|
|---|
| 1061 |
var xml_in_URLtoXML = brettz9.PHP.array_search(xml, this.URLtoXMLDoc); |
|---|
| 1062 |
var docval = xml_in_URLtoXML ? xml_in_URLtoXML : 'this.xmlstring'; |
|---|
| 1063 |
var thisxpath = brettz9.XPath.getXPathForElement(thisitem, xml); |
|---|
| 1064 |
|
|---|
| 1065 |
if (docval.match(/^show\^[^\^]*\^doc\^[^^]*\^$/)) { |
|---|
| 1066 |
|
|---|
| 1067 |
} |
|---|
| 1068 |
else { |
|---|
| 1069 |
option.value = 'show^embed^doc^'+docval+'^'+thisxpath; |
|---|
| 1070 |
} |
|---|
| 1071 |
|
|---|
| 1072 |
|
|---|
| 1073 |
select.appendChild(option); |
|---|
| 1074 |
} |
|---|
| 1075 |
return select; |
|---|
| 1076 |
}; |
|---|
| 1077 |
|
|---|
| 1078 |
_colbrowser.prototype.displayMedia = function (xlinkEl, attrs) { |
|---|
| 1079 |
|
|---|
| 1080 |
var href0 = brettz9.DOM.getAttributeNSWrapper(xlinkEl, _colbrowser.XLINKNS, 'href'); |
|---|
| 1081 |
|
|---|
| 1082 |
var imgmatch = href0.match(this.pattern_img); |
|---|
| 1083 |
var iframematch = href0.match(this.pattern_iframe); |
|---|
| 1084 |
var textmatch = href0.match(this.pattern_text); |
|---|
| 1085 |
var objmatch = href0.match(this.pattern_obj); |
|---|
| 1086 |
var mp3match = href0.match(this.pattern_mp3); |
|---|
| 1087 |
var parsedfile, addedEl, pfile, param, param2, param3, obj2; |
|---|
| 1088 |
var holder = document.getElementById('colbrows_img_display'); |
|---|
| 1089 |
|
|---|
| 1090 |
function getTextHandler (text) { |
|---|
| 1091 |
var textarea = brettz9.DOM.createElementNSwrapper(_colbrowser.HTMLNS, 'textarea'); |
|---|
| 1092 |
textarea.setAttribute('rows', 10); |
|---|
| 1093 |
textarea.setAttribute('cols', 40); |
|---|
| 1094 |
while (holder.childNodes.length > 0) { |
|---|
| 1095 |
holder.removeChild(holder.firstChild); |
|---|
| 1096 |
} |
|---|
| 1097 |
textarea.innerHTML = text; |
|---|
| 1098 |
holder.appendChild(textarea); |
|---|
| 1099 |
} |
|---|
| 1100 |
|
|---|
| 1101 |
function parsedFileReplace(parsedfile) { |
|---|
| 1102 |
var unslashed = parsedfile; |
|---|
| 1103 |
if (_colbrowser.OS === 'Windows') { |
|---|
| 1104 |
unslashed = parsedfile.replace(/\\/g, '/'); |
|---|
| 1105 |
} |
|---|
| 1106 |
return (!parsedfile.match(/^file:\/\/\/?/)?'file: |
|---|
| 1107 |
} |
|---|
| 1108 |
|
|---|
| 1109 |
if (imgmatch) { |
|---|
| 1110 |
parsedfile = brettz9.URI.parse(imgmatch[2]).key.f; |
|---|
| 1111 |
addedEl = brettz9.DOM.createElementNSwrapper(_colbrowser.HTMLNS, 'img'); |
|---|
| 1112 |
addedEl.setAttribute('src', parsedFileReplace(parsedfile)); |
|---|
| 1113 |
addedEl.setAttribute('height', 500*7/16); |
|---|
| 1114 |
addedEl.setAttribute('width', 500*9/16); |
|---|
| 1115 |
} |
|---|
| 1116 |
else if (mp3match) { |
|---|
| 1117 |
parsedfile = brettz9.URI.parse(mp3match[2]).key.f; |
|---|
| 1118 |
pfile = parsedFileReplace(parsedfile); |
|---|
| 1119 |
addedEl = brettz9.DOM.createElementNSwrapper(_colbrowser.HTMLNS, 'object'); |
|---|
| 1120 |
addedEl.setAttribute('classid', 'clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B'); |
|---|
| 1121 |
addedEl.setAttribute('codebase', 'http://www.apple.com/qtactivex/qtplugin.cab'); |
|---|
| 1122 |
addedEl.setAttribute('width', '200'); |
|---|
| 1123 |
addedEl.setAttribute('height', '16'); |
|---|
| 1124 |
|
|---|
| 1125 |
obj2 = brettz9.DOM.createElementNSwrapper(_colbrowser.HTMLNS, 'object'); |
|---|
| 1126 |
obj2.setAttribute('data', pfile); |
|---|
| 1127 |
obj2.setAttribute('type', 'audio/x-mpeg'); |
|---|
| 1128 |
obj2.setAttribute('width', '200'); |
|---|
| 1129 |
obj2.setAttribute('height', '16'); |
|---|
| 1130 |
|
|---|
| 1131 |
|
|---|
| 1132 |
param = brettz9.DOM.createElementNSwrapper(_colbrowser.HTMLNS, 'param'); |
|---|
| 1133 |
param.setAttribute('name', 'autostart'); |
|---|
| 1134 |
param.setAttribute('value', '0'); |
|---|
| 1135 |
param2 = brettz9.DOM.createElementNSwrapper(_colbrowser.HTMLNS, 'param'); |
|---|
| 1136 |
param2.setAttribute('name', 'autoplay'); |
|---|
| 1137 |
param2.setAttribute('value', 'false'); |
|---|
| 1138 |
param3 = brettz9.DOM.createElementNSwrapper(_colbrowser.HTMLNS, 'param'); |
|---|
| 1139 |
param3.setAttribute('name', 'controller'); |
|---|
| 1140 |
param3.setAttribute('value', 'true'); |
|---|
| 1141 |
var param4 = brettz9.DOM.createElementNSwrapper(_colbrowser.HTMLNS, 'param'); |
|---|
| 1142 |
param4.setAttribute('name', 'src'); |
|---|
| 1143 |
param4.setAttribute('value', pfile); |
|---|
| 1144 |
var param5 = brettz9.DOM.createElementNSwrapper(_colbrowser.HTMLNS, 'param'); |
|---|
| 1145 |
param5.setAttribute('name', 'pluginspage'); |
|---|
| 1146 |
param5.setAttribute('value', 'http://www.apple.com/quicktime/download'); |
|---|
| 1147 |
|
|---|
| 1148 |
addedEl.appendChild(param); |
|---|
| 1149 |
addedEl.appendChild(param2); |
|---|
| 1150 |
addedEl.appendChild(param3); |
|---|
| 1151 |
addedEl.appendChild(param4); |
|---|
| 1152 |
addedEl.appendChild(param5); |
|---|
| 1153 |
|
|---|
| 1154 |
} |
|---|
| 1155 |
else if (objmatch) { |
|---|
| 1156 |
parsedfile = brettz9.URI.parse(objmatch[2]).key.f; |
|---|
| 1157 |
|
|---|
| 1158 |
pfile = parsedFileReplace(parsedfile); |
|---|
| 1159 |
|
|---|
| 1160 |
|
|---|
| 1161 |
addedEl = brettz9.DOM.createElementNSwrapper(_colbrowser.HTMLNS, 'object'); |
|---|
| 1162 |
addedEl.setAttribute('classid', 'clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B'); |
|---|
| 1163 |
addedEl.setAttribute('codebase', 'http://www.apple.com/qtactivex/qtplugin.cab'); |
|---|
| 1164 |
addedEl.setAttribute('width', 320); |
|---|
| 1165 |
addedEl.setAttribute('height', 260); |
|---|
| 1166 |
|
|---|
| 1167 |
param = brettz9.DOM.createElementNSwrapper(_colbrowser.HTMLNS, 'param'); |
|---|
| 1168 |
param.setAttribute('name', 'src'); |
|---|
| 1169 |
param.setAttribute('value', pfile); |
|---|
| 1170 |
param2 = brettz9.DOM.createElementNSwrapper(_colbrowser.HTMLNS, 'param'); |
|---|
| 1171 |
param2.setAttribute('name', 'controller'); |
|---|
| 1172 |
param2.setAttribute('value', 'true'); |
|---|
| 1173 |
param3 = brettz9.DOM.createElementNSwrapper(_colbrowser.HTMLNS, 'param'); |
|---|
| 1174 |
param3.setAttribute('name', 'autoplay'); |
|---|
| 1175 |
param3.setAttribute('value', 'true'); |
|---|
| 1176 |
|
|---|
| 1177 |
obj2 = brettz9.DOM.createElementNSwrapper(_colbrowser.HTMLNS, 'embed'); |
|---|
| 1178 |
obj2.setAttribute('src', pfile); |
|---|
| 1179 |
obj2.setAttribute('width', 320); |
|---|
| 1180 |
obj2.setAttribute('height', 260); |
|---|
| 1181 |
obj2.setAttribute('autoplay', 'true'); |
|---|
| 1182 |
obj2.setAttribute('controller', 'true'); |
|---|
| 1183 |
obj2.setAttribute('pluginspage', 'http://www.apple.com/quicktime/download/'); |
|---|
| 1184 |
|
|---|
| 1185 |
|
|---|
| 1186 |
|
|---|
| 1187 |
|
|---|
| 1188 |
|
|---|
| 1189 |
|
|---|
| 1190 |
|
|---|
| 1191 |
|
|---|
| 1192 |
|
|---|
| 1193 |
|
|---|
| 1194 |
|
|---|
| 1195 |
|
|---|
| 1196 |
|
|---|
| 1197 |
|
|---|
| 1198 |
|
|---|
| 1199 |
|
|---|
| 1200 |
|
|---|
| 1201 |
|
|---|
| 1202 |
|
|---|
| 1203 |
|
|---|
| 1204 |
|
|---|
| 1205 |
|
|---|
| 1206 |
|
|---|
| 1207 |
addedEl.appendChild(param); |
|---|
| 1208 |
addedEl.appendChild(param2); |
|---|
| 1209 |
addedEl.appendChild(param3); |
|---|
| 1210 |
addedEl.appendChild(obj2); |
|---|
| 1211 |
|
|---|
| 1212 |
} |
|---|
| 1213 |
else if (iframematch) { |
|---|
| 1214 |
parsedfile = brettz9.URI.parse(iframematch[2]).key.f; |
|---|
| 1215 |
addedEl = brettz9.DOM.createElementNSwrapper(_colbrowser.HTMLNS, 'iframe'); |
|---|
| 1216 |
addedEl.setAttribute('src', parsedFileReplace(parsedfile)); |
|---|
| 1217 |
addedEl.setAttribute('height', 600*7/16); |
|---|
| 1218 |
addedEl.setAttribute('width', 600*9/16); |
|---|
| 1219 |
} |
|---|
| 1220 |
else if (textmatch) { |
|---|
| 1221 |
parsedfile = brettz9.URI.parse(textmatch[2]).key.f; |
|---|
| 1222 |
if (_colbrowser.MOZ) { |
|---|
| 1223 |
try { |
|---|
| 1224 |
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserRead'); |
|---|
| 1225 |
} |
|---|
| 1226 |
catch (e) { |
|---|
| 1227 |
alert("Permission UniversalBrowserRead denied. You must install this file and its attached scripts "+ |
|---|
| 1228 |
"on your local drive and find 'file:///' references in the code and change to lead to XML "+ |
|---|
| 1229 |
"files you wish to try out; for Firefox, you could type about:config in the URL window and set "+ |
|---|
| 1230 |
"signed.applets.codebase_principal_support to true in Firefox or if in Explorer, go to Tools -> "+ |
|---|
| 1231 |
"Options -> Security -> Custom Level -> ActiveX Controls and Plugins -> 'Initialize and script "+ |
|---|
| 1232 |
"ActiveX control not marked as safe.' Miscellaneous -> 'Access data sources across domains' "+ |
|---|
| 1233 |
"should also be marked as 'prompt' or 'enable'. Note that this may be less secure for your system!"); |
|---|
| 1234 |
} |
|---|
| 1235 |
} |
|---|
| 1236 |
|
|---|
| 1237 |
|
|---|
| 1238 |
|
|---|
| 1239 |
var gettextfile = parsedFileReplace(parsedfile); |
|---|
| 1240 |
if (_colbrowser.MSIE) { |
|---|
| 1241 |
try { |
|---|
| 1242 |
var fso = new ActiveXObject('Scripting.FileSystemObject'); |
|---|
| 1243 |
var file = fso.OpenTextFile(parsedfile, 1 ); |
|---|
| 1244 |
|
|---|
| 1245 |
|
|---|
| 1246 |
var all = file.ReadAll(); |
|---|
| 1247 |
file.Close(); |
|---|
| 1248 |
getTextHandler(all); |
|---|
| 1249 |
} |
|---|
| 1250 |
catch (e) { |
|---|
| 1251 |
|
|---|
| 1252 |
} |
|---|
| 1253 |
} |
|---|
| 1254 |
else { |
|---|
| 1255 |
HTTP.getText(gettextfile, getTextHandler, false); |
|---|
| 1256 |
} |
|---|
| 1257 |
} |
|---|
| 1258 |
if (addedEl) { |
|---|
| 1259 |
while (holder.childNodes.length > 0) { |
|---|
| 1260 |
holder.removeChild(holder.firstChild); |
|---|
| 1261 |
} |
|---|
| 1262 |
holder.appendChild(addedEl); |
|---|
| 1263 |
} |
|---|
| 1264 |
}; |
|---|
| 1265 |
|
|---|
| 1266 |
_colbrowser.prototype.getXLinkAttributes = function (xlinkEl) { |
|---|
| 1267 |
|
|---|
| 1268 |
|
|---|
| 1269 |
var attrs = {}; |
|---|
| 1270 |
|
|---|
| 1271 |
|
|---|
| 1272 |
var href = brettz9.DOM.getAttributeNSWrapper(xlinkEl, _colbrowser.XLINKNS, 'href'); |
|---|
| 1273 |
attrs.href = href ? href : ''; |
|---|
| 1274 |
|
|---|
| 1275 |
|
|---|
| 1276 |
|
|---|
| 1277 |
|
|---|
| 1278 |
var type = brettz9.DOM.getAttributeNSWrapper(xlinkEl, _colbrowser.XLINKNS, 'type'); |
|---|
| 1279 |
if (!type && !href) { |
|---|
| 1280 |
alert('The XLink element submitted to processXLinkType() must have a @type or an @href attribute.'); |
|---|
| 1281 |
return false; |
|---|
| 1282 |
} |
|---|
| 1283 |
attrs.type = type = type ? type : 'simple'; |
|---|
| 1284 |
if (href && type !== 'simple' && type !== 'locator') { |
|---|
| 1285 |
alert('You cannot have an @href attribute on any XLink besides a simple or locator type one.'); |
|---|
| 1286 |
return false; |
|---|
| 1287 |
} |
|---|
| 1288 |
|
|---|
| 1289 |
|
|---|
| 1290 |
|
|---|
| 1291 |
|
|---|
| 1292 |
|
|---|
| 1293 |
|
|---|
| 1294 |
|
|---|
| 1295 |
if (type === 'simple' || type === 'extended' || type === 'locator' || type === 'resource' || type === 'arc') { |
|---|
| 1296 |
var title = brettz9.DOM.getAttributeNSWrapper(xlinkEl, _colbrowser.XLINKNS, 'title'); |
|---|
| 1297 |
attrs.title = title ? title : ''; |
|---|
| 1298 |
if (type !== 'arc') { |
|---|
| 1299 |
|
|---|
| 1300 |
var role = brettz9.DOM.getAttributeNSWrapper(xlinkEl, _colbrowser.XLINKNS, 'role'); |
|---|
| 1301 |
attrs.role = role ? role : ''; |
|---|
| 1302 |
} |
|---|
| 1303 |
if (type === 'simple' || type === 'arc') { |
|---|
| 1304 |
var actuate = brettz9.DOM.getAttributeNSWrapper(xlinkEl, _colbrowser.XLINKNS, 'actuate'); |
|---|
| 1305 |
attrs.actuate = actuate ? actuate : ''; |
|---|
| 1306 |
var show = brettz9.DOM.getAttributeNSWrapper(xlinkEl, _colbrowser.XLINKNS, 'show'); |
|---|
| 1307 |
attrs.show = show ? show : ''; |
|---|
| 1308 |
var arcrole = brettz9.DOM.getAttributeNSWrapper(xlinkEl, _colbrowser.XLINKNS, 'arcrole'); |
|---|
| 1309 |
attrs.arcrole = arcrole ? arcrole : ''; |
|---|
| 1310 |
if (type === 'arc') { |
|---|
| 1311 |
var from = brettz9.DOM.getAttributeNSWrapper(xlinkEl, _colbrowser.XLINKNS, 'from'); |
|---|
| 1312 |
attrs.from = from ? from : ''; |
|---|
| 1313 |
var to = brettz9.DOM.getAttributeNSWrapper(xlinkEl, _colbrowser.XLINKNS, 'to'); |
|---|
| 1314 |
attrs.to = to ? to : ''; |
|---|
| 1315 |
} |
|---|
| 1316 |
} |
|---|
| 1317 |
else if (type === 'locator' || type === 'resource') { |
|---|
| 1318 |
var label = brettz9.DOM.getAttributeNSWrapper(xlinkEl, _colbrowser.XLINKNS, 'label'); |
|---|
| 1319 |
attrs.label = label ? label : ''; |
|---|
| 1320 |
} |
|---|
| 1321 |
} |
|---|
| 1322 |
return attrs; |
|---|
| 1323 |
}; |
|---|
| 1324 |
_colbrowser.prototype.processXLinkType = function (xlinkEl, select, option, xml) { |
|---|
| 1325 |
var attrs = this.getXLinkAttributes(xlinkEl); |
|---|
| 1326 |
var type = attrs.type; |
|---|
| 1327 |
|
|---|
| 1328 |
switch (type) { |
|---|
| 1329 |
|
|---|
| 1330 |
case 'simple': |
|---|
| 1331 |
|
|---|
| 1332 |
return this.processXLinkTypeSimple(xlinkEl, attrs, select, option, xml); |
|---|
| 1333 |
break; |
|---|
| 1334 |
case 'arc': |
|---|
| 1335 |
|
|---|
| 1336 |
return this.processXLinkTypeArc(xlinkEl, attrs, select, option, xml); |
|---|
| 1337 |
|
|---|
| 1338 |
case 'extended': |
|---|
| 1339 |
|
|---|
| 1340 |
case 'title': |
|---|
| 1341 |
|
|---|
| 1342 |
|
|---|
| 1343 |
|
|---|
| 1344 |
var optionhtml = ''; |
|---|
| 1345 |
for (var i=0; i < xlinkEl.childNodes.length; i++) { |
|---|
| 1346 |
optionhtml += XML.serialize(xlinkEl.childNodes.item(i)); |
|---|
| 1347 |
} |
|---|
| 1348 |
if (_colbrowser.MSIE) { |
|---|
| 1349 |
optionhtml = optionhtml.replace(/\<[^>]*\>/g, ''); |
|---|
| 1350 |
} |
|---|
| 1351 |
|
|---|
| 1352 |
option.innerHTML = optionhtml; |
|---|
| 1353 |
option.value = '(null)'; |
|---|
| 1354 |
|
|---|
| 1355 |
|
|---|
| 1356 |
select.appendChild(option); |
|---|
| 1357 |
|
|---|
| 1358 |
|
|---|
| 1359 |
|
|---|
| 1360 |
return select; |
|---|
| 1361 |
case 'resource': |
|---|
| 1362 |
|
|---|
| 1363 |
case 'locator': |
|---|
| 1364 |
|
|---|
| 1365 |
alert('The '+type+' XLink link type is not currently supported but will be treated as a simple link'); |
|---|
| 1366 |
break; |
|---|
| 1367 |
default: |
|---|
| 1368 |
alert('Invalid XLink type value'); |
|---|
| 1369 |
break; |
|---|
| 1370 |
} |
|---|
| 1371 |
return false; |
|---|
| 1372 |
}; |
|---|
| 1373 |
_colbrowser.prototype.processXLinkTypeSimple = function (xlinkEl, attrs, select, option, xml) { |
|---|
| 1374 |
return this.processXLinkActuate(xlinkEl, attrs, select, option, xml); |
|---|
| 1375 |
}; |
|---|
| 1376 |
_colbrowser.prototype.processXLinkTypeArc = function (xlinkEl, attrs, select, option, xml) { |
|---|
| 1377 |
|
|---|
| 1378 |
return this.processXLinkActuate(xlinkEl, attrs, select, option, xml); |
|---|
| 1379 |
}; |
|---|
| 1380 |
_colbrowser.prototype.processXLinkActuate = function (xlinkEl, attrs, select, option, xml) { |
|---|
| 1381 |
var actuate = attrs.actuate; |
|---|
| 1382 |
|
|---|
| 1383 |
switch (actuate) { |
|---|
| 1384 |
case 'onRequest': |
|---|
| 1385 |
return this.processXLinkActuateOnRequest(xlinkEl, attrs, select, option); |
|---|
| 1386 |
break; |
|---|
| 1387 |
case 'other': |
|---|
| 1388 |
|
|---|
| 1389 |
|
|---|
| 1390 |
|
|---|
| 1391 |
|
|---|
| 1392 |
|
|---|
| 1393 |
|
|---|
| 1394 |
|
|---|
| 1395 |
|
|---|
| 1396 |
break; |
|---|
| 1397 |
case undefined: |
|---|
| 1398 |
case '': |
|---|
| 1399 |
|
|---|
| 1400 |
case 'none': |
|---|
| 1401 |
|
|---|
| 1402 |
case 'onLoad': |
|---|
| 1403 |
|
|---|
| 1404 |
|
|---|
| 1405 |
return this.processXLinkActuateOnLoad(xlinkEl, attrs, select, option, xml); |
|---|
| 1406 |
break; |
|---|
| 1407 |
default : |
|---|
| 1408 |
alert('Invalid XLink actuate value'); |
|---|
| 1409 |
break; |
|---|
| 1410 |
} |
|---|
| 1411 |
return false; |
|---|
| 1412 |
}; |
|---|
| 1413 |
_colbrowser.prototype.processXLinkActuateOnRequest = function (xlinkEl, attrs, select, option) { |
|---|
| 1414 |
|
|---|
| 1415 |
var type = attrs.type, |
|---|
| 1416 |
href = attrs.href, |
|---|
| 1417 |
title = attrs.title, |
|---|
| 1418 |
role = attrs.role, |
|---|
| 1419 |
arcrole = attrs.arcrole, |
|---|
| 1420 |
show = attrs.show; |
|---|
| 1421 |
|
|---|
| 1422 |
if (type === 'arc') { |
|---|
| 1423 |
alert('Arcs not supported yet'); |
|---|
| 1424 |
return false; |
|---|
| 1425 |
} |
|---|
| 1426 |
|
|---|
| 1427 |
|
|---|
| 1428 |
var introtitle = ((title === '') ? '' : ': '+ title); |
|---|
| 1429 |
var introarcrole = arcrole ? 'Arcrole: '+arcrole : 'Arcrole: none'; |
|---|
| 1430 |
var introrole = role ? 'Role: '+role+';' : 'Role: none;'; |
|---|
| 1431 |
var introhref = href ? 'href: '+ href : 'href: none;'; |
|---|
| 1432 |
|
|---|
| 1433 |
|
|---|
| 1434 |
option.innerHTML = '[['+type+' XLink'+introtitle+']]'; |
|---|
| 1435 |
|
|---|
| 1436 |
|
|---|
| 1437 |
option.title = introhref+'; \n\n'+introrole+' \n\n'+introarcrole+ '; \n\nTitle'+ introtitle; |
|---|
| 1438 |
option.setAttribute(_colbrowser.CLASSATT, 'xlink-'+type); |
|---|
| 1439 |
|
|---|
| 1440 |
|
|---|
| 1441 |
var fullxlink = brettz9.DOM.getXmlBaseLink ( href, |
|---|
| 1442 |
xlinkEl); |
|---|
| 1443 |
option.value = 'show^'+show+'^doc^'+fullxlink+'^'; |
|---|
| 1444 |
|
|---|
| 1445 |
|
|---|
| 1446 |
|
|---|
| 1447 |
if (fullxlink.match(/#xpath1\(/)) { |
|---|
| 1448 |
option.value += '/holder'; |
|---|
| 1449 |
} |
|---|
| 1450 |
|
|---|
| 1451 |
|
|---|
| 1452 |
select.appendChild(option); |
|---|
| 1453 |
return select; |
|---|
| 1454 |
}; |
|---|
| 1455 |
_colbrowser.prototype.processXLinkActuateOnLoad = function (xlinkEl, attrs, select, option, xml) { |
|---|
| 1456 |
if (attrs.type === 'arc') { |
|---|
| 1457 |
alert('Arcs not supported yet'); |
|---|
| 1458 |
return false; |
|---|
| 1459 |
} |
|---|
| 1460 |
return this.processXLinkShow(xlinkEl, attrs, select, option, xml); |
|---|
| 1461 |
}; |
|---|
| 1462 |
|
|---|
| 1463 |
_colbrowser.prototype.processXLinkShow = function (xlinkEl, attrs, select, option, xml) { |
|---|
| 1464 |
var show = attrs.show; |
|---|
| 1465 |
|
|---|
| 1466 |
|
|---|
| 1467 |
switch (show) { |
|---|
| 1468 |
case 'new': |
|---|
| 1469 |
this.processXLinkShowNew(xlinkEl, attrs); |
|---|
| 1470 |
break; |
|---|
| 1471 |
case 'replace': |
|---|
| 1472 |
this.processXLinkShowReplace(xlinkEl, attrs); |
|---|
| 1473 |
break; |
|---|
| 1474 |
case 'other': |
|---|
| 1475 |
return this.processXLinkShowOther(xlinkEl, attrs, select, option); |
|---|
| 1476 |
break; |
|---|
| 1477 |
case undefined: |
|---|
| 1478 |
case '': |
|---|
| 1479 |
return this.processXLinkShowEMPTY(xlinkEl, attrs, select, option, xml); |
|---|
| 1480 |
break; |
|---|
| 1481 |
case 'none': |
|---|
| 1482 |
this.processXLinkShowNone(xlinkEl, attrs, select, option, xml); |
|---|
| 1483 |
break; |
|---|
| 1484 |
case 'embed': |
|---|
| 1485 |
return this.processXLinkShowEmbed(xlinkEl, attrs, select, option, xml); |
|---|
| 1486 |
break; |
|---|
| 1487 |
default : |
|---|
| 1488 |
alert('Invalid XLink show value'); |
|---|
| 1489 |
break; |
|---|
| 1490 |
} |
|---|
| 1491 |
return false; |
|---|
| 1492 |
}; |
|---|
| 1493 |
_colbrowser.prototype.processXLinkShowNew = function (xlinkEl, attrs) { |
|---|
| 1494 |
window.open(attrs.href); |
|---|
| 1495 |
}; |
|---|
| 1496 |
_colbrowser.prototype.processXLinkShowReplace = function (xlinkEl, attrs) { |
|---|
| 1497 |
window.location.href = attrs.href; |
|---|
| 1498 |
}; |
|---|
| 1499 |
_colbrowser.prototype.processXLinkShowEmbed = function (xlinkEl, attrs, select, option, xml) { |
|---|
| 1500 |
var href = attrs.href; |
|---|
| 1501 |
var colbrows = document.getElementById(this.colbrows_prfx+this.colbrows_suffix); |
|---|
| 1502 |
var selwidth = this.select_style_width; |
|---|
| 1503 |
|
|---|
| 1504 |
|
|---|
| 1505 |
|
|---|
| 1506 |
var fullxlink = brettz9.DOM.getXmlBaseLink ( href, |
|---|
| 1507 |
xlinkEl); |
|---|
| 1508 |
|
|---|
| 1509 |
if (href.match(/\.\w+$/) && fullxlink.match(/file:\/\//)) { |
|---|
| 1510 |
select.setAttribute('multiple', 'multiple'); |
|---|
| 1511 |
if (this.select_size) { |
|---|
| 1512 |
select.setAttribute('size', this.select_size); |
|---|
| 1513 |
} |
|---|
| 1514 |
select.setAttribute(_colbrowser.CLASSATT, this.css_prfx+'col'); |
|---|
| 1515 |
|
|---|
| 1516 |
select.style.width = selwidth; |
|---|
| 1517 |
select.style.top = this.select_style_top; |
|---|
| 1518 |
select.style.left = (this.select_style_left - parseInt(selwidth.substr(0, selwidth.length-2), 10) ) +'px'; |
|---|
| 1519 |
this.select_style_left += parseInt(selwidth.substr(0, selwidth.length-2), 10); |
|---|
| 1520 |
select.setAttribute('id', this.colbrows_prfx + (this.idCounter)); |
|---|
| 1521 |
++this.idCounter; |
|---|
| 1522 |
|
|---|
| 1523 |
option.innerHTML = '('+brettz9.XML.escapeString('File')+')'; |
|---|
| 1524 |
option.value = '(null)'; |
|---|
| 1525 |
select.appendChild(option); |
|---|
| 1526 |
} |
|---|
| 1527 |
|
|---|
| 1528 |
var fullxlinkText = 'show^embed^doc^'+fullxlink+'^'; |
|---|
| 1529 |
|
|---|
| 1530 |
if (fullxlinkText.match(/#xpath1\(/) || fullxlinkText.match(/dirGen\.js/)) { |
|---|
| 1531 |
fullxlinkText += '/holder'; |
|---|
| 1532 |
} |
|---|
| 1533 |
|
|---|
| 1534 |
|
|---|
| 1535 |
|
|---|
| 1536 |
--this.idCounter; |
|---|
| 1537 |
this.select_style_left -= parseInt(selwidth.substr(0, selwidth.length-2), 10); |
|---|
| 1538 |
|
|---|
| 1539 |
if (!href.match(/\.\w+$/) || !fullxlink.match(/file:\/\//)) { |
|---|
| 1540 |
this._buildCol(colbrows, false, fullxlinkText, xml); |
|---|
| 1541 |
} |
|---|
| 1542 |
else { |
|---|
| 1543 |
colbrows.appendChild(select); |
|---|
| 1544 |
} |
|---|
| 1545 |
|
|---|
| 1546 |
this.displayMedia(xlinkEl, attrs); |
|---|
| 1547 |
return true; |
|---|
| 1548 |
}; |
|---|
| 1549 |
_colbrowser.prototype.processXLinkShowOther = function (xlinkEl, attrs, select, option) { |
|---|
| 1550 |
|
|---|
| 1551 |
|
|---|
| 1552 |
this.processXLinkShowNew(xlinkEl, attrs); |
|---|
| 1553 |
return this.processXLinkShowEmbed(xlinkEl, attrs, select, option); |
|---|
| 1554 |
}; |
|---|
| 1555 |
_colbrowser.prototype.processXLinkShowNone = function (xlinkEl, attrs, select, option, xml) { |
|---|
| 1556 |
|
|---|
| 1557 |
this.processXLinkShowEmbed(xlinkEl, attrs, select, option, xml); |
|---|
| 1558 |
}; |
|---|
| 1559 |
_colbrowser.prototype.processXLinkShowEMPTY = function (xlinkEl, attrs, select, option, xml) { |
|---|
| 1560 |
|
|---|
| 1561 |
return this.processXLinkShowEmbed(xlinkEl, attrs, select, option, xml); |
|---|
| 1562 |
}; |
|---|
| 1563 |
|
|---|
| 1564 |
|
|---|
| 1565 |
|
|---|
| 1566 |
_colbrowser.prototype._storeXML = function (xmldoc, newXPath, fileXLinkAndXPath, jsmatch) { |
|---|
| 1567 |
var docu; |
|---|
| 1568 |
var hideHiddenFiles = false; |
|---|
| 1569 |
if (document.getElementById('colbrowser_hide_hidden_files').checked) { |
|---|
| 1570 |
hideHiddenFiles = true; |
|---|
| 1571 |
} |
|---|
| 1572 |
|
|---|
| 1573 |
if (typeof xmldoc === 'number') { |
|---|
| 1574 |
throw (new Error('HTTP Error code '+xmldoc)); |
|---|
| 1575 |
return; |
|---|
| 1576 |
} |
|---|
| 1577 |
else if (typeof xmldoc === 'string') { |
|---|
| 1578 |
if (jsmatch) { |
|---|
| 1579 |
var jslink = jsmatch[0]; |
|---|
| 1580 |
var parsedfile = brettz9.URI.parse(jsmatch[2]).key.f; |
|---|
| 1581 |
} |
|---|
| 1582 |
eval(xmldoc); |
|---|
| 1583 |
xmldoc = XML.parse(brettz9.XML.XMLOutput); |
|---|
| 1584 |
} |
|---|
| 1585 |
|
|---|
| 1586 |
|
|---|
| 1587 |
|
|---|
| 1588 |
|
|---|
| 1589 |
|
|---|
| 1590 |
|
|---|
| 1591 |
if (newXPath) { |
|---|
| 1592 |
|
|---|
| 1593 |
var xmlToImport = XML.getNodes(xmldoc, newXPath, null, xmldoc); |
|---|
| 1594 |
if (document.implementation && document.implementation.createDocument) { |
|---|
| 1595 |
docu = document.implementation.createDocument('', '', null); |
|---|
| 1596 |
|
|---|
| 1597 |
} |
|---|
| 1598 |
else { |
|---|
| 1599 |
docu = new ActiveXObject("Microsoft.XMLDOM"); |
|---|
| 1600 |
} |
|---|
| 1601 |
try { |
|---|
| 1602 |
|
|---|
| 1603 |
var holder = brettz9.DOM.createElementNSwrapper('', 'holder', docu); |
|---|
| 1604 |
for (var clone, i=0; i < xmlToImport.length; i++) { |
|---|
| 1605 |
|
|---|
| 1606 |
clone = brettz9.DOM.importNode(xmlToImport[i], true, docu); |
|---|
| 1607 |
holder.appendChild(clone); |
|---|
| 1608 |
} |
|---|
| 1609 |
docu.appendChild(holder); |
|---|
| 1610 |
|
|---|
| 1611 |
} catch (e) { |
|---|
| 1612 |
alert('4:'+e.message?e.message:e); |
|---|
| 1613 |
} |
|---|
| 1614 |
} |
|---|
| 1615 |
else { |
|---|
| 1616 |
docu = xmldoc; |
|---|
| 1617 |
} |
|---|
| 1618 |
|
|---|
| 1619 |
docu = brettz9.DOM.resolveXIncludes(docu); |
|---|
| 1620 |
|
|---|
| 1621 |
this.URLtoXMLDoc[fileXLinkAndXPath] = docu; |
|---|
| 1622 |
}; |
|---|
| 1623 |
|
|---|
| 1624 |
|
|---|
| 1625 |
|
|---|
| 1626 |
|
|---|
| 1627 |
|
|---|
| 1628 |
_colbrowser.prototype._rightHandle = function (el, keyid, e, xml) { |
|---|
| 1629 |
var targ = _colbrowser.MSIE ? e.srcElement : e.target; |
|---|
| 1630 |
|
|---|
| 1631 |
|
|---|
| 1632 |
if (targ.value === '(null)') { |
|---|
| 1633 |
return false; |
|---|
| 1634 |
} |
|---|
| 1635 |
|
|---|
| 1636 |
|
|---|
| 1637 |
|
|---|
| 1638 |
var colbrows = document.getElementById(this.colbrows_prfx+this.colbrows_suffix); |
|---|
| 1639 |
|
|---|
| 1640 |
|
|---|
| 1641 |
|
|---|
| 1642 |
try { |
|---|
| 1643 |
this._buildCol(colbrows, el, el.value, xml); |
|---|
| 1644 |
|
|---|
| 1645 |
var num = _colbrowser._getCurrentColNum(this, el); |
|---|
| 1646 |
++num; |
|---|
| 1647 |
var nextcol = _colbrowser._getColByNum(this, num); |
|---|
| 1648 |
|
|---|
| 1649 |
|
|---|
| 1650 |
if (nextcol && 1) { |
|---|
| 1651 |
nextcol.setAttribute(_colbrowser.CLASSATT, this.css_prfx+'col'); |
|---|
| 1652 |
nextcol.selectedIndex = 0; |
|---|
| 1653 |
nextcol.focus(); |
|---|
| 1654 |
|
|---|
| 1655 |
|
|---|
| 1656 |
|
|---|
| 1657 |
|
|---|
| 1658 |
|
|---|
| 1659 |
|
|---|
| 1660 |
if (_colbrowser.MSIE && nextcol.options[0].value !== '(null)') { |
|---|
| 1661 |
try { |
|---|
| 1662 |
this._buildCol(colbrows, nextcol.options[0], nextcol.options[0].value, xml); |
|---|
| 1663 |
} |
|---|
| 1664 |
catch (e) { |
|---|
| 1665 |
|
|---|
| 1666 |
|
|---|
| 1667 |
|
|---|
| 1668 |
|
|---|
| 1669 |
|
|---|
| 1670 |
|
|---|
| 1671 |
|
|---|
| 1672 |
alert('1:For '+nextcol.options[0].value+':\n\t'+(e.message?e.message:e)); |
|---|
| 1673 |
return false; |
|---|
| 1674 |
} |
|---|
| 1675 |
} |
|---|
| 1676 |
|
|---|
| 1677 |
if (_colbrowser.MOZ && 1) { |
|---|
| 1678 |
--nextcol.selectedIndex; |
|---|
| 1679 |
} |
|---|
| 1680 |
else if (_colbrowser.MSIE) { |
|---|
| 1681 |
|
|---|
| 1682 |
_colbrowser._scrollColItemIntoView(this, nextcol); |
|---|
| 1683 |
if (nextcol.options[0].value !== '(null)') { |
|---|
| 1684 |
this.InfoStrategy.populateAllInfo(nextcol.options[0].value, this.URLtoXMLDoc); |
|---|
| 1685 |
} |
|---|
| 1686 |
} |
|---|
| 1687 |
} |
|---|
| 1688 |
} catch (e) { |
|---|
| 1689 |
alert('2: For '+el.value+':\n\t'+(e.message?e.message:e)); |
|---|
| 1690 |
} |
|---|
| 1691 |
return false; |
|---|
| 1692 |
}; |
|---|
| 1693 |
|
|---|
| 1694 |
|
|---|
| 1695 |
_colbrowser.prototype._leftHandle = function (el, keyid, e) { |
|---|
| 1696 |
|
|---|
| 1697 |
|
|---|
| 1698 |
var num2 = _colbrowser._getCurrentColNum(this, el); |
|---|
| 1699 |
++num2; |
|---|
| 1700 |
var nextcol = document.getElementById(this.colbrows_prfx+num2); |
|---|
| 1701 |
while (nextcol) { |
|---|
| 1702 |
|
|---|
| 1703 |
nextcol.parentNode.removeChild(nextcol); |
|---|
| 1704 |
|
|---|
| 1705 |
--this.idCounter; |
|---|
| 1706 |
var selwidth = this.select_style_width; |
|---|
| 1707 |
this.select_style_left -= parseInt(selwidth.substr(0, selwidth.length-2), 10); |
|---|
| 1708 |
nextcol = document.getElementById(this.colbrows_prfx + (++num2)); |
|---|
| 1709 |
} |
|---|
| 1710 |
|
|---|
| 1711 |
var num = _colbrowser._getCurrentColNum(this, el); |
|---|
| 1712 |
--num; |
|---|
| 1713 |
var prevcol = _colbrowser._getColByNum(this, num); |
|---|
| 1714 |
if (prevcol) { |
|---|
| 1715 |
el.selectedIndex = -1; |
|---|
| 1716 |
prevcol.focus(); |
|---|
| 1717 |
|
|---|
| 1718 |
|
|---|
| 1719 |
|
|---|
| 1720 |
if ((prevcol.selectedIndex !== (prevcol.options.length-1)) && _colbrowser.MOZ) { |
|---|
| 1721 |
++prevcol.selectedIndex; |
|---|
| 1722 |
} |
|---|
| 1723 |
else { |
|---|
| 1724 |
brettz9.DOM.stopEventFully(e); |
|---|
| 1725 |
} |
|---|
| 1726 |
if (_colbrowser.MSIE && prevcol.options[0].value !== '(null)') { |
|---|
| 1727 |
this.InfoStrategy.populateAllInfo(prevcol.options[0].value, this.URLtoXMLDoc); |
|---|
| 1728 |
} |
|---|
| 1729 |
} |
|---|
| 1730 |
return false; |
|---|
| 1731 |
}; |
|---|
| 1732 |
|
|---|
| 1733 |
|
|---|
| 1734 |
|
|---|
| 1735 |
_colbrowser.prototype._downHandle = function (el, keyid, e) { |
|---|
| 1736 |
if (_colbrowser.MOZ && el.selectedIndex === el.options.length-2) { |
|---|
| 1737 |
el.selectedIndex = el.options.length-3; |
|---|
| 1738 |
} |
|---|
| 1739 |
else if (_colbrowser.MSIE) { |
|---|
| 1740 |
if (el.selectedIndex < el.length-1) { |
|---|
| 1741 |
el.selectedIndex++; |
|---|
| 1742 |
} |
|---|
| 1743 |
this._selectChange(e); |
|---|
| 1744 |
} |
|---|
| 1745 |
}; |
|---|
| 1746 |
_colbrowser.prototype._upHandle = function (el, keyid, e) { |
|---|
| 1747 |
if (_colbrowser.MSIE) { |
|---|
| 1748 |
if (el.selectedIndex > 0) { |
|---|
| 1749 |
el.selectedIndex--; |
|---|
| 1750 |
} |
|---|
| 1751 |
this._selectChange(e); |
|---|
| 1752 |
} |
|---|
| 1753 |
}; |
|---|
| 1754 |
|
|---|
| 1755 |
|
|---|
| 1756 |
|
|---|
| 1757 |
|
|---|
| 1758 |
|
|---|
| 1759 |
_colbrowser.prototype._pageDownHandle = function (el, keyid, e) { |
|---|
| 1760 |
el.selectedIndex = el.length-1; |
|---|
| 1761 |
|
|---|
| 1762 |
var id0 = document.getElementById(this.colbrows_prfx+this.colbrows_suffix); |
|---|
| 1763 |
id0.scrollTop = id0.scrollHeight; |
|---|
| 1764 |
}; |
|---|
| 1765 |
_colbrowser.prototype._pageUpHandle = function (el, keyid, e) { |
|---|
| 1766 |
el.selectedIndex = _colbrowser.MSIE ? 0 : -1; |
|---|
| 1767 |
|
|---|
| 1768 |
var id0 = document.getElementById(this.colbrows_prfx+this.colbrows_suffix); |
|---|
| 1769 |
id0.scrollTop = 0; |
|---|
| 1770 |
}; |
|---|
| 1771 |
|
|---|
| 1772 |
_colbrowser.prototype._homeHandle = function (el, keyid, e) { |
|---|
| 1773 |
el.selectedIndex = _colbrowser.MSIE ? 0 : -1; |
|---|
| 1774 |
|
|---|
| 1775 |
var id0 = document.getElementById(this.colbrows_prfx+this.colbrows_suffix); |
|---|
| 1776 |
id0.scrollTop = 0; |
|---|
| 1777 |
}; |
|---|
| 1778 |
_colbrowser.prototype._endHandle = function (el, keyid, e) { |
|---|
| 1779 |
el.selectedIndex = el.length-1; |
|---|
| 1780 |
|
|---|
| 1781 |
var id0 = document.getElementById(this.colbrows_prfx+this.colbrows_suffix); |
|---|
| 1782 |
id0.scrollTop = id0.scrollHeight; |
|---|
| 1783 |
}; |
|---|
| 1784 |
|
|---|
| 1785 |
|
|---|
| 1786 |
|
|---|
| 1787 |
_colbrowser.prototype._deleteHandle = function (el, keyid, e) { |
|---|
| 1788 |
var option = el.options[el.selectedIndex]; |
|---|
| 1789 |
option.parentNode.removeChild(option); |
|---|
| 1790 |
}; |
|---|
| 1791 |
_colbrowser.prototype._ctrlShiftN = function (el, keyid, e) { |
|---|
| 1792 |
var option = el.options[el.selectedIndex]; |
|---|
| 1793 |
var option2 = brettz9.DOM.createElementNSwrapper(_colbrowser.HTMLNS, 'option'); |
|---|
| 1794 |
option2.innerHTML = 'dir'; |
|---|
| 1795 |
option2.value = ''; |
|---|
| 1796 |
|
|---|
| 1797 |
option.parentNode.insertBefore(option2, option.nextSibling); |
|---|
| 1798 |
|
|---|
| 1799 |
|
|---|
| 1800 |
}; |
|---|
| 1801 |
|
|---|
| 1802 |
|
|---|
| 1803 |
|
|---|
| 1804 |
_colbrowser.prototype._returnHandle = function (el, keyid, e) { |
|---|
| 1805 |
if (1) { |
|---|
| 1806 |
Tooltip.lastel = _colbrowser.MSIE ? e.srcElement : e.target; |
|---|
| 1807 |
var startleft = this.colbrows_style_left.replace(/px$/, ''); |
|---|
| 1808 |
var starttop = this.colbrows_style_top.replace(/px$/, ''); |
|---|
| 1809 |
Tooltip.schedule(this.colbrows_prfx+this.colbrows_suffix, el, e, startleft, starttop); |
|---|
| 1810 |
} |
|---|
| 1811 |
else { |
|---|
| 1812 |
|
|---|
| 1813 |
|
|---|
| 1814 |
} |
|---|
| 1815 |
return false; |
|---|
| 1816 |
}; |
|---|
| 1817 |
_colbrowser.prototype._selectClick = function (e, xml) { |
|---|
| 1818 |
|
|---|
| 1819 |
|
|---|
| 1820 |
|
|---|
| 1821 |
var selectCol = _colbrowser.MSIE ? e.srcElement : e.target.parentNode; |
|---|
| 1822 |
|
|---|
| 1823 |
|
|---|
| 1824 |
if (selectCol.nodeName.toLowerCase() !== 'select') { |
|---|
| 1825 |
return; |
|---|
| 1826 |
} |
|---|
| 1827 |
|
|---|
| 1828 |
if (_colbrowser.MSIE) { |
|---|
| 1829 |
|
|---|
| 1830 |
if (selectCol.selectedIndex === undefined || selectCol.selectedIndex == -1) {return;} |
|---|
| 1831 |
} |
|---|
| 1832 |
|
|---|
| 1833 |
if (selectCol.value === '(null)') { |
|---|
| 1834 |
return; |
|---|
| 1835 |
} |
|---|
| 1836 |
|
|---|
| 1837 |
_colbrowser.currFocus = selectCol; |
|---|
| 1838 |
try { |
|---|
| 1839 |
|
|---|
| 1840 |
|
|---|
| 1841 |
|
|---|
| 1842 |
this.InfoStrategy.populateAllInfo(selectCol.value, this.URLtoXMLDoc); |
|---|
| 1843 |
|
|---|
| 1844 |
|
|---|
| 1845 |
var colbrows = document.getElementById(this.colbrows_prfx+this.colbrows_suffix); |
|---|
| 1846 |
this._buildCol(colbrows, selectCol, selectCol.value, xml); |
|---|
| 1847 |
} catch (e) { |
|---|
| 1848 |
if (e.name !== 'NS_ERROR_ILLEGAL_VALUE') { |
|---|
| 1849 |
alert(e.message?e.message:e); |
|---|
| 1850 |
} |
|---|
| 1851 |
} |
|---|
| 1852 |
}; |
|---|
| 1853 |
|
|---|
| 1854 |
_colbrowser.prototype._selectChange = function (e, xml) { |
|---|
| 1855 |
|
|---|
| 1856 |
var holder = document.getElementById('colbrows_img_display'); |
|---|
| 1857 |
while (holder.childNodes.length > 0) { |
|---|
| 1858 |
holder.removeChild(holder.firstChild); |
|---|
| 1859 |
} |
|---|
| 1860 |
|
|---|
| 1861 |
|
|---|
| 1862 |
var targ = _colbrowser.MSIE ? e.srcElement : e.target; |
|---|
| 1863 |
_colbrowser.currFocus = targ; |
|---|
| 1864 |
if (targ.value === '(null)') { |
|---|
| 1865 |
return; |
|---|
| 1866 |
} |
|---|
| 1867 |
else if (targ.value === 'null') { |
|---|
| 1868 |
targ.selectedIndex = 0; |
|---|
| 1869 |
return; |
|---|
| 1870 |
} |
|---|
| 1871 |
else if (targ.selectedIndex === undefined) { |
|---|
| 1872 |
return; |
|---|
| 1873 |
} |
|---|
| 1874 |
|
|---|
| 1875 |
var colbrows = document.getElementById(this.colbrows_prfx+this.colbrows_suffix); |
|---|
| 1876 |
try { |
|---|
| 1877 |
this._buildCol(colbrows, targ, targ.value, xml); |
|---|
| 1878 |
|
|---|
| 1879 |
|
|---|
| 1880 |
_colbrowser._scrollColItemIntoView(this, targ); |
|---|
| 1881 |
|
|---|
| 1882 |
|
|---|
| 1883 |
this.InfoStrategy.populateAllInfo(targ.value, this.URLtoXMLDoc); |
|---|
| 1884 |
} catch (e) { |
|---|
| 1885 |
alert('3: For '+targ.value+':\n\t'+(e.message?e.message:e)); |
|---|
| 1886 |
} |
|---|
| 1887 |
}; |
|---|
| 1888 |
|
|---|
| 1889 |
|
|---|
| 1890 |
|
|---|
| 1891 |
_colbrowser.HTMLNS = 'http://www.w3.org/1999/xhtml'; |
|---|
| 1892 |
_colbrowser.XLINKNS = 'http://www.w3.org/1999/xlink'; |
|---|
| 1893 |
_colbrowser.MOZ = navigator.userAgent.indexOf('Gecko/') !== -1 && |
|---|
| 1894 |
navigator.vendor.indexOf('Apple') === -1; |
|---|
| 1895 |
_colbrowser.MOZWIN = navigator.appVersion.indexOf('Win') !== -1 && _colbrowser.MOZ; |
|---|
| 1896 |
_colbrowser.MSIE = navigator.userAgent.indexOf('MSIE') !== -1; |
|---|
| 1897 |
_colbrowser.CLASSATT = _colbrowser.MSIE ? 'className' : 'class'; |
|---|
| 1898 |
|
|---|
| 1899 |
|
|---|
| 1900 |
_colbrowser.searchString = function (data) { |
|---|
| 1901 |
for (var i=0;i<data.length;i++) { |
|---|
| 1902 |
var dataString = data[i].string; |
|---|
| 1903 |
if (dataString) { |
|---|
| 1904 |
if (dataString.indexOf(data[i].subString) !== -1) |
|---|
| 1905 |
return data[i].identity; |
|---|
| 1906 |
} |
|---|
| 1907 |
} |
|---|
| 1908 |
return false; |
|---|
| 1909 |
}; |
|---|
| 1910 |
_colbrowser.dataOS = [ |
|---|
| 1911 |
{ |
|---|
| 1912 |
string: navigator.platform, |
|---|
| 1913 |
subString: "Win", |
|---|
| 1914 |
identity: "Windows" |
|---|
| 1915 |
}, |
|---|
| 1916 |
{ |
|---|
| 1917 |
string: navigator.platform, |
|---|
| 1918 |
subString: "Mac", |
|---|
| 1919 |
identity: "Mac" |
|---|
| 1920 |
}, |
|---|
| 1921 |
{ |
|---|
| 1922 |
string: navigator.platform, |
|---|
| 1923 |
subString: "Linux", |
|---|
| 1924 |
identity: "Linux" |
|---|
| 1925 |
} |
|---|
| 1926 |
] |
|---|
| 1927 |
|
|---|
| 1928 |
|
|---|
| 1929 |
_colbrowser.OS = _colbrowser.searchString(_colbrowser.dataOS); |
|---|
| 1930 |
_colbrowser.OSfile_slash = (_colbrowser.OS === 'Windows') ? '\\' : '/'; |
|---|
| 1931 |
_colbrowser.XPathPlus = /^(show\^([^\^]*)\^doc\^([^)#\^]*)(#xpath1\((.*)\))?\^)(.*)$/; |
|---|
| 1932 |
|
|---|
| 1933 |
var currFilePath = window.location.href.replace(/\/[\w\.]+$/, '/'); |
|---|
| 1934 |
_colbrowser.currFilePath = currFilePath; |
|---|
| 1935 |
|
|---|
| 1936 |
|
|---|
| 1937 |
|
|---|
| 1938 |
|
|---|
| 1939 |
|
|---|
| 1940 |
|
|---|
| 1941 |
_colbrowser.sampleXml = ''+ |
|---|
| 1942 |
" <"+"?js pseudo2='attr'?><!-- mycomment2 -->"+ |
|---|
| 1943 |
"<Home:Base xmlns:xi='http://www.w3.org/2001/XInclude' xml:base='http://localhost/navbarcrumbs' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns:Home='abcdef' dog='ca&t' war='peace'>\n"+ |
|---|
| 1944 |
" <"+"?js pseudo='attr'?><!-- mycomment1 -->blah;<someXML abc='ok'>\neee"+ |
|---|
| 1945 |
" <anElement a='abc&><'><Great-Grandparents><Grandparents>Joe & Ellen<Parents>Harry & Joan<Child>Steve<\/Child><Sibling>Sue<\/Sibling><\/Parents>Fred & Mary<\/Grandparents><\/Great-Grandparents><Dog>Fritz<\/Dog>some Text<cat>Fifi<\/cat>moretext<\/anElement>\n"+ |
|---|
| 1946 |
" <anotherElement><![CDATA[ abc<>def ]]"+"> blah; def<\/anotherElement>\n"+ |
|---|
| 1947 |
" <MoreXML><a>dog</a>\n"+ |
|---|
| 1948 |
" <b>Some text 2<\/b>\n"+ |
|---|
| 1949 |
" <otherMeaninglessJunk>ghi<\/otherMeaninglessJunk>\n"+ |
|---|
| 1950 |
" <\/MoreXML>\n"+ |
|---|
| 1951 |
" <\/someXML>\n"+ |
|---|
| 1952 |
" <webXML xlink:href='http://bahai-library.com/zamir/chintest9.xml'></webXML>"+ |
|---|
| 1953 |
" <XLinkTitle xlink:type='title'><select size='2'><option>def</option><option>abc</option></select><input type='checkbox' checked='checked' /><table border='1'><tr><td>ab</td><td>cd</td></tr><tr><td>ef</td><td>gh</td></tr></table><input type='button' value='Hi!' onclick='alert(123);' /><i style='color:red;'>Testing</i> now</XLinkTitle>"; |
|---|
| 1954 |
switch (_colbrowser.OS) { |
|---|
| 1955 |
case 'Windows': |
|---|
| 1956 |
_colbrowser.sampleXml += "<Windows_only xlink:title='Windows only (C:\\)' xlink:href='"+currFilePath+"dirGen.js?f=C:\\'></Windows_only>"; |
|---|
| 1957 |
break; |
|---|
| 1958 |
case "Mac": |
|---|
| 1959 |
_colbrowser.sampleXml += "<Mac_only xlink:title='Mac only (/Users)' xlink:href='"+currFilePath+"dirGen.js?f=/Users'></Mac_only>"; |
|---|
| 1960 |
case "Linux": |
|---|
| 1961 |
default: |
|---|
| 1962 |
_colbrowser.sampleXml += "<Other_OS xlink:title='Other OS (/)' xlink:href='"+currFilePath+"dirGen.js?f=/'></Other_OS>"; |
|---|
| 1963 |
break; |
|---|
| 1964 |
} |
|---|
| 1965 |
|
|---|
| 1966 |
|
|---|
| 1967 |
|
|---|
| 1968 |
|
|---|
| 1969 |
|
|---|
| 1970 |
_colbrowser.sampleXml += "<tests xlink:title='Brett's tests'><TestLocalhost><name xlink:title='my xltitle (localhost)' xlink:href='http://localhost/standard-sitemap/stdsitemap-ff-ext/trunk/install.xml#xpath1(//*[local-name()=\"id\" and namespace-uri()=\"http://www.mozilla.org/2004/em-rdf#\"])'>directory1 and more<\/name>\n"+ |
|---|
| 1971 |
" <_127.0.0.1 xlink:href='http://127.0.0.1/navbarcrumbs/sitemap.xml' abc='oka'>filea<\/_127.0.0.1></TestLocalhost>\n"+ |
|---|
| 1972 |
" <TestXPathId xlink:href='http://localhost/navbarcrumbs/sitemap.xml#xpath1(//pg[@id="pg1"])' abc='ok'>file1<\/TestXPathId>\n"+ |
|---|
| 1973 |
" <TestXPath xlink:href='http://localhost/navbarcrumbs/sitemap.xml#xpath1(//pg)' abc='oka'>file2<\/TestXPath>\n"+ |
|---|
| 1974 |
" <TextXIncludeXML><xi:include parse='xml' xpointer='//node' href='file:///C:/Users/Brett/Documents/MindMaps-test.xml'><xi:fallback>Some text</xi:fallback></xi:include></TextXIncludeXML>"+ |
|---|
| 1975 |
" <TextXIncludeText><xi:include parse='text' encoding='GB2312' href='file:///C:/Users/Brett/Documents/MindMaps-test4.xml'><xi:fallback>Some text</xi:fallback></xi:include></TextXIncludeText>"+ |
|---|
| 1976 |
" </tests>\n<\/Home:Base><"+"?js pseudo3='attr'?><!-- mycomment3 --"+">"; |
|---|
| 1977 |
|
|---|
| 1978 |
|
|---|
| 1979 |
_colbrowser.colbrowsCount = 0; |
|---|
| 1980 |
|
|---|
| 1981 |
|
|---|
| 1982 |
|
|---|
| 1983 |
|
|---|
| 1984 |
|
|---|
| 1985 |
|
|---|
| 1986 |
|
|---|
| 1987 |
|
|---|
| 1988 |
|
|---|
| 1989 |
|
|---|
| 1990 |
|
|---|
| 1991 |
|
|---|
| 1992 |
_colbrowser._getCurrentColNum = function (that, col) { |
|---|
| 1993 |
return parseInt(col.id.substr(that.colbrows_prfx.length), 10); |
|---|
| 1994 |
}; |
|---|
| 1995 |
_colbrowser._getColByNum = function (that, num) { |
|---|
| 1996 |
return document.getElementById(that.colbrows_prfx + num); |
|---|
| 1997 |
}; |
|---|
| 1998 |
_colbrowser._getNextCol = function (that, col) { |
|---|
| 1999 |
var num = _getCurrentColNum(that, col); |
|---|
| 2000 |
num++; |
|---|
| 2001 |
return _getColByNum(that, num); |
|---|
| 2002 |
}; |
|---|
| 2003 |
_colbrowser._scrollColItemIntoView = function (that, targ) { |
|---|
| 2004 |
|
|---|
| 2005 |
|
|---|
| 2006 |
var id0 = document.getElementById(that.colbrows_prfx+that.colbrows_suffix); |
|---|
| 2007 |
var selwidth = that.select_style_width; |
|---|
| 2008 |
|
|---|
| 2009 |
|
|---|
| 2010 |
id0.scrollLeft = id0.scrollLeft + |
|---|
| 2011 |
parseInt( selwidth.substr(0, selwidth.length-2), 10 ); |
|---|
| 2012 |
|
|---|
| 2013 |
if (!that.select_size) { |
|---|
| 2014 |
|
|---|
| 2015 |
|
|---|
| 2016 |
|
|---|
| 2017 |
|
|---|
| 2018 |
|
|---|
| 2019 |
|
|---|
| 2020 |
if (targ.selectedIndex*16 >= |
|---|
| 2021 |
that.colbrows_style_height.replace(/px$/, '') * 50/100) { |
|---|
| 2022 |
// id0.scrollTop = id0.scrollTop + Tooltip.Y_MENUOFFSET * 1.5; // 15 * 2; // double it to show extra blank area at bottom too |
|---|
| 2023 |
// id0.scrollTop = brettz9.STYLE.getY(targ.options[targ.selectedIndex]); |
|---|
| 2024 |
id0.scrollTop = targ.selectedIndex*16 + 46; |
|---|
| 2025 |
} |
|---|
| 2026 |
else if (targ.selectedIndex*16 < |
|---|
| 2027 |
that.colbrows_style_height.replace(/px$/, '') * 50/100) { |
|---|
| 2028 |
id0.scrollTop = targ.selectedIndex*16 - 26; |
|---|
| 2029 |
|
|---|
| 2030 |
|
|---|
| 2031 |
} |
|---|
| 2032 |
|
|---|
| 2033 |
} |
|---|
| 2034 |
}; |
|---|
| 2035 |
|
|---|
| 2036 |
|
|---|
| 2037 |
|
|---|
| 2038 |
var _public = { |
|---|
| 2039 |
colbrowser : _colbrowser |
|---|
| 2040 |
}; |
|---|
| 2041 |
return _public; |
|---|
| 2042 |
}(); |
|---|