| 1 |
define([ |
| 2 |
"dojo/_base/kernel", |
| 3 |
"dojo/_base/lang", |
| 4 |
"dojo/_base/array", |
| 5 |
"dojo/_base/connect", |
| 6 |
"dojo/_base/declare", |
| 7 |
"dojo/dom-class", |
| 8 |
"dijit/_Widget", |
| 9 |
"dijit/_Templated", |
| 10 |
"dijit/_Container", |
| 11 |
"../io/Connection", |
| 12 |
"dojo/text!./templates/FeedViewer.html", |
| 13 |
"dojo/text!./templates/FeedViewerEntry.html", |
| 14 |
"dojo/text!./templates/FeedViewerGrouping.html", |
| 15 |
"dojo/i18n!./nls/FeedViewerEntry" |
| 16 |
], function (dojo, lang, arrayUtil, connect, declare, domClass, _Widget, _Templated, _Container, Connection, template, entryTemplate, groupingTemplate, i18nViewer) { |
| 17 |
dojo.experimental("dojox.atom.widget.FeedViewer"); |
| 18 |
|
| 19 |
var FeedViewer = declare("dojox.atom.widget.FeedViewer", [_Widget, _Templated, _Container],{ |
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
feedViewerTableBody: null, |
| 24 |
feedViewerTable: null, |
| 25 |
entrySelectionTopic: "", |
| 26 |
url: "", |
| 27 |
xmethod: false, |
| 28 |
localSaveOnly: false, |
| 29 |
|
| 30 |
|
| 31 |
templateString: template, |
| 32 |
|
| 33 |
_feed: null, |
| 34 |
_currentSelection: null, |
| 35 |
|
| 36 |
_includeFilters: null, |
| 37 |
|
| 38 |
alertsEnabled: false, |
| 39 |
|
| 40 |
postCreate: function(){ |
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
this._includeFilters = []; |
| 47 |
|
| 48 |
if(this.entrySelectionTopic !== ""){ |
| 49 |
this._subscriptions = [dojo.subscribe(this.entrySelectionTopic, this, "_handleEvent")]; |
| 50 |
} |
| 51 |
this.atomIO = new Connection(); |
| 52 |
this.childWidgets = []; |
| 53 |
}, |
| 54 |
|
| 55 |
startup: function(){ |
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
this.containerNode = this.feedViewerTableBody; |
| 61 |
var children = this.getDescendants(); |
| 62 |
for(var i in children){ |
| 63 |
var child = children[i]; |
| 64 |
if(child && child.isFilter){ |
| 65 |
this._includeFilters.push(new FeedViewer.CategoryIncludeFilter(child.scheme, child.term, child.label)); |
| 66 |
child.destroy(); |
| 67 |
} |
| 68 |
} |
| 69 |
|
| 70 |
if(this.url !== ""){ |
| 71 |
this.setFeedFromUrl(this.url); |
| 72 |
} |
| 73 |
}, |
| 74 |
|
| 75 |
clear: function(){ |
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
this.destroyDescendants(); |
| 81 |
}, |
| 82 |
|
| 83 |
setFeedFromUrl: function(url){ |
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
if(url !== ""){ |
| 91 |
if(this._isRelativeURL(url)){ |
| 92 |
var baseUrl = ""; |
| 93 |
if(url.charAt(0) !== '/'){ |
| 94 |
baseUrl = this._calculateBaseURL(window.location.href, true); |
| 95 |
}else{ |
| 96 |
baseUrl = this._calculateBaseURL(window.location.href, false); |
| 97 |
} |
| 98 |
this.url = baseUrl + url; |
| 99 |
} |
| 100 |
|
| 101 |
this.atomIO.getFeed(url,lang.hitch(this,this.setFeed)); |
| 102 |
} |
| 103 |
}, |
| 104 |
|
| 105 |
|
| 106 |
setFeed: function(feed){ |
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
this._feed = feed; |
| 114 |
this.clear(); |
| 115 |
var entrySorter=function(a,b){ |
| 116 |
var dispA = this._displayDateForEntry(a); |
| 117 |
var dispB = this._displayDateForEntry(b); |
| 118 |
if(dispA > dispB){return -1;} |
| 119 |
if(dispA < dispB){return 1;} |
| 120 |
return 0; |
| 121 |
}; |
| 122 |
|
| 123 |
|
| 124 |
var groupingStr = function(dateStr){ |
| 125 |
var dpts = dateStr.split(','); |
| 126 |
|
| 127 |
dpts.pop(); |
| 128 |
return dpts.join(","); |
| 129 |
}; |
| 130 |
var sortedEntries = feed.entries.sort(lang.hitch(this,entrySorter)); |
| 131 |
if(feed){ |
| 132 |
var lastSectionTitle = null; |
| 133 |
for(var i=0;i<sortedEntries.length;i++){ |
| 134 |
|
| 135 |
var entry = sortedEntries[i]; |
| 136 |
|
| 137 |
if(this._isFilterAccepted(entry)){ |
| 138 |
var time = this._displayDateForEntry(entry); |
| 139 |
var sectionTitle = ""; |
| 140 |
|
| 141 |
if(time !== null){ |
| 142 |
sectionTitle = groupingStr(time.toLocaleString()); |
| 143 |
|
| 144 |
if(sectionTitle === "" ){ |
| 145 |
|
| 146 |
sectionTitle = "" + (time.getMonth() + 1) + "/" + time.getDate() + "/" + time.getFullYear(); |
| 147 |
} |
| 148 |
} |
| 149 |
if((lastSectionTitle === null) || (lastSectionTitle != sectionTitle)){ |
| 150 |
this.appendGrouping(sectionTitle); |
| 151 |
lastSectionTitle = sectionTitle; |
| 152 |
} |
| 153 |
this.appendEntry(entry); |
| 154 |
} |
| 155 |
} |
| 156 |
} |
| 157 |
}, |
| 158 |
|
| 159 |
_displayDateForEntry: function(entry){ |
| 160 |
|
| 161 |
|
| 162 |
|
| 163 |
|
| 164 |
|
| 165 |
|
| 166 |
if(entry.updated){return entry.updated;} |
| 167 |
if(entry.modified){return entry.modified;} |
| 168 |
if(entry.issued){return entry.issued;} |
| 169 |
return new Date(); |
| 170 |
}, |
| 171 |
|
| 172 |
appendGrouping: function(titleText){ |
| 173 |
|
| 174 |
|
| 175 |
|
| 176 |
|
| 177 |
|
| 178 |
|
| 179 |
var entryWidget = new FeedViewerGrouping({}); |
| 180 |
entryWidget.setText(titleText); |
| 181 |
this.addChild(entryWidget); |
| 182 |
this.childWidgets.push(entryWidget); |
| 183 |
}, |
| 184 |
|
| 185 |
appendEntry: function(entry){ |
| 186 |
|
| 187 |
|
| 188 |
|
| 189 |
|
| 190 |
|
| 191 |
|
| 192 |
var entryWidget = new FeedViewerEntry({"xmethod": this.xmethod}); |
| 193 |
entryWidget.setTitle(entry.title.value); |
| 194 |
entryWidget.setTime(this._displayDateForEntry(entry).toLocaleTimeString()); |
| 195 |
entryWidget.entrySelectionTopic = this.entrySelectionTopic; |
| 196 |
entryWidget.feed = this; |
| 197 |
this.addChild(entryWidget); |
| 198 |
this.childWidgets.push(entryWidget); |
| 199 |
this.connect(entryWidget, "onClick", "_rowSelected"); |
| 200 |
entry.domNode = entryWidget.entryNode; |
| 201 |
|
| 202 |
|
| 203 |
entry._entryWidget = entryWidget; |
| 204 |
entryWidget.entry = entry; |
| 205 |
}, |
| 206 |
|
| 207 |
deleteEntry: function(entryRow){ |
| 208 |
|
| 209 |
|
| 210 |
if(!this.localSaveOnly){ |
| 211 |
this.atomIO.deleteEntry(entryRow.entry, lang.hitch(this, this._removeEntry, entryRow), null, this.xmethod); |
| 212 |
}else{ |
| 213 |
this._removeEntry(entryRow, true); |
| 214 |
} |
| 215 |
dojo.publish(this.entrySelectionTopic, [{ action: "delete", source: this, entry: entryRow.entry }]); |
| 216 |
}, |
| 217 |
|
| 218 |
_removeEntry: function( entry, success){ |
| 219 |
|
| 220 |
|
| 221 |
if(success){ |
| 222 |
|
| 223 |
var idx = arrayUtil.indexOf(this.childWidgets, entry); |
| 224 |
var before = this.childWidgets[idx-1]; |
| 225 |
var after = this.childWidgets[idx+1]; |
| 226 |
if( before.isInstanceOf(widget.FeedViewerGrouping) && |
| 227 |
(after === undefined || after.isInstanceOf(widget.FeedViewerGrouping))){ |
| 228 |
before.destroy(); |
| 229 |
} |
| 230 |
|
| 231 |
|
| 232 |
entry.destroy(); |
| 233 |
}else{} |
| 234 |
}, |
| 235 |
|
| 236 |
_rowSelected: function(evt){ |
| 237 |
|
| 238 |
|
| 239 |
|
| 240 |
|
| 241 |
|
| 242 |
|
| 243 |
var selectedNode = evt.target; |
| 244 |
while(selectedNode){ |
| 245 |
if(domClass.contains(selectedNode, 'feedViewerEntry')) { |
| 246 |
break; |
| 247 |
} |
| 248 |
selectedNode = selectedNode.parentNode; |
| 249 |
} |
| 250 |
|
| 251 |
for(var i=0;i<this._feed.entries.length;i++){ |
| 252 |
var entry = this._feed.entries[i]; |
| 253 |
if( (selectedNode === entry.domNode) && (this._currentSelection !== entry) ){ |
| 254 |
|
| 255 |
domClass.add(entry.domNode, "feedViewerEntrySelected"); |
| 256 |
domClass.remove(entry._entryWidget.timeNode, "feedViewerEntryUpdated"); |
| 257 |
domClass.add(entry._entryWidget.timeNode, "feedViewerEntryUpdatedSelected"); |
| 258 |
|
| 259 |
this.onEntrySelected(entry); |
| 260 |
if(this.entrySelectionTopic !== ""){ |
| 261 |
dojo.publish(this.entrySelectionTopic, [{ action: "set", source: this, feed: this._feed, entry: entry }]); |
| 262 |
} |
| 263 |
if(this._isEditable(entry)){ |
| 264 |
entry._entryWidget.enableDelete(); |
| 265 |
} |
| 266 |
|
| 267 |
this._deselectCurrentSelection(); |
| 268 |
this._currentSelection = entry; |
| 269 |
break; |
| 270 |
}else if( (selectedNode === entry.domNode) && (this._currentSelection === entry) ){ |
| 271 |
|
| 272 |
dojo.publish(this.entrySelectionTopic, [{ action: "delete", source: this, entry: entry }]); |
| 273 |
this._deselectCurrentSelection(); |
| 274 |
break; |
| 275 |
} |
| 276 |
} |
| 277 |
}, |
| 278 |
|
| 279 |
_deselectCurrentSelection: function(){ |
| 280 |
|
| 281 |
|
| 282 |
|
| 283 |
|
| 284 |
if(this._currentSelection){ |
| 285 |
domClass.add(this._currentSelection._entryWidget.timeNode, "feedViewerEntryUpdated"); |
| 286 |
domClass.remove(this._currentSelection.domNode, "feedViewerEntrySelected"); |
| 287 |
domClass.remove(this._currentSelection._entryWidget.timeNode, "feedViewerEntryUpdatedSelected"); |
| 288 |
this._currentSelection._entryWidget.disableDelete(); |
| 289 |
this._currentSelection = null; |
| 290 |
} |
| 291 |
}, |
| 292 |
|
| 293 |
|
| 294 |
_isEditable: function(entry){ |
| 295 |
|
| 296 |
|
| 297 |
|
| 298 |
|
| 299 |
|
| 300 |
|
| 301 |
|
| 302 |
|
| 303 |
|
| 304 |
var retVal = false; |
| 305 |
if(entry && entry !== null && entry.links && entry.links !== null){ |
| 306 |
for(var x in entry.links){ |
| 307 |
if(entry.links[x].rel && entry.links[x].rel == "edit"){ |
| 308 |
retVal = true; |
| 309 |
break; |
| 310 |
} |
| 311 |
} |
| 312 |
} |
| 313 |
return retVal; |
| 314 |
}, |
| 315 |
|
| 316 |
onEntrySelected: function(entry){ |
| 317 |
|
| 318 |
|
| 319 |
|
| 320 |
|
| 321 |
|
| 322 |
|
| 323 |
|
| 324 |
}, |
| 325 |
|
| 326 |
_isRelativeURL: function(url){ |
| 327 |
|
| 328 |
|
| 329 |
|
| 330 |
|
| 331 |
|
| 332 |
|
| 333 |
|
| 334 |
|
| 335 |
|
| 336 |
var isFileURL = function(url){ |
| 337 |
var retVal = false; |
| 338 |
if(url.indexOf("file://") === 0){ |
| 339 |
retVal = true; |
| 340 |
} |
| 341 |
return retVal; |
| 342 |
}; |
| 343 |
|
| 344 |
var isHttpURL = function(url){ |
| 345 |
var retVal = false; |
| 346 |
if(url.indexOf("http://") === 0){ |
| 347 |
retVal = true; |
| 348 |
} |
| 349 |
return retVal; |
| 350 |
}; |
| 351 |
|
| 352 |
var retVal = false; |
| 353 |
if(url !== null){ |
| 354 |
if(!isFileURL(url) && !isHttpURL(url)){ |
| 355 |
retVal = true; |
| 356 |
} |
| 357 |
} |
| 358 |
return retVal; |
| 359 |
}, |
| 360 |
|
| 361 |
_calculateBaseURL: function(fullURL, currentPageRelative){ |
| 362 |
|
| 363 |
|
| 364 |
|
| 365 |
|
| 366 |
|
| 367 |
|
| 368 |
|
| 369 |
|
| 370 |
var baseURL = null; |
| 371 |
if(fullURL !== null){ |
| 372 |
|
| 373 |
var index = fullURL.indexOf("?"); |
| 374 |
if(index != -1){ |
| 375 |
fullURL = fullURL.substring(0,index); |
| 376 |
|
| 377 |
} |
| 378 |
|
| 379 |
if(currentPageRelative){ |
| 380 |
|
| 381 |
|
| 382 |
|
| 383 |
index = fullURL.lastIndexOf("/"); |
| 384 |
if((index > 0) && (index < fullURL.length) && (index !== (fullURL.length -1))){ |
| 385 |
|
| 386 |
baseURL = fullURL.substring(0,(index + 1)); |
| 387 |
}else{ |
| 388 |
baseURL = fullURL; |
| 389 |
} |
| 390 |
}else{ |
| 391 |
|
| 392 |
index = fullURL.indexOf("://"); |
| 393 |
if(index > 0){ |
| 394 |
index = index + 3; |
| 395 |
var protocol = fullURL.substring(0,index); |
| 396 |
var fragmentURL = fullURL.substring(index, fullURL.length); |
| 397 |
index = fragmentURL.indexOf("/"); |
| 398 |
if((index < fragmentURL.length) && (index > 0) ){ |
| 399 |
baseURL = protocol + fragmentURL.substring(0,index); |
| 400 |
}else{ |
| 401 |
baseURL = protocol + fragmentURL; |
| 402 |
} |
| 403 |
} |
| 404 |
} |
| 405 |
} |
| 406 |
return baseURL; |
| 407 |
}, |
| 408 |
|
| 409 |
_isFilterAccepted: function(entry) { |
| 410 |
|
| 411 |
|
| 412 |
|
| 413 |
|
| 414 |
var accepted = false; |
| 415 |
if (this._includeFilters && (this._includeFilters.length > 0)) { |
| 416 |
for (var i = 0; i < this._includeFilters.length; i++) { |
| 417 |
var filter = this._includeFilters[i]; |
| 418 |
if (filter.match(entry)) { |
| 419 |
accepted = true; |
| 420 |
break; |
| 421 |
} |
| 422 |
} |
| 423 |
} |
| 424 |
else { |
| 425 |
accepted = true; |
| 426 |
} |
| 427 |
return accepted; |
| 428 |
}, |
| 429 |
|
| 430 |
addCategoryIncludeFilter: function(filter) { |
| 431 |
|
| 432 |
|
| 433 |
|
| 434 |
|
| 435 |
|
| 436 |
|
| 437 |
|
| 438 |
if (filter) { |
| 439 |
var scheme = filter.scheme; |
| 440 |
var term = filter.term; |
| 441 |
var label = filter.label; |
| 442 |
var addIt = true; |
| 443 |
|
| 444 |
if (!scheme) { |
| 445 |
scheme = null; |
| 446 |
} |
| 447 |
if (!term) { |
| 448 |
scheme = null; |
| 449 |
} |
| 450 |
if (!label) { |
| 451 |
scheme = null; |
| 452 |
} |
| 453 |
|
| 454 |
if (this._includeFilters && this._includeFilters.length > 0) { |
| 455 |
for (var i = 0; i < this._includeFilters.length; i++) { |
| 456 |
var eFilter = this._includeFilters[i]; |
| 457 |
if ((eFilter.term === term) && (eFilter.scheme === scheme) && (eFilter.label === label)) { |
| 458 |
|
| 459 |
addIt = false; |
| 460 |
break; |
| 461 |
} |
| 462 |
} |
| 463 |
} |
| 464 |
|
| 465 |
if (addIt) { |
| 466 |
this._includeFilters.push(widget.FeedViewer.CategoryIncludeFilter(scheme, term, label)); |
| 467 |
} |
| 468 |
} |
| 469 |
}, |
| 470 |
|
| 471 |
removeCategoryIncludeFilter: function(filter) { |
| 472 |
|
| 473 |
|
| 474 |
|
| 475 |
|
| 476 |
|
| 477 |
|
| 478 |
|
| 479 |
if (filter) { |
| 480 |
var scheme = filter.scheme; |
| 481 |
var term = filter.term; |
| 482 |
var label = filter.label; |
| 483 |
|
| 484 |
if (!scheme) { |
| 485 |
scheme = null; |
| 486 |
} |
| 487 |
if (!term) { |
| 488 |
scheme = null; |
| 489 |
} |
| 490 |
if (!label) { |
| 491 |
scheme = null; |
| 492 |
} |
| 493 |
|
| 494 |
var newFilters = []; |
| 495 |
if (this._includeFilters && this._includeFilters.length > 0) { |
| 496 |
for (var i = 0; i < this._includeFilters.length; i++) { |
| 497 |
var eFilter = this._includeFilters[i]; |
| 498 |
if (!((eFilter.term === term) && (eFilter.scheme === scheme) && (eFilter.label === label))) { |
| 499 |
|
| 500 |
newFilters.push(eFilter); |
| 501 |
} |
| 502 |
} |
| 503 |
this._includeFilters = newFilters; |
| 504 |
} |
| 505 |
} |
| 506 |
}, |
| 507 |
|
| 508 |
_handleEvent: function(entrySelectionEvent) { |
| 509 |
|
| 510 |
|
| 511 |
|
| 512 |
|
| 513 |
|
| 514 |
|
| 515 |
if(entrySelectionEvent.source != this) { |
| 516 |
if(entrySelectionEvent.action == "update" && entrySelectionEvent.entry) { |
| 517 |
var evt = entrySelectionEvent; |
| 518 |
if(!this.localSaveOnly){ |
| 519 |
this.atomIO.updateEntry(evt.entry, lang.hitch(evt.source,evt.callback), null, true); |
| 520 |
} |
| 521 |
this._currentSelection._entryWidget.setTime(this._displayDateForEntry(evt.entry).toLocaleTimeString()); |
| 522 |
this._currentSelection._entryWidget.setTitle(evt.entry.title.value); |
| 523 |
} else if(entrySelectionEvent.action == "post" && entrySelectionEvent.entry) { |
| 524 |
if(!this.localSaveOnly){ |
| 525 |
this.atomIO.addEntry(entrySelectionEvent.entry, this.url, lang.hitch(this,this._addEntry)); |
| 526 |
}else{ |
| 527 |
this._addEntry(entrySelectionEvent.entry); |
| 528 |
} |
| 529 |
} |
| 530 |
} |
| 531 |
}, |
| 532 |
|
| 533 |
_addEntry: function(entry) { |
| 534 |
|
| 535 |
|
| 536 |
|
| 537 |
|
| 538 |
|
| 539 |
this._feed.addEntry(entry); |
| 540 |
this.setFeed(this._feed); |
| 541 |
dojo.publish(this.entrySelectionTopic, [{ action: "set", source: this, feed: this._feed, entry: entry }]); |
| 542 |
}, |
| 543 |
|
| 544 |
destroy: function(){ |
| 545 |
|
| 546 |
|
| 547 |
this.clear(); |
| 548 |
arrayUtil.forEach(this._subscriptions, dojo.unsubscribe); |
| 549 |
} |
| 550 |
}); |
| 551 |
|
| 552 |
var FeedViewerEntry = FeedViewer.FeedViewerEntry = declare("dojox.atom.widget.FeedViewerEntry", [_Widget, _Templated],{ |
| 553 |
|
| 554 |
|
| 555 |
|
| 556 |
templateString: entryTemplate, |
| 557 |
|
| 558 |
entryNode: null, |
| 559 |
timeNode: null, |
| 560 |
deleteButton: null, |
| 561 |
entry: null, |
| 562 |
feed: null, |
| 563 |
|
| 564 |
postCreate: function(){ |
| 565 |
var _nlsResources = i18nViewer; |
| 566 |
this.deleteButton.innerHTML = _nlsResources.deleteButton; |
| 567 |
}, |
| 568 |
|
| 569 |
setTitle: function(text){ |
| 570 |
|
| 571 |
|
| 572 |
|
| 573 |
|
| 574 |
|
| 575 |
|
| 576 |
if (this.titleNode.lastChild){this.titleNode.removeChild(this.titleNode.lastChild);} |
| 577 |
|
| 578 |
var titleTextNode = document.createElement("div"); |
| 579 |
titleTextNode.innerHTML = text; |
| 580 |
this.titleNode.appendChild(titleTextNode); |
| 581 |
}, |
| 582 |
|
| 583 |
setTime: function(timeText){ |
| 584 |
|
| 585 |
|
| 586 |
|
| 587 |
|
| 588 |
|
| 589 |
|
| 590 |
if (this.timeNode.lastChild){this.timeNode.removeChild(this.timeNode.lastChild);} |
| 591 |
var timeTextNode = document.createTextNode(timeText); |
| 592 |
this.timeNode.appendChild(timeTextNode); |
| 593 |
}, |
| 594 |
|
| 595 |
enableDelete: function(){ |
| 596 |
|
| 597 |
|
| 598 |
|
| 599 |
|
| 600 |
if (this.deleteButton !== null) { |
| 601 |
|
| 602 |
this.deleteButton.style.display = 'inline'; |
| 603 |
} |
| 604 |
}, |
| 605 |
|
| 606 |
disableDelete: function(){ |
| 607 |
|
| 608 |
|
| 609 |
|
| 610 |
|
| 611 |
if (this.deleteButton !== null) { |
| 612 |
this.deleteButton.style.display = 'none'; |
| 613 |
} |
| 614 |
}, |
| 615 |
|
| 616 |
deleteEntry: function(event) { |
| 617 |
|
| 618 |
|
| 619 |
|
| 620 |
|
| 621 |
event.preventDefault(); |
| 622 |
event.stopPropagation(); |
| 623 |
this.feed.deleteEntry(this); |
| 624 |
}, |
| 625 |
|
| 626 |
onClick: function(e){ |
| 627 |
|
| 628 |
|
| 629 |
|
| 630 |
|
| 631 |
} |
| 632 |
}); |
| 633 |
|
| 634 |
var FeedViewerGrouping = FeedViewer.FeedViewerGrouping = declare("dojox.atom.widget.FeedViewerGrouping", [_Widget, _Templated],{ |
| 635 |
|
| 636 |
|
| 637 |
|
| 638 |
templateString: groupingTemplate, |
| 639 |
|
| 640 |
groupingNode: null, |
| 641 |
titleNode: null, |
| 642 |
|
| 643 |
setText: function(text){ |
| 644 |
|
| 645 |
|
| 646 |
|
| 647 |
|
| 648 |
if (this.titleNode.lastChild){this.titleNode.removeChild(this.titleNode.lastChild);} |
| 649 |
var textNode = document.createTextNode(text); |
| 650 |
this.titleNode.appendChild(textNode); |
| 651 |
} |
| 652 |
}); |
| 653 |
|
| 654 |
FeedViewer.AtomEntryCategoryFilter = declare("dojox.atom.widget.AtomEntryCategoryFilter", null,{ |
| 655 |
|
| 656 |
|
| 657 |
scheme: "", |
| 658 |
term: "", |
| 659 |
label: "", |
| 660 |
isFilter: true |
| 661 |
}); |
| 662 |
|
| 663 |
FeedViewer.CategoryIncludeFilter = declare("dojox.atom.widget.FeedViewer.CategoryIncludeFilter", null,{ |
| 664 |
constructor: function(scheme, term, label){ |
| 665 |
|
| 666 |
|
| 667 |
this.scheme = scheme; |
| 668 |
this.term = term; |
| 669 |
this.label = label; |
| 670 |
}, |
| 671 |
|
| 672 |
match: function(entry) { |
| 673 |
|
| 674 |
|
| 675 |
|
| 676 |
|
| 677 |
var matched = false; |
| 678 |
if (entry !== null) { |
| 679 |
var categories = entry.categories; |
| 680 |
if (categories !== null) { |
| 681 |
for (var i = 0; i < categories.length; i++) { |
| 682 |
var category = categories[i]; |
| 683 |
|
| 684 |
if (this.scheme !== "") { |
| 685 |
if (this.scheme !== category.scheme) { |
| 686 |
break; |
| 687 |
} |
| 688 |
} |
| 689 |
|
| 690 |
if (this.term !== "") { |
| 691 |
if (this.term !== category.term) { |
| 692 |
break; |
| 693 |
} |
| 694 |
} |
| 695 |
|
| 696 |
if (this.label !== "") { |
| 697 |
if (this.label !== category.label) { |
| 698 |
break; |
| 699 |
} |
| 700 |
} |
| 701 |
|
| 702 |
matched = true; |
| 703 |
} |
| 704 |
} |
| 705 |
} |
| 706 |
return matched; |
| 707 |
} |
| 708 |
}); |
| 709 |
|
| 710 |
return FeedViewer; |
| 711 |
}); |