Debian Codegraph @

dojox/atom/widget/FeedEntryViewer.js

raw symbols SCIP
1 define([
2 "dojo/_base/kernel",
3 "dojo/_base/connect",
4 "dojo/_base/declare",
5 "dojo/_base/fx",
6 "dojo/_base/array",
7 "dojo/dom-style",
8 "dojo/dom-construct",
9 "dijit/_Widget",
10 "dijit/_Templated",
11 "dijit/_Container",
12 "dijit/layout/ContentPane",
13 "../io/Connection",
14 "dojo/text!./templates/FeedEntryViewer.html",
15 "dojo/text!./templates/EntryHeader.html",
16 "dojo/i18n!./nls/FeedEntryViewer"
17 ], function (dojo, connect, declare, fx, arrayUtil, domStyle, domConstruct, _Widget, _Templated, _Container, ContentPane, Connection, template, headerTemplate, i18nViewer) {
18
19 dojo.experimental("dojox.atom.widget.FeedEntryViewer");
20
21
22 var FeedEntryViewer = declare("dojox.atom.widget.FeedEntryViewer", [_Widget, _Templated, _Container],{
23 // summary:
24 // An ATOM feed entry editor for publishing updated ATOM entries, or viewing non-editable entries.
25
26 entrySelectionTopic: "", //The topic to listen on for entries to edit.
27
28 _validEntryFields: {}, //The entry fields that were present on the entry and are being displayed.
29 //This works in conjunction with what is selected to be displayed.
30 displayEntrySections: "", //What current sections of the entries to display as a comma separated list.
31 _displayEntrySections: null,
32
33 //Control options for the display options menu.
34 enableMenu: false,
35 enableMenuFade: false,
36 _optionButtonDisplayed: true,
37
38 //Templates for the HTML rendering. Need to figure these out better, admittedly.
39 templateString: template,
40
41 _entry: null, //The entry that is being viewed/edited.
42 _feed: null, //The feed the entry came from.
43
44 _editMode: false, //Flag denoting the state of the widget, in edit mode or not.
45
46 postCreate: function(){
47 if(this.entrySelectionTopic !== ""){
48 this._subscriptions = [dojo.subscribe(this.entrySelectionTopic, this, "_handleEvent")];
49 }
50 var _nlsResources = i18nViewer;
51 this.displayOptions.innerHTML = _nlsResources.displayOptions;
52 this.feedEntryCheckBoxLabelTitle.innerHTML = _nlsResources.title;
53 this.feedEntryCheckBoxLabelAuthors.innerHTML = _nlsResources.authors;
54 this.feedEntryCheckBoxLabelContributors.innerHTML = _nlsResources.contributors;
55 this.feedEntryCheckBoxLabelId.innerHTML = _nlsResources.id;
56 this.close.innerHTML = _nlsResources.close;
57 this.feedEntryCheckBoxLabelUpdated.innerHTML = _nlsResources.updated;
58 this.feedEntryCheckBoxLabelSummary.innerHTML = _nlsResources.summary;
59 this.feedEntryCheckBoxLabelContent.innerHTML = _nlsResources.content;
60 },
61
62 startup: function(){
63 if(this.displayEntrySections === ""){
64 this._displayEntrySections = ["title","authors","contributors","summary","content","id","updated"];
65 }else{
66 this._displayEntrySections = this.displayEntrySections.split(",");
67 }
68 this._setDisplaySectionsCheckboxes();
69
70 if(this.enableMenu){
71 domStyle.set(this.feedEntryViewerMenu, 'display', '');
72 if(this.entryCheckBoxRow && this.entryCheckBoxRow2){
73 if(this.enableMenuFade){
74 fx.fadeOut({node: this.entryCheckBoxRow,duration: 250}).play();
75 fx.fadeOut({node: this.entryCheckBoxRow2,duration: 250}).play();
76 }
77 }
78 }
79 },
80
81 clear: function(){
82 // summary:
83 // Function to clear the state of the widget.
84
85 this.destroyDescendants();
86 this._entry=null;
87 this._feed=null;
88 this.clearNodes();
89 },
90
91 clearNodes: function(){
92 // summary:
93 // Function to clear all the display nodes for the ATOM entry from the viewer.
94
95 arrayUtil.forEach([
96 "entryTitleRow", "entryAuthorRow", "entryContributorRow", "entrySummaryRow", "entryContentRow",
97 "entryIdRow", "entryUpdatedRow"
98 ], function(node){
99 domStyle.set(this[node], "display", "none");
100 }, this);
101
102 arrayUtil.forEach([
103 "entryTitleNode", "entryTitleHeader", "entryAuthorHeader", "entryContributorHeader",
104 "entryContributorNode", "entrySummaryHeader", "entrySummaryNode", "entryContentHeader",
105 "entryContentNode", "entryIdNode", "entryIdHeader", "entryUpdatedHeader", "entryUpdatedNode"
106 ], function(part){
107 while(this[part].firstChild){
108 domConstruct.destroy(this[part].firstChild);
109 }
110 }
111 ,this);
112
113 },
114
115 setEntry: function(/*object*/entry, /*object*/feed, /*boolean*/leaveMenuState){
116 // summary:
117 // Function to set the current entry that is being edited.
118 // entry:
119 // Instance of dojox.atom.io.model.Entry to display for reading/editing.
120 this.clear();
121 this._validEntryFields = {};
122 this._entry = entry;
123 this._feed = feed;
124
125 if(entry !== null){
126 // Handle the title.
127 if(this.entryTitleHeader){
128 this.setTitleHeader(this.entryTitleHeader, entry);
129 }
130
131 if(this.entryTitleNode){
132 this.setTitle(this.entryTitleNode, this._editMode, entry);
133 }
134
135 if(this.entryAuthorHeader){
136 this.setAuthorsHeader(this.entryAuthorHeader, entry);
137 }
138
139 if(this.entryAuthorNode){
140 this.setAuthors(this.entryAuthorNode, this._editMode, entry);
141 }
142
143 if(this.entryContributorHeader){
144 this.setContributorsHeader(this.entryContributorHeader, entry);
145 }
146
147 if(this.entryContributorNode){
148 this.setContributors(this.entryContributorNode, this._editMode, entry);
149 }
150
151 if(this.entryIdHeader){
152 this.setIdHeader(this.entryIdHeader, entry);
153 }
154
155 if(this.entryIdNode){
156 this.setId(this.entryIdNode, this._editMode, entry);
157 }
158
159 if(this.entryUpdatedHeader){
160 this.setUpdatedHeader(this.entryUpdatedHeader, entry);
161 }
162
163 if(this.entryUpdatedNode){
164 this.setUpdated(this.entryUpdatedNode, this._editMode, entry);
165 }
166
167 if(this.entrySummaryHeader){
168 this.setSummaryHeader(this.entrySummaryHeader, entry);
169 }
170
171 if(this.entrySummaryNode){
172 this.setSummary(this.entrySummaryNode, this._editMode, entry);
173 }
174
175 if(this.entryContentHeader){
176 this.setContentHeader(this.entryContentHeader, entry);
177 }
178
179 if(this.entryContentNode){
180 this.setContent(this.entryContentNode, this._editMode, entry);
181 }
182 }
183 this._displaySections();
184 },
185
186 setTitleHeader: function(/*DOMNode*/ titleHeaderNode, /*object*/entry){
187 // summary:
188 // Function to set the contents of the title header node in the template to some value.
189 // description:
190 // Function to set the contents of the title header node in the template to some value.
191 // This exists specifically so users can over-ride how the title data is filled out from an entry.
192 // titleAnchorNode:
193 // The DOM node to attach the title data to.
194 // editMode:
195 // Boolean to indicate if the display should be in edit mode or not.
196 // entry:
197 // The Feed Entry to work with.
198
199 if(entry.title && entry.title.value && entry.title.value !== null){
200 var _nlsResources = i18nViewer;
201 var titleHeader = new EntryHeader({title: _nlsResources.title});
202 titleHeaderNode.appendChild(titleHeader.domNode);
203 }
204 },
205
206 setTitle: function(titleAnchorNode, editMode, entry){
207 // summary:
208 // Function to set the contents of the title node in the template to some value from the entry.
209 // description:
210 // Function to set the contents of the title node in the template to some value from the entry.
211 // This exists specifically so users can over-ride how the title data is filled out from an entry.
212 // titleAnchorNode:
213 // The DOM node to attach the title data to.
214 // editMode:
215 // Boolean to indicate if the display should be in edit mode or not.
216 // entry:
217 // The Feed Entry to work with.
218 if(entry.title && entry.title.value && entry.title.value !== null){
219 if(entry.title.type == "text"){
220 var titleNode = document.createTextNode(entry.title.value);
221 titleAnchorNode.appendChild(titleNode);
222 }else{
223 var titleViewNode = document.createElement("span");
224 var titleView = new ContentPane({refreshOnShow: true, executeScripts: false}, titleViewNode);
225 titleView.attr('content', entry.title.value);
226 titleAnchorNode.appendChild(titleView.domNode);
227 }
228 this.setFieldValidity("title", true);
229 }
230 },
231
232 setAuthorsHeader: function(/*DOMNode*/ authorHeaderNode, /*object*/entry){
233 // summary:
234 // Function to set the title format for the authors section of the author row in the template to some value from the entry.
235 // description:
236 // Function to set the title format for the authors section of the author row in the template to some value from the entry.
237 // This exists specifically so users can over-ride how the author data is filled out from an entry.
238 // authorHeaderNode:
239 // The DOM node to attach the author section header data to.
240 // entry:
241 // The Feed Entry to work with.
242 if(entry.authors && entry.authors.length > 0){
243 var _nlsResources = i18nViewer;
244 var authorHeader = new EntryHeader({title: _nlsResources.authors});
245 authorHeaderNode.appendChild(authorHeader.domNode);
246 }
247 },
248
249 setAuthors: function(/*DOMNode*/ authorsAnchorNode, /*boolean*/editMode, /*object*/entry){
250 // summary:
251 // Function to set the contents of the author node in the template to some value from the entry.
252 // description:
253 // Function to set the contents of the author node in the template to some value from the entry.
254 // This exists specifically so users can over-ride how the title data is filled out from an entry.
255 // authorsAnchorNode:
256 // The DOM node to attach the author data to.
257 // editMode:
258 // Boolean to indicate if the display should be in edit mode or not.
259 // entry:
260 // The Feed Entry to work with.
261 authorsAnchorNode.innerHTML = "";
262 if(entry.authors && entry.authors.length > 0){
263 for(var i in entry.authors){
264 if(entry.authors[i].name){
265 var anchor = authorsAnchorNode;
266 if(entry.authors[i].uri){
267 var link = document.createElement("a");
268 anchor.appendChild(link);
269 link.href = entry.authors[i].uri;
270 anchor = link;
271 }
272 var name = entry.authors[i].name;
273 if(entry.authors[i].email){
274 name = name + " (" + entry.authors[i].email + ")";
275 }
276 var authorNode = document.createTextNode(name);
277 anchor.appendChild(authorNode);
278 var breakNode = document.createElement("br");
279 authorsAnchorNode.appendChild(breakNode);
280 this.setFieldValidity("authors", true);
281 }
282 }
283 }
284 },
285
286 setContributorsHeader: function(/*DOMNode*/ contributorsHeaderNode, /*object*/entry){
287 // summary:
288 // Function to set the contents of the contributor header node in the template to some value from the entry.
289 // description:
290 // Function to set the contents of the contributor header node in the template to some value from the entry.
291 // This exists specifically so users can over-ride how the title data is filled out from an entry.
292 // contributorsHeaderNode:
293 // The DOM node to attach the contributor title to.
294 // entry:
295 // The Feed Entry to work with.
296 if(entry.contributors && entry.contributors.length > 0){
297 var _nlsResources = i18nViewer;
298 var contributorHeader = new EntryHeader({title: _nlsResources.contributors});
299 contributorsHeaderNode.appendChild(contributorHeader.domNode);
300 }
301 },
302
303
304 setContributors: function(/*DOMNode*/ contributorsAnchorNode, /*boolean*/editMode, /*object*/entry){
305 // summary:
306 // Function to set the contents of the contributor node in the template to some value from the entry.
307 // description:
308 // Function to set the contents of the contributor node in the template to some value from the entry.
309 // This exists specifically so users can over-ride how the title data is filled out from an entry.
310 // contributorsAnchorNode:
311 // The DOM node to attach the contributor data to.
312 // editMode:
313 // Boolean to indicate if the display should be in edit mode or not.
314 // entry:
315 // The Feed Entry to work with.
316 if(entry.contributors && entry.contributors.length > 0){
317 for(var i in entry.contributors){
318 var contributorNode = document.createTextNode(entry.contributors[i].name);
319 contributorsAnchorNode.appendChild(contributorNode);
320 var breakNode = document.createElement("br");
321 contributorsAnchorNode.appendChild(breakNode);
322 this.setFieldValidity("contributors", true);
323 }
324 }
325 },
326
327
328 setIdHeader: function(/*DOMNode*/ idHeaderNode, /*object*/entry){
329 // summary:
330 // Function to set the contents of the ID node in the template to some value from the entry.
331 // description:
332 // Function to set the contents of the ID node in the template to some value from the entry.
333 // This exists specifically so users can over-ride how the title data is filled out from an entry.
334 // idAnchorNode:
335 // The DOM node to attach the ID data to.
336 // entry:
337 // The Feed Entry to work with.
338 if(entry.id && entry.id !== null){
339 var _nlsResources = i18nViewer;
340 var idHeader = new EntryHeader({title: _nlsResources.id});
341 idHeaderNode.appendChild(idHeader.domNode);
342 }
343 },
344
345
346 setId: function(/*DOMNode*/ idAnchorNode, /*boolean*/editMode, /*object*/entry){
347 // summary:
348 // Function to set the contents of the ID node in the template to some value from the entry.
349 // description:
350 // Function to set the contents of the ID node in the template to some value from the entry.
351 // This exists specifically so users can over-ride how the title data is filled out from an entry.
352 // idAnchorNode:
353 // The DOM node to attach the ID data to.
354 // editMode:
355 // Boolean to indicate if the display should be in edit mode or not.
356 // entry:
357 // The Feed Entry to work with.
358 if(entry.id && entry.id !== null){
359 var idNode = document.createTextNode(entry.id);
360 idAnchorNode.appendChild(idNode);
361 this.setFieldValidity("id", true);
362 }
363 },
364
365 setUpdatedHeader: function(/*DOMNode*/ updatedHeaderNode, /*object*/entry){
366 // summary:
367 // Function to set the contents of the updated header node in the template to some value from the entry.
368 // description:
369 // Function to set the contents of the updated header node in the template to some value from the entry.
370 // This exists specifically so users can over-ride how the title data is filled out from an entry.
371 // updatedHeaderNode:
372 // The DOM node to attach the updated header data to.
373 // entry:
374 // The Feed Entry to work with.
375 if(entry.updated && entry.updated !== null){
376 var _nlsResources = i18nViewer;
377 var updatedHeader = new EntryHeader({title: _nlsResources.updated});
378 updatedHeaderNode.appendChild(updatedHeader.domNode);
379 }
380 },
381
382 setUpdated: function(/*DOMNode*/ updatedAnchorNode, /*boolean*/editMode, /*object*/entry){
383 // summary:
384 // Function to set the contents of the updated node in the template to some value from the entry.
385 // description:
386 // Function to set the contents of the updated node in the template to some value from the entry.
387 // This exists specifically so users can over-ride how the title data is filled out from an entry.
388 // updatedAnchorNode:
389 // The DOM node to attach the udpated data to.
390 // editMode:
391 // Boolean to indicate if the display should be in edit mode or not.
392 // entry:
393 // The Feed Entry to work with.
394 if(entry.updated && entry.updated !== null){
395 var updatedNode = document.createTextNode(entry.updated);
396 updatedAnchorNode.appendChild(updatedNode);
397 this.setFieldValidity("updated", true);
398 }
399 },
400
401 setSummaryHeader: function(/*DOMNode*/ summaryHeaderNode, /*object*/entry){
402 // summary:
403 // Function to set the contents of the summary node in the template to some value from the entry.
404 // description:
405 // Function to set the contents of the summary node in the template to some value from the entry.
406 // This exists specifically so users can over-ride how the title data is filled out from an entry.
407 // summaryHeaderNode:
408 // The DOM node to attach the summary title to.
409 // entry:
410 // The Feed Entry to work with.
411 if(entry.summary && entry.summary.value && entry.summary.value !== null){
412 var _nlsResources = i18nViewer;
413 var summaryHeader = new EntryHeader({title: _nlsResources.summary});
414 summaryHeaderNode.appendChild(summaryHeader.domNode);
415 }
416 },
417
418
419 setSummary: function(/*DOMNode*/ summaryAnchorNode, /*boolean*/editMode, /*object*/entry){
420 // summary:
421 // Function to set the contents of the summary node in the template to some value from the entry.
422 // description:
423 // Function to set the contents of the summary node in the template to some value from the entry.
424 // This exists specifically so users can over-ride how the title data is filled out from an entry.
425 // summaryAnchorNode:
426 // The DOM node to attach the summary data to.
427 // editMode:
428 // Boolean to indicate if the display should be in edit mode or not.
429 // entry:
430 // The Feed Entry to work with.
431 if(entry.summary && entry.summary.value && entry.summary.value !== null){
432 var summaryViewNode = document.createElement("span");
433 var summaryView = new ContentPane({refreshOnShow: true, executeScripts: false}, summaryViewNode);
434 summaryView.attr('content', entry.summary.value);
435 summaryAnchorNode.appendChild(summaryView.domNode);
436 this.setFieldValidity("summary", true);
437 }
438 },
439
440 setContentHeader: function(/*DOMNode*/ contentHeaderNode, /*object*/entry){
441 // summary:
442 // Function to set the contents of the content node in the template to some value from the entry.
443 // description:
444 // Function to set the contents of the content node in the template to some value from the entry.
445 // This exists specifically so users can over-ride how the title data is filled out from an entry.
446 // contentHeaderNode:
447 // The DOM node to attach the content data to.
448 // entry:
449 // The Feed Entry to work with.
450 if(entry.content && entry.content.value && entry.content.value !== null){
451 var _nlsResources = i18nViewer;
452 var contentHeader = new EntryHeader({title: _nlsResources.content});
453 contentHeaderNode.appendChild(contentHeader.domNode);
454 }
455 },
456
457 setContent: function(/*DOMNode*/ contentAnchorNode, /*boolean*/editMode, /*object*/entry){
458 // summary:
459 // Function to set the contents of the content node in the template to some value from the entry.
460 // description:
461 // Function to set the contents of the content node in the template to some value from the entry.
462 // This exists specifically so users can over-ride how the title data is filled out from an entry.
463 // contentAnchorNode:
464 // The DOM node to attach the content data to.
465 // editMode:
466 // Boolean to indicate if the display should be in edit mode or not.
467 // entry:
468 // The Feed Entry to work with.
469 if(entry.content && entry.content.value && entry.content.value !== null){
470 var contentViewNode = document.createElement("span");
471 var contentView = new ContentPane({refreshOnShow: true, executeScripts: false},contentViewNode);
472 contentView.attr('content', entry.content.value);
473 contentAnchorNode.appendChild(contentView.domNode);
474 this.setFieldValidity("content", true);
475 }
476 },
477
478
479 _displaySections: function(){
480 // summary:
481 // Internal function for determining which sections of the view to actually display.
482 // returns:
483 // Nothing.
484 domStyle.set(this.entryTitleRow, 'display', 'none');
485 domStyle.set(this.entryAuthorRow, 'display', 'none');
486 domStyle.set(this.entryContributorRow, 'display', 'none');
487 domStyle.set(this.entrySummaryRow, 'display', 'none');
488 domStyle.set(this.entryContentRow, 'display', 'none');
489 domStyle.set(this.entryIdRow, 'display', 'none');
490 domStyle.set(this.entryUpdatedRow, 'display', 'none');
491
492 for(var i in this._displayEntrySections){
493 var section = this._displayEntrySections[i].toLowerCase();
494 if(section === "title" && this.isFieldValid("title")){
495 domStyle.set(this.entryTitleRow, 'display', '');
496 }
497 if(section === "authors" && this.isFieldValid("authors")){
498 domStyle.set(this.entryAuthorRow, 'display', '');
499 }
500 if(section === "contributors" && this.isFieldValid("contributors")){
501 domStyle.set(this.entryContributorRow, 'display', '');
502 }
503 if(section === "summary" && this.isFieldValid("summary")){
504 domStyle.set(this.entrySummaryRow, 'display', '');
505 }
506 if(section === "content" && this.isFieldValid("content")){
507 domStyle.set(this.entryContentRow, 'display', '');
508 }
509 if(section === "id" && this.isFieldValid("id")){
510 domStyle.set(this.entryIdRow, 'display', '');
511 }
512 if(section === "updated" && this.isFieldValid("updated")){
513 domStyle.set(this.entryUpdatedRow, 'display', '');
514 }
515
516 }
517 },
518
519 setDisplaySections: function(/*array*/sectionsArray){
520 // summary:
521 // Function for setting which sections of the entry should be displayed.
522 // sectionsArray:
523 // Array of string names that indicate which sections to display.
524 // returns:
525 // Nothing.
526 if(sectionsArray !== null){
527 this._displayEntrySections = sectionsArray;
528 this._displaySections();
529 }else{
530 this._displayEntrySections = ["title","authors","contributors","summary","content","id","updated"];
531 }
532 },
533
534 _setDisplaySectionsCheckboxes: function(){
535 // summary:
536 // Internal function for setting which checkboxes on the display are selected.
537 // returns:
538 // Nothing.
539 var items = ["title","authors","contributors","summary","content","id","updated"];
540 for(var i in items){
541 if(arrayUtil.indexOf(this._displayEntrySections, items[i]) == -1){
542 domStyle.set(this["feedEntryCell"+items[i]], 'display', 'none');
543 }else{
544 this["feedEntryCheckBox"+items[i].substring(0,1).toUpperCase()+items[i].substring(1)].checked=true;
545 }
546 }
547 },
548
549 _readDisplaySections: function(){
550 // summary:
551 // Internal function for reading what is currently checked for display and generating the display list from it.
552 var checkedList = [];
553
554 if(this.feedEntryCheckBoxTitle.checked){
555 checkedList.push("title");
556 }
557 if(this.feedEntryCheckBoxAuthors.checked){
558 checkedList.push("authors");
559 }
560 if(this.feedEntryCheckBoxContributors.checked){
561 checkedList.push("contributors");
562 }
563 if(this.feedEntryCheckBoxSummary.checked){
564 checkedList.push("summary");
565 }
566 if(this.feedEntryCheckBoxContent.checked){
567 checkedList.push("content");
568 }
569 if(this.feedEntryCheckBoxId.checked){
570 checkedList.push("id");
571 }
572 if(this.feedEntryCheckBoxUpdated.checked){
573 checkedList.push("updated");
574 }
575 this._displayEntrySections = checkedList;
576 },
577
578 _toggleCheckbox: function(/*object*/checkBox){
579 // summary:
580 // Internal function for determining of a particular entry is editable.
581 // description:
582 // Internal function for determining of a particular entry is editable.
583 // This is used for determining if the delete action should be displayed or not.
584 // checkBox:
585 // The checkbox object to toggle the selection on.
586 if(checkBox.checked){
587 checkBox.checked=false;
588 }else{
589 checkBox.checked=true;
590 }
591 this._readDisplaySections();
592 this._displaySections();
593 },
594
595 _toggleOptions: function(/*object*/checkBox){
596 // summary:
597 // Internal function for determining of a particular entry is editable.
598 // description:
599 // Internal function for determining of a particular entry is editable.
600 // This is used for determining if the delete action should be displayed or not.
601 // checkBox:
602 // The checkbox object to toggle the selection on.
603 if(this.enableMenu){
604 var fade = null;
605 var anim;
606 var anim2;
607 if(this._optionButtonDisplayed){
608 if(this.enableMenuFade){
609 anim = fx.fadeOut({node: this.entryCheckBoxDisplayOptions,duration: 250});
610 connect.connect(anim, "onEnd", this, function(){
611 domStyle.set(this.entryCheckBoxDisplayOptions, 'display', 'none');
612 domStyle.set(this.entryCheckBoxRow, 'display', '');
613 domStyle.set(this.entryCheckBoxRow2, 'display', '');
614 fx.fadeIn({node: this.entryCheckBoxRow, duration: 250}).play();
615 fx.fadeIn({node: this.entryCheckBoxRow2, duration: 250}).play();
616 });
617 anim.play();
618 }else{
619 domStyle.set(this.entryCheckBoxDisplayOptions, 'display', 'none');
620 domStyle.set(this.entryCheckBoxRow, 'display', '');
621 domStyle.set(this.entryCheckBoxRow2, 'display', '');
622 }
623 this._optionButtonDisplayed=false;
624 }else{
625 if(this.enableMenuFade){
626 anim = fx.fadeOut({node: this.entryCheckBoxRow,duration: 250});
627 anim2 = fx.fadeOut({node: this.entryCheckBoxRow2,duration: 250});
628 connect.connect(anim, "onEnd", this, function(){
629 domStyle.set(this.entryCheckBoxRow, 'display', 'none');
630 domStyle.set(this.entryCheckBoxRow2, 'display', 'none');
631 domStyle.set(this.entryCheckBoxDisplayOptions, 'display', '');
632 fx.fadeIn({node: this.entryCheckBoxDisplayOptions, duration: 250}).play();
633 });
634 anim.play();
635 anim2.play();
636 }else{
637 domStyle.set(this.entryCheckBoxRow, 'display', 'none');
638 domStyle.set(this.entryCheckBoxRow2, 'display', 'none');
639 domStyle.set(this.entryCheckBoxDisplayOptions, 'display', '');
640 }
641 this._optionButtonDisplayed=true;
642 }
643 }
644 },
645
646 _handleEvent: function(/*object*/entrySelectionEvent){
647 // summary:
648 // Internal function for listening to a topic that will handle entry notification.
649 // entrySelectionEvent:
650 // The topic message containing the entry that was selected for view.
651 // returns:
652 // Nothing.
653 if(entrySelectionEvent.source != this){
654 if(entrySelectionEvent.action == "set" && entrySelectionEvent.entry){
655 this.setEntry(entrySelectionEvent.entry, entrySelectionEvent.feed);
656 }else if(entrySelectionEvent.action == "delete" && entrySelectionEvent.entry && entrySelectionEvent.entry == this._entry){
657 this.clear();
658 }
659 }
660 },
661
662 setFieldValidity: function(/*string*/field, /*boolean*/isValid){
663 // summary:
664 // Function to set whether a field in the view is valid and displayable.
665 // description:
666 // Function to set whether a field in the view is valid and displayable.
667 // This is needed for over-riding of the set* functions and customization of how data is displayed in the attach point.
668 // So if custom implementations use their own display logic, they can still enable the field.
669 // field:
670 // The field name to set the valid parameter on. Such as 'content', 'id', etc.
671 // isValid:
672 // Flag denoting if the field is valid or not.
673 // returns:
674 // Nothing.
675 if(field){
676 var lowerField = field.toLowerCase();
677 this._validEntryFields[field] = isValid;
678 }
679 },
680
681 isFieldValid: function(/*string*/field){
682 // summary:
683 // Function to return if a displayable field is valid or not
684 // field:
685 // The field name to get the valid parameter of. Such as 'content', 'id', etc.
686 // returns:
687 // boolean denoting if the field is valid and set.
688 return this._validEntryFields[field.toLowerCase()];
689 },
690
691 getEntry: function(){
692 return this._entry;
693 },
694
695 getFeed: function(){
696 return this._feed;
697 },
698
699 destroy: function(){
700 this.clear();
701 arrayUtil.forEach(this._subscriptions, dojo.unsubscribe);
702 }
703 });
704
705 var EntryHeader = FeedEntryViewer.EntryHeader = declare("dojox.atom.widget.EntryHeader", [_Widget, _Templated, _Container],{
706 // summary:
707 // Widget representing a header in a FeedEntryViewer/Editor
708 title: "",
709 templateString: headerTemplate,
710
711 postCreate: function(){
712 this.setListHeader();
713 },
714
715 setListHeader: function(/*string*/title){
716 this.clear();
717 if(title){
718 this.title = title;
719 }
720 var textNode = document.createTextNode(this.title);
721 this.entryHeaderNode.appendChild(textNode);
722 },
723
724 clear: function(){
725 this.destroyDescendants();
726 if(this.entryHeaderNode){
727 for(var i = 0; i < this.entryHeaderNode.childNodes.length; i++){
728 this.entryHeaderNode.removeChild(this.entryHeaderNode.childNodes[i]);
729 }
730 }
731 },
732
733 destroy: function(){
734 this.clear();
735 }
736 });
737
738
739 return FeedEntryViewer;
740 });