a:83:{s:9:"#provides";s:33:"dojox.atom.widget.FeedEntryEditor";s:9:"#resource";s:30:"atom/widget/FeedEntryEditor.js";s:9:"#requires";a:7:{i:0;a:2:{i:0;s:6:"common";i:1;s:33:"dojox.atom.widget.FeedEntryViewer";}i:1;a:3:{i:0;s:6:"common";i:1;s:13:"dijit._Widget";i:2;s:5:"dijit";}i:2;a:3:{i:0;s:6:"common";i:1;s:16:"dijit._Templated";i:2;s:5:"dijit";}i:3;a:3:{i:0;s:6:"common";i:1;s:16:"dijit._Container";i:2;s:5:"dijit";}i:4;a:3:{i:0;s:6:"common";i:1;s:12:"dijit.Editor";i:2;s:5:"dijit";}i:5;a:3:{i:0;s:6:"common";i:1;s:18:"dijit.form.TextBox";i:2;s:5:"dijit";}i:6;a:3:{i:0;s:6:"common";i:1;s:25:"dijit.form.SimpleTextarea";i:2;s:5:"dijit";}}s:33:"dojox.atom.widget.FeedEntryEditor";a:5:{s:4:"type";s:8:"Function";s:6:"chains";a:2:{s:9:"prototype";a:1:{i:0;s:33:"dojox.atom.widget.FeedEntryViewer";}s:4:"call";a:1:{i:0;s:33:"dojox.atom.widget.FeedEntryViewer";}}s:7:"summary";s:87:"An ATOM feed entry editor that allows viewing of the individual attributes of an entry.";s:11:"description";s:87:"An ATOM feed entry editor that allows viewing of the individual attributes of an entry.";s:9:"classlike";b:1;}s:48:"dojox.atom.widget.FeedEntryEditor._contentEditor";a:4:{s:9:"prototype";s:33:"dojox.atom.widget.FeedEntryEditor";s:8:"instance";s:33:"dojox.atom.widget.FeedEntryEditor";s:7:"private";b:1;s:7:"summary";s:0:"";}s:45:"dojox.atom.widget.FeedEntryEditor._oldContent";a:3:{s:9:"prototype";s:33:"dojox.atom.widget.FeedEntryEditor";s:7:"private";b:1;s:7:"summary";s:0:"";}s:44:"dojox.atom.widget.FeedEntryEditor._setObject";a:3:{s:9:"prototype";s:33:"dojox.atom.widget.FeedEntryEditor";s:7:"private";b:1;s:7:"summary";s:0:"";}s:44:"dojox.atom.widget.FeedEntryEditor.enableEdit";a:2:{s:9:"prototype";s:33:"dojox.atom.widget.FeedEntryEditor";s:7:"summary";s:0:"";}s:55:"dojox.atom.widget.FeedEntryEditor._contentEditorCreator";a:3:{s:9:"prototype";s:33:"dojox.atom.widget.FeedEntryEditor";s:7:"private";b:1;s:7:"summary";s:0:"";}s:42:"dojox.atom.widget.FeedEntryEditor._editors";a:5:{s:9:"prototype";s:33:"dojox.atom.widget.FeedEntryEditor";s:4:"type";s:6:"Object";s:8:"instance";s:33:"dojox.atom.widget.FeedEntryEditor";s:7:"private";b:1;s:7:"summary";s:0:"";}s:48:"dojox.atom.widget.FeedEntryEditor.entryNewButton";a:2:{s:9:"prototype";s:33:"dojox.atom.widget.FeedEntryEditor";s:7:"summary";s:0:"";}s:43:"dojox.atom.widget.FeedEntryEditor._editable";a:4:{s:9:"prototype";s:33:"dojox.atom.widget.FeedEntryEditor";s:8:"instance";s:33:"dojox.atom.widget.FeedEntryEditor";s:7:"private";b:1;s:7:"summary";s:0:"";}s:46:"dojox.atom.widget.FeedEntryEditor.templatePath";a:2:{s:9:"prototype";s:33:"dojox.atom.widget.FeedEntryEditor";s:7:"summary";s:0:"";}s:44:"dojox.atom.widget.FeedEntryEditor.postCreate";a:4:{s:9:"prototype";s:33:"dojox.atom.widget.FeedEntryEditor";s:4:"type";s:8:"Function";s:6:"source";s:1101:" if(this.entrySelectionTopic !== ""){ this._subscriptions = [dojo.subscribe(this.entrySelectionTopic, this, "_handleEvent")]; } var _nlsResources = dojo.i18n.getLocalization("dojox.atom.widget", "FeedEntryViewer"); this.displayOptions.innerHTML = _nlsResources.displayOptions; this.feedEntryCheckBoxLabelTitle.innerHTML = _nlsResources.title; this.feedEntryCheckBoxLabelAuthors.innerHTML = _nlsResources.authors; this.feedEntryCheckBoxLabelContributors.innerHTML = _nlsResources.contributors; this.feedEntryCheckBoxLabelId.innerHTML = _nlsResources.id; this.close.innerHTML = _nlsResources.close; this.feedEntryCheckBoxLabelUpdated.innerHTML = _nlsResources.updated; this.feedEntryCheckBoxLabelSummary.innerHTML = _nlsResources.summary; this.feedEntryCheckBoxLabelContent.innerHTML = _nlsResources.content; _nlsResources = dojo.i18n.getLocalization("dojox.atom.widget", "FeedEntryEditor"); this.doNew.innerHTML = _nlsResources.doNew; this.edit.innerHTML = _nlsResources.edit; this.save.innerHTML = _nlsResources.save; this.cancel.innerHTML = _nlsResources.cancel;";s:7:"summary";s:0:"";}s:42:"dojox.atom.widget.FeedEntryEditor.setEntry";a:7:{s:9:"prototype";s:33:"dojox.atom.widget.FeedEntryEditor";s:4:"type";s:8:"Function";s:10:"parameters";a:3:{s:5:"entry";a:2:{s:4:"type";s:6:"object";s:7:"summary";s:69:"Instance of dojox.atom.io.model.Entry to display for reading/editing.";}s:4:"feed";a:1:{s:4:"type";s:6:"object";}s:14:"leaveMenuState";a:1:{s:4:"type";s:7:"boolean";}}s:6:"source";s:784:" if(this._entry !== entry){ //If we swap entries, we don't want to keep the menu states and modes. this._editMode=false; leaveMenuState=false; }else{ leaveMenuState = true; } dojox.atom.widget.FeedEntryEditor.superclass.setEntry.call(this, entry, feed); this._editable = this._isEditable(entry); if(!leaveMenuState && !this._editable){ dojo.style(this.entryEditButton, 'display', 'none'); dojo.style(this.entrySaveCancelButtons, 'display', 'none'); } if(this._editable && this.enableEdit){ if(!leaveMenuState){ dojo.style(this.entryEditButton, 'display', ''); //TODO double check this &&... if(this.enableMenuFade && this.entrySaveCancelButton){ dojo.fadeOut({node: this.entrySaveCancelButton,duration: 250}).play(); } } }";s:7:"summary";s:55:"Function to set the current entry that is being edited.";s:11:"description";s:55:"Function to set the current entry that is being edited.";s:6:"chains";a:1:{s:4:"call";a:1:{i:0;s:53:"dojox.atom.widget.FeedEntryEditor.superclass.setEntry";}}}s:45:"dojox.atom.widget.FeedEntryEditor._toggleEdit";a:7:{s:9:"prototype";s:33:"dojox.atom.widget.FeedEntryEditor";s:4:"type";s:8:"Function";s:6:"source";s:289:" if(this._editable && this.enableEdit){ dojo.style(this.entryEditButton, 'display', 'none'); dojo.style(this.entrySaveCancelButtons, 'display', ''); this._editMode = true; //Rebuild the view using the same entry and feed. this.setEntry(this._entry, this._feed, true); }";s:7:"summary";s:64:"Internal function for toggling/enabling the display of edit mode";s:11:"description";s:64:"Internal function for toggling/enabling the display of edit mode";s:14:"return_summary";s:8:"Nothing.";s:7:"private";b:1;}s:46:"dojox.atom.widget.FeedEntryEditor._handleEvent";a:9:{s:9:"prototype";s:33:"dojox.atom.widget.FeedEntryEditor";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:19:"entrySelectionEvent";a:2:{s:4:"type";s:6:"object";s:7:"summary";s:66:"The topic message containing the entry that was selected for view.";}}s:6:"source";s:314:" if(entrySelectionEvent.source != this && entrySelectionEvent.action == "delete" && entrySelectionEvent.entry && entrySelectionEvent.entry == this._entry){ dojo.style(this.entryEditButton, 'display', 'none'); } dojox.atom.widget.FeedEntryEditor.superclass._handleEvent.call(this, entrySelectionEvent);";s:7:"summary";s:79:"Internal function for listening to a topic that will handle entry notification.";s:11:"description";s:79:"Internal function for listening to a topic that will handle entry notification.";s:14:"return_summary";s:8:"Nothing.";s:6:"chains";a:1:{s:4:"call";a:1:{i:0;s:57:"dojox.atom.widget.FeedEntryEditor.superclass._handleEvent";}}s:7:"private";b:1;}s:45:"dojox.atom.widget.FeedEntryEditor._isEditable";a:8:{s:9:"prototype";s:33:"dojox.atom.widget.FeedEntryEditor";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:5:"entry";a:2:{s:4:"type";s:6:"object";s:7:"summary";s:47:"The dojox.atom.io.model.Entry object to examine";}}s:6:"source";s:245:" var retVal = false; if(entry && entry !== null && entry.links && entry.links !== null){ for(var x in entry.links){ if(entry.links[x].rel && entry.links[x].rel == "edit"){ retVal = true; break; } } } return retVal;";s:7:"summary";s:68:"Internal function for determining of a particular entry is editable.";s:11:"description";s:146:"Internal function for determining of a particular entry is editable. This is used for determining if the delete action should be displayed or not.";s:14:"return_summary";s:53:"Boolean denoting if the entry seems editable or not..";s:7:"private";b:1;}s:42:"dojox.atom.widget.FeedEntryEditor.setTitle";a:7:{s:9:"prototype";s:33:"dojox.atom.widget.FeedEntryEditor";s:4:"type";s:8:"Function";s:10:"parameters";a:3:{s:15:"titleAnchorNode";a:2:{s:4:"type";s:8:"DOM node";s:7:"summary";s:41:"The DOM node to attach the title data to.";}s:8:"editMode";a:2:{s:4:"type";s:7:"boolean";s:7:"summary";s:65:"Boolean to indicate if the display should be in edit mode or not.";}s:5:"entry";a:2:{s:4:"type";s:6:"object";s:7:"summary";s:28:"The Feed Entry to work with.";}}s:6:"source";s:715:" if(!editMode){ dojox.atom.widget.FeedEntryEditor.superclass.setTitle.call(this, titleAnchorNode, editMode, entry); if(entry.title && entry.title.value && entry.title.value !== null){ this.setFieldValidity("title", true); } }else{ if(entry.title && entry.title.value && entry.title.value !== null){ if(!this._toLoad){ this._toLoad = []; } this.entryTitleSelect.value = entry.title.type; var editor = this._createEditor(titleAnchorNode, entry.title, true, entry.title.type === "html" || entry.title.type === "xhtml"); editor.name = "title"; this._toLoad.push(editor); this.setFieldValidity("titleedit",true); this.setFieldValidity("title",true); } }";s:7:"summary";s:92:"Function to set the contents of the title node in the template to some value from the entry.";s:11:"description";s:188:"Function to set the contents of the title node in the template to some value from the entry. This exists specifically so users can over-ride how the title data is filled out from an entry.";s:6:"chains";a:1:{s:4:"call";a:1:{i:0;s:53:"dojox.atom.widget.FeedEntryEditor.superclass.setTitle";}}}s:44:"dojox.atom.widget.FeedEntryEditor.setAuthors";a:7:{s:9:"prototype";s:33:"dojox.atom.widget.FeedEntryEditor";s:4:"type";s:8:"Function";s:10:"parameters";a:3:{s:17:"authorsAnchorNode";a:2:{s:4:"type";s:8:"DOM node";s:7:"summary";s:42:"The DOM node to attach the author data to.";}s:8:"editMode";a:2:{s:4:"type";s:7:"boolean";s:7:"summary";s:65:"Boolean to indicate if the display should be in edit mode or not.";}s:5:"entry";a:2:{s:4:"type";s:6:"object";s:7:"summary";s:28:"The Feed Entry to work with.";}}s:6:"source";s:449:" if(!editMode){ dojox.atom.widget.FeedEntryEditor.superclass.setAuthors.call(this, authorsAnchorNode, editMode, entry); if(entry.authors && entry.authors.length > 0){ this.setFieldValidity("authors", true); } }else{ if(entry.authors && entry.authors.length > 0){ this._editors.authors = this._createPeopleEditor(this.entryAuthorNode, {data: entry.authors, name: "Author"}); this.setFieldValidity("authors", true); } }";s:7:"summary";s:93:"Function to set the contents of the author node in the template to some value from the entry.";s:11:"description";s:189:"Function to set the contents of the author node in the template to some value from the entry. This exists specifically so users can over-ride how the title data is filled out from an entry.";s:6:"chains";a:1:{s:4:"call";a:1:{i:0;s:55:"dojox.atom.widget.FeedEntryEditor.superclass.setAuthors";}}}s:49:"dojox.atom.widget.FeedEntryEditor.setContributors";a:7:{s:9:"prototype";s:33:"dojox.atom.widget.FeedEntryEditor";s:4:"type";s:8:"Function";s:10:"parameters";a:3:{s:22:"contributorsAnchorNode";a:2:{s:4:"type";s:8:"DOM node";s:7:"summary";s:47:"The DOM node to attach the contributor data to.";}s:8:"editMode";a:2:{s:4:"type";s:7:"boolean";s:7:"summary";s:65:"Boolean to indicate if the display should be in edit mode or not.";}s:5:"entry";a:2:{s:4:"type";s:6:"object";s:7:"summary";s:28:"The Feed Entry to work with.";}}s:6:"source";s:509:" if(!editMode){ dojox.atom.widget.FeedEntryEditor.superclass.setContributors.call(this, contributorsAnchorNode, editMode, entry); if(entry.contributors && entry.contributors.length > 0){ this.setFieldValidity("contributors", true); } }else{ if(entry.contributors && entry.contributors.length > 0){ this._editors.contributors = this._createPeopleEditor(this.entryContributorNode, {data: entry.contributors, name: "Contributor"}); this.setFieldValidity("contributors", true); } }";s:7:"summary";s:98:"Function to set the contents of the contributor node in the template to some value from the entry.";s:11:"description";s:194:"Function to set the contents of the contributor node in the template to some value from the entry. This exists specifically so users can over-ride how the title data is filled out from an entry.";s:6:"chains";a:1:{s:4:"call";a:1:{i:0;s:60:"dojox.atom.widget.FeedEntryEditor.superclass.setContributors";}}}s:39:"dojox.atom.widget.FeedEntryEditor.setId";a:7:{s:9:"prototype";s:33:"dojox.atom.widget.FeedEntryEditor";s:4:"type";s:8:"Function";s:10:"parameters";a:3:{s:12:"idAnchorNode";a:2:{s:4:"type";s:8:"DOM node";s:7:"summary";s:38:"The DOM node to attach the ID data to.";}s:8:"editMode";a:2:{s:4:"type";s:7:"boolean";s:7:"summary";s:65:"Boolean to indicate if the display should be in edit mode or not.";}s:5:"entry";a:2:{s:4:"type";s:6:"object";s:7:"summary";s:28:"The Feed Entry to work with.";}}s:6:"source";s:356:" if(!editMode){ dojox.atom.widget.FeedEntryEditor.superclass.setId.call(this, idAnchorNode, editMode, entry); if(entry.id && entry.id !== null){ this.setFieldValidity("id", true); } }else{ if(entry.id && entry.id !== null){ this._editors.id = this._createEditor(idAnchorNode, entry.id); this.setFieldValidity("id",true); } }";s:7:"summary";s:90:"Function to set the contents of the ID node in the template to some value from the entry.";s:11:"description";s:185:"Function to set the contents of the ID node in the template to some value from the entry. This exists specifically so users can over-ride how the title data is filled out from an entry.";s:6:"chains";a:1:{s:4:"call";a:1:{i:0;s:50:"dojox.atom.widget.FeedEntryEditor.superclass.setId";}}}s:44:"dojox.atom.widget.FeedEntryEditor.setUpdated";a:7:{s:9:"prototype";s:33:"dojox.atom.widget.FeedEntryEditor";s:4:"type";s:8:"Function";s:10:"parameters";a:3:{s:17:"updatedAnchorNode";a:2:{s:4:"type";s:8:"DOM node";s:7:"summary";s:43:"The DOM node to attach the udpated data to.";}s:8:"editMode";a:2:{s:4:"type";s:7:"boolean";s:7:"summary";s:65:"Boolean to indicate if the display should be in edit mode or not.";}s:5:"entry";a:2:{s:4:"type";s:6:"object";s:7:"summary";s:28:"The Feed Entry to work with.";}}s:6:"source";s:411:" if(!editMode){ dojox.atom.widget.FeedEntryEditor.superclass.setUpdated.call(this, updatedAnchorNode, editMode, entry); if(entry.updated && entry.updated !== null){ this.setFieldValidity("updated", true); } }else{ if(entry.updated && entry.updated !== null){ this._editors.updated = this._createEditor(updatedAnchorNode, entry.updated); this.setFieldValidity("updated",true); } }";s:7:"summary";s:95:"Function to set the contents of the updated node in the template to some value from the entry.";s:11:"description";s:190:"Function to set the contents of the updated node in the template to some value from the entry. This exists specifically so users can over-ride how the title data is filled out from an entry.";s:6:"chains";a:1:{s:4:"call";a:1:{i:0;s:55:"dojox.atom.widget.FeedEntryEditor.superclass.setUpdated";}}}s:44:"dojox.atom.widget.FeedEntryEditor.setSummary";a:7:{s:9:"prototype";s:33:"dojox.atom.widget.FeedEntryEditor";s:4:"type";s:8:"Function";s:10:"parameters";a:3:{s:17:"summaryAnchorNode";a:2:{s:4:"type";s:8:"DOM node";s:7:"summary";s:43:"The DOM node to attach the summary data to.";}s:8:"editMode";a:2:{s:4:"type";s:7:"boolean";s:7:"summary";s:65:"Boolean to indicate if the display should be in edit mode or not.";}s:5:"entry";a:2:{s:4:"type";s:6:"object";s:7:"summary";s:28:"The Feed Entry to work with.";}}s:6:"source";s:751:" if(!editMode){ dojox.atom.widget.FeedEntryEditor.superclass.setSummary.call(this, summaryAnchorNode, editMode, entry); if(entry.summary && entry.summary.value && entry.summary.value !== null){ this.setFieldValidity("summary", true); } }else{ if(entry.summary && entry.summary.value && entry.summary.value !== null){ if(!this._toLoad){ this._toLoad = []; } this.entrySummarySelect.value = entry.summary.type; var editor = this._createEditor(summaryAnchorNode, entry.summary, true, entry.summary.type === "html" || entry.summary.type === "xhtml"); editor.name = "summary"; this._toLoad.push(editor); this.setFieldValidity("summaryedit",true); this.setFieldValidity("summary",true); } }";s:7:"summary";s:95:"Function to set the contents of the summary node in the template to some value from the entry.";s:11:"description";s:190:"Function to set the contents of the summary node in the template to some value from the entry. This exists specifically so users can over-ride how the title data is filled out from an entry.";s:6:"chains";a:1:{s:4:"call";a:1:{i:0;s:55:"dojox.atom.widget.FeedEntryEditor.superclass.setSummary";}}}s:44:"dojox.atom.widget.FeedEntryEditor.setContent";a:7:{s:9:"prototype";s:33:"dojox.atom.widget.FeedEntryEditor";s:4:"type";s:8:"Function";s:10:"parameters";a:3:{s:17:"contentAnchorNode";a:1:{s:4:"type";s:8:"DOM node";}s:8:"editMode";a:2:{s:4:"type";s:7:"boolean";s:7:"summary";s:65:"Boolean to indicate if the display should be in edit mode or not.";}s:5:"entry";a:2:{s:4:"type";s:6:"object";s:7:"summary";s:28:"The Feed Entry to work with.";}}s:6:"source";s:744:" if(!editMode){ dojox.atom.widget.FeedEntryEditor.superclass.setContent.call(this, contentAnchorNode, editMode, entry); if(entry.content && entry.content.value && entry.content.value !== null){ this.setFieldValidity("content",true); } }else{ if(entry.content && entry.content.value && entry.content.value !== null){ if(!this._toLoad){ this._toLoad = []; } this.entryContentSelect.value = entry.content.type; var editor = this._createEditor(contentAnchorNode, entry.content, true, entry.content.type === "html" || entry.content.type === "xhtml"); editor.name = "content"; this._toLoad.push(editor); this.setFieldValidity("contentedit",true); this.setFieldValidity("content",true); } }";s:7:"summary";s:94:"Function to set the contents of the content node in the template to some value from the entry.";s:11:"description";s:254:"Function to set the contents of the content node in the template to some value from the entry. This exists specifically so users can over-ride how the title data is filled out from an entry. summaryAnchorNode: The DOM node to attach the content data to.";s:6:"chains";a:1:{s:4:"call";a:1:{i:0;s:55:"dojox.atom.widget.FeedEntryEditor.superclass.setContent";}}}s:47:"dojox.atom.widget.FeedEntryEditor._createEditor";a:8:{s:9:"prototype";s:33:"dojox.atom.widget.FeedEntryEditor";s:4:"type";s:8:"Function";s:10:"parameters";a:4:{s:10:"anchorNode";a:2:{s:4:"type";s:8:"DOM node";s:7:"summary";s:44:"The DOM node to attach the editor widget to.";}s:4:"node";a:2:{s:4:"type";s:8:"DOM node";s:7:"summary";s:159:"An object containing the value to be put into the editor. This ranges from an anonymous object with a value parameter to a dojox.atom.io.model.Content object.";}s:9:"multiline";a:2:{s:4:"type";s:7:"boolean";s:7:"summary";s:127:"A boolean indicating whether the content should be multiline (such as a textarea) instead of a single line (such as a textbox).";}s:3:"rte";a:2:{s:4:"type";s:6:"object";s:7:"summary";s:77:"A boolean indicating whether the content should be a rich text editor widget.";}}s:6:"source";s:2872:" var viewNode; var box; if(!node){ if(rte){ // Returns an anonymous object which would then be loaded later, after the containing element // exists on the page. return {anchorNode: anchorNode, entryValue: "", editor: null, generateEditor: function(){ // The only way I found I could get the editor to behave consistently was to // create the content on a span, and allow the content editor to replace it. // This gets around the dynamic/delayed way in which content editors get created. var node = document.createElement("div"); node.innerHTML = this.entryValue; this.anchorNode.appendChild(node); var _editor = new dijit.Editor({}, node); this.editor = _editor; return _editor; } }; } if(multiline){ // If multiline, create a textarea viewNode = document.createElement("textarea"); anchorNode.appendChild(viewNode); dojo.style(viewNode, 'width', '90%'); box = new dijit.form.SimpleTextarea({},viewNode); }else{ // If single line, create a textbox. viewNode = document.createElement("input"); anchorNode.appendChild(viewNode); dojo.style(viewNode, 'width', '95%'); box = new dijit.form.TextBox({},viewNode); } box.attr('value', ''); return box; } // Check through the node parameter to get the value to be used. var value; if(node.value !== undefined){ value = node.value; }else if(node.attr){ value = node.attr('value'); }else{ value = node; } if(rte){ // Returns an anonymous object which would then be loaded later, after the containing element // exists on the page. if(value.indexOf("<") != -1){ value = value.replace(/') !== 0){ value = '
' + value + '
'; } } entry.title = new dojox.atom.io.model.Content("title", value, null, this.entryTitleSelect.value); modifiedEntry = true; } if(this._editors.id.attr('value') != entry.id){ entry.id = this._editors.id.attr('value'); modifiedEntry = true; } if(this._editors.summary && (this._editors.summary.attr('value') != entry.summary.value || this.entrySummarySelect.value != entry.summary.type)){ value = this._editors.summary.attr('value'); if(this.entrySummarySelect.value === "xhtml"){ value = this._enforceXhtml(value); if(value.indexOf('
') !== 0){ value = '
' + value + '
'; } } entry.summary = new dojox.atom.io.model.Content("summary", value, null, this.entrySummarySelect.value); modifiedEntry = true; } if(this._editors.content && (this._editors.content.attr('value') != entry.content.value || this.entryContentSelect.value != entry.content.type)){ value = this._editors.content.attr('value'); if(this.entryContentSelect.value === "xhtml"){ value = this._enforceXhtml(value); if(value.indexOf('
') !== 0){ value = '
' + value + '
'; } } entry.content = new dojox.atom.io.model.Content("content", value, null, this.entryContentSelect.value); modifiedEntry = true; } if(this._editors.authors){ if(modifiedEntry){ entry.authors = []; authors = this._editors.authors.getValues(); for(i in authors){ if(authors[i].name || authors[i].email || authors[i].uri){ entry.addAuthor(authors[i].name, authors[i].email, authors[i].uri); } } }else{ var currentAuthors = entry.authors; var searchAuthors = function(name, email, uri){ for(i in currentAuthors){ if(currentAuthors[i].name === name && currentAuthors[i].email === email && currentAuthors[i].uri === uri){ return true; } } return false; }; authors = this._editors.authors.getValues(); changed = false; for(i in authors){ if(!searchAuthors(authors[i].name, authors[i].email, authors[i].uri)){ changed = true; break; } } if(changed){ entry.authors = []; for(i in authors){ if(authors[i].name || authors[i].email || authors[i].uri){ entry.addAuthor(authors[i].name, authors[i].email, authors[i].uri); } } modifiedEntry = true; } } } if(this._editors.contributors){ if(modifiedEntry){ entry.contributors = []; contributors = this._editors.contributors.getValues(); for(i in contributors){ if(contributors[i].name || contributors[i].email || contributors[i].uri){ entry.addAuthor(contributors[i].name, contributors[i].email, contributors[i].uri); } } }else{ var currentContributors = entry.contributors; var searchContributors = function(name, email, uri){ for(i in currentContributors){ if(currentContributors[i].name === name && currentContributors[i].email === email && currentContributors[i].uri === uri){ return true; } } return false; }; contributors = this._editors.contributors.getValues(); changed = false; for(i in contributors){ if(searchContributors(contributors[i].name, contributors[i].email, contributors[i].uri)){ changed = true; break; } } if(changed){ entry.contributors = []; for(i in contributors){ if(contributors[i].name || contributors[i].email || contributors[i].uri){ entry.addContributor(contributors[i].name, contributors[i].email, contributors[i].uri); } } modifiedEntry = true; } } } if(modifiedEntry){ dojo.publish(this.entrySelectionTopic, [{action: "update", source: this, entry: entry, callback: this._handleSave }]); //TODO: REMOVE BELOW //var atomIO = new dojox.atom.io.Connection(); //atomIO.updateEntry(entry, dojo.hitch(this,this._handleSave)); //WARNING: Use above when testing with SimpleProxy (or any other servlet which // doesn't actually create a new entry and return it properly) //atomIO.updateEntry(entry, dojo.hitch(this,this._handleSave), true); } }else{ this._new = false; entry = new dojox.atom.io.model.Entry(); value = this._editors.title.attr('value'); if(this.entryTitleSelect.value === "xhtml"){ value = this._enforceXhtml(value); value = '
' + value + '
'; } entry.setTitle(value, this.entryTitleSelect.value); entry.id = this._editors.id.attr('value'); authors = this._editors.authors.getValues(); for(i in authors){ if(authors[i].name || authors[i].email || authors[i].uri){ entry.addAuthor(authors[i].name, authors[i].email, authors[i].uri); } } contributors = this._editors.contributors.getValues(); for(i in contributors){ if(contributors[i].name || contributors[i].email || contributors[i].uri){ entry.addContributor(contributors[i].name, contributors[i].email, contributors[i].uri); } } value = this._editors.summary.attr('value'); if(this.entrySummarySelect.value === "xhtml"){ value = this._enforceXhtml(value); value = '
' + value + '
'; } entry.summary = new dojox.atom.io.model.Content("summary", value, null, this.entrySummarySelect.value); value = this._editors.content.attr('value'); if(this.entryContentSelect.value === "xhtml"){ value = this._enforceXhtml(value); value = '
' + value + '
'; } entry.content = new dojox.atom.io.model.Content("content", value, null, this.entryContentSelect.value); dojo.style(this.entryNewButton, 'display', ''); dojo.publish(this.entrySelectionTopic, [{action: "post", source: this, entry: entry }]); } this._editMode = false; //Rebuild the view using the same entry and feed. this.setEntry(entry, this._feed, true);";s:7:"summary";s:56:"Saves edits submitted when the 'save' button is pressed.";s:11:"description";s:304:"Saves edits submitted when the 'save' button is pressed. Distinguishes between new and existing entries and saves appropriately. Fetches the values of the editors, and, if existing, compares them to the existing values and submits the updates, otherwise creates a new entry and posts it as a new entry.";s:14:"return_summary";s:8:"Nothing.";}s:45:"dojox.atom.widget.FeedEntryEditor._handleSave";a:8:{s:9:"prototype";s:33:"dojox.atom.widget.FeedEntryEditor";s:4:"type";s:8:"Function";s:10:"parameters";a:2:{s:5:"entry";a:2:{s:4:"type";s:6:"object";s:7:"summary";s:150:"dojox.atom.io.model.Entry object The entry that was saved. Location: String A URL to be used, not used here, but part of the call back from the AtomIO";}s:8:"location";a:1:{s:4:"type";s:6:"string";}}s:6:"source";s:143:" this._editMode = false; //Rebuild the view using the same entry and feed. this.clear(); this.setEntry(entry, this.getFeed(), true);";s:7:"summary";s:96:"Function for handling the save of an entry, cleaning up the display after the edit is completed.";s:11:"description";s:96:"Function for handling the save of an entry, cleaning up the display after the edit is completed.";s:14:"return_summary";s:41:"Nothing. Close the editor and revert out.";s:7:"private";b:1;}s:45:"dojox.atom.widget.FeedEntryEditor.cancelEdits";a:6:{s:9:"prototype";s:33:"dojox.atom.widget.FeedEntryEditor";s:4:"type";s:8:"Function";s:6:"source";s:371:" this._new = false; dojo.style(this.entrySaveCancelButtons, 'display', 'none'); if(this._editable){ dojo.style(this.entryEditButton, 'display', ''); } dojo.style(this.entryNewButton, 'display', ''); this._editMode = false; //Rebuild the view using the same entry and feed. this.clearEditors(); this.setEntry(this.getEntry(), this.getFeed(), true);";s:7:"summary";s:73:"Cancels edits and reverts the editor to its previous state (display mode)";s:11:"description";s:73:"Cancels edits and reverts the editor to its previous state (display mode)";s:14:"return_summary";s:8:"Nothing.";}s:39:"dojox.atom.widget.FeedEntryEditor.clear";a:6:{s:9:"prototype";s:33:"dojox.atom.widget.FeedEntryEditor";s:4:"type";s:8:"Function";s:6:"source";s:394:" this._editable=false; this.clearEditors(); dojox.atom.widget.FeedEntryEditor.superclass.clear.apply(this); if(this._contentEditor){ // Note that the superclass clear destroys the widget since it's in the child widget list, // so this is just ref clearing. this._contentEditor = this._setObject = this._oldContent = this._contentEditorCreator = null; this._editors = {}; }";s:7:"summary";s:76:"Clears the editor, destorys all editors, leaving the editor completely clear";s:11:"description";s:76:"Clears the editor, destorys all editors, leaving the editor completely clear";s:6:"chains";a:1:{s:4:"call";a:1:{i:0;s:50:"dojox.atom.widget.FeedEntryEditor.superclass.clear";}}}s:46:"dojox.atom.widget.FeedEntryEditor.clearEditors";a:4:{s:9:"prototype";s:33:"dojox.atom.widget.FeedEntryEditor";s:4:"type";s:8:"Function";s:6:"source";s:199:" for(var key in this._editors){ if(this._editors[key].declaredClass === "dijit.Editor"){ this._editors[key].close(false, true); } this._editors[key].destroy(); } this._editors = {};";s:7:"summary";s:0:"";}s:47:"dojox.atom.widget.FeedEntryEditor._enforceXhtml";a:8:{s:9:"prototype";s:33:"dojox.atom.widget.FeedEntryEditor";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:4:"html";a:2:{s:4:"type";s:6:"string";s:7:"summary";s:36:"HTML string to be enforced as xhtml.";}}s:6:"source";s:259:" var xhtml = null; if(html){ //Handle
var brRegExp = /
/g; xhtml = html.replace(brRegExp, "
"); //Handle
xhtml = this._closeTag(xhtml, "hr"); //Handle xhtml = this._closeTag(xhtml, "img"); } return xhtml;";s:7:"summary";s:95:"Function for cleaning up/enforcing the XHTML standard in HTML returned from the editor2 widget.";s:11:"description";s:95:"Function for cleaning up/enforcing the XHTML standard in HTML returned from the editor2 widget.";s:14:"return_summary";s:26:"string of cleaned up HTML.";s:7:"private";b:1;}s:43:"dojox.atom.widget.FeedEntryEditor._closeTag";a:8:{s:9:"prototype";s:33:"dojox.atom.widget.FeedEntryEditor";s:4:"type";s:8:"Function";s:10:"parameters";a:2:{s:5:"xhtml";a:2:{s:4:"type";s:6:"string";s:7:"summary";s:48:"String XHTML string which needs the closing tag.";}s:3:"tag";a:2:{s:4:"type";s:6:"string";s:7:"summary";s:17:"The tag to close.";}}s:6:"source";s:553:" var tagStart = "<" + tag; var tagIndex = xhtml.indexOf(tagStart); if(tagIndex !== -1){ while (tagIndex !== -1){ var tempString = ""; var foundTagEnd = false; for (var i = 0; i < xhtml.length; i++){ var c = xhtml.charAt(i); if(i <= tagIndex ||foundTagEnd){ tempString += c; } else { if(c === '>'){ tempString += "/"; foundTagEnd = true; } tempString +=c; } } xhtml = tempString; tagIndex = xhtml.indexOf(tagStart, tagIndex + 1); } } return xhtml;";s:7:"summary";s:49:"Function for closing tags in a text of HTML/XHTML";s:11:"description";s:49:"Function for closing tags in a text of HTML/XHTML";s:14:"return_summary";s:121:"string of cleaned up HTML. NOTE: Probably should redo this function in a more efficient way. This could get expensive.";s:7:"private";b:1;}s:44:"dojox.atom.widget.FeedEntryEditor._toggleNew";a:6:{s:9:"prototype";s:33:"dojox.atom.widget.FeedEntryEditor";s:4:"type";s:8:"Function";s:6:"source";s:2620:" dojo.style(this.entryNewButton, 'display', 'none'); dojo.style(this.entryEditButton, 'display', 'none'); dojo.style(this.entrySaveCancelButtons, 'display', ''); // Reset the type select boxes to text. this.entrySummarySelect.value = "text"; this.entryContentSelect.value = "text"; this.entryTitleSelect.value = "text"; // Clear all nodes. this.clearNodes(); this._new = true; var _nlsResources = dojo.i18n.getLocalization("dojox.atom.widget", "FeedEntryViewer"); // Create all headers and editors. var titleHeader = new dojox.atom.widget.EntryHeader({title: _nlsResources.title}); this.entryTitleHeader.appendChild(titleHeader.domNode); this._editors.title = this._createEditor(this.entryTitleNode, null); this.setFieldValidity("title",true); var authorHeader = new dojox.atom.widget.EntryHeader({title: _nlsResources.authors}); this.entryAuthorHeader.appendChild(authorHeader.domNode); this._editors.authors = this._createPeopleEditor(this.entryAuthorNode, {name: "Author"}); this.setFieldValidity("authors", true); var contributorHeader = new dojox.atom.widget.EntryHeader({title: _nlsResources.contributors}); this.entryContributorHeader.appendChild(contributorHeader.domNode); this._editors.contributors = this._createPeopleEditor(this.entryContributorNode, {name: "Contributor"}); this.setFieldValidity("contributors", true); var idHeader = new dojox.atom.widget.EntryHeader({title: _nlsResources.id}); this.entryIdHeader.appendChild(idHeader.domNode); this._editors.id = this._createEditor(this.entryIdNode, null); this.setFieldValidity("id",true); var updatedHeader = new dojox.atom.widget.EntryHeader({title: _nlsResources.updated}); this.entryUpdatedHeader.appendChild(updatedHeader.domNode); this._editors.updated = this._createEditor(this.entryUpdatedNode, null); this.setFieldValidity("updated",true); var summaryHeader = new dojox.atom.widget.EntryHeader({title: _nlsResources.summary}); this.entrySummaryHeader.appendChild(summaryHeader.domNode); this._editors.summary = this._createEditor(this.entrySummaryNode, null, true); this.setFieldValidity("summaryedit",true); this.setFieldValidity("summary",true); var contentHeader = new dojox.atom.widget.EntryHeader({title: _nlsResources.content}); this.entryContentHeader.appendChild(contentHeader.domNode); this._editors.content = this._createEditor(this.entryContentNode, null, true); this.setFieldValidity("contentedit",true); this.setFieldValidity("content",true); // Show the sections. this._displaySections();";s:7:"summary";s:62:"Function to put the editor into a state to create a new entry.";s:11:"description";s:123:"Function to put the editor into a state to create a new entry. Hide the edit/new buttons and show the save/cancel buttons.";s:7:"private";b:1;}s:50:"dojox.atom.widget.FeedEntryEditor._displaySections";a:7:{s:9:"prototype";s:33:"dojox.atom.widget.FeedEntryEditor";s:4:"type";s:8:"Function";s:6:"source";s:1063:" dojo.style(this.entrySummarySelect, 'display', 'none'); dojo.style(this.entryContentSelect, 'display', 'none'); dojo.style(this.entryTitleSelect, 'display', 'none'); // Show select boxes if the flags are set. if(this.isFieldValid("contentedit")){ dojo.style(this.entryContentSelect, 'display', ''); } if(this.isFieldValid("summaryedit")){ dojo.style(this.entrySummarySelect, 'display', ''); } if(this.isFieldValid("titleedit")){ dojo.style(this.entryTitleSelect, 'display', ''); } // Call super's _displaySections. dojox.atom.widget.FeedEntryEditor.superclass._displaySections.apply(this); // If we have editors to load after the nodes are created on the page, execute those now. if(this._toLoad){ for(var i in this._toLoad){ var editor; if(this._toLoad[i].generateEditor){ editor = dojo.hitch(this._toLoad[i], this._toLoad[i].generateEditor)(); }else{ editor = this._toLoad[i]; } this._editors[this._toLoad[i].name] = editor; this._toLoad[i] = null; } this._toLoad = null; }";s:7:"summary";s:63:"Function to display the appropriate sections based on validity.";s:11:"description";s:83:"Function to display the appropriate sections based on validity. Hide select boxes.";s:6:"chains";a:1:{s:4:"call";a:1:{i:0;s:61:"dojox.atom.widget.FeedEntryEditor.superclass._displaySections";}}s:7:"private";b:1;}s:48:"dojox.atom.widget.FeedEntryEditor._subscriptions";a:3:{s:8:"instance";s:33:"dojox.atom.widget.FeedEntryEditor";s:7:"private";b:1;s:7:"summary";s:0:"";}s:58:"dojox.atom.widget.FeedEntryEditor.displayOptions.innerHTML";a:2:{s:8:"instance";s:33:"dojox.atom.widget.FeedEntryEditor";s:7:"summary";s:0:"";}s:71:"dojox.atom.widget.FeedEntryEditor.feedEntryCheckBoxLabelTitle.innerHTML";a:2:{s:8:"instance";s:33:"dojox.atom.widget.FeedEntryEditor";s:7:"summary";s:0:"";}s:73:"dojox.atom.widget.FeedEntryEditor.feedEntryCheckBoxLabelAuthors.innerHTML";a:2:{s:8:"instance";s:33:"dojox.atom.widget.FeedEntryEditor";s:7:"summary";s:0:"";}s:78:"dojox.atom.widget.FeedEntryEditor.feedEntryCheckBoxLabelContributors.innerHTML";a:2:{s:8:"instance";s:33:"dojox.atom.widget.FeedEntryEditor";s:7:"summary";s:0:"";}s:68:"dojox.atom.widget.FeedEntryEditor.feedEntryCheckBoxLabelId.innerHTML";a:2:{s:8:"instance";s:33:"dojox.atom.widget.FeedEntryEditor";s:7:"summary";s:0:"";}s:49:"dojox.atom.widget.FeedEntryEditor.close.innerHTML";a:2:{s:8:"instance";s:33:"dojox.atom.widget.FeedEntryEditor";s:7:"summary";s:0:"";}s:73:"dojox.atom.widget.FeedEntryEditor.feedEntryCheckBoxLabelUpdated.innerHTML";a:2:{s:8:"instance";s:33:"dojox.atom.widget.FeedEntryEditor";s:7:"summary";s:0:"";}s:73:"dojox.atom.widget.FeedEntryEditor.feedEntryCheckBoxLabelSummary.innerHTML";a:2:{s:8:"instance";s:33:"dojox.atom.widget.FeedEntryEditor";s:7:"summary";s:0:"";}s:73:"dojox.atom.widget.FeedEntryEditor.feedEntryCheckBoxLabelContent.innerHTML";a:2:{s:8:"instance";s:33:"dojox.atom.widget.FeedEntryEditor";s:7:"summary";s:0:"";}s:49:"dojox.atom.widget.FeedEntryEditor.doNew.innerHTML";a:2:{s:8:"instance";s:33:"dojox.atom.widget.FeedEntryEditor";s:7:"summary";s:0:"";}s:48:"dojox.atom.widget.FeedEntryEditor.edit.innerHTML";a:2:{s:8:"instance";s:33:"dojox.atom.widget.FeedEntryEditor";s:7:"summary";s:0:"";}s:48:"dojox.atom.widget.FeedEntryEditor.save.innerHTML";a:2:{s:8:"instance";s:33:"dojox.atom.widget.FeedEntryEditor";s:7:"summary";s:0:"";}s:50:"dojox.atom.widget.FeedEntryEditor.cancel.innerHTML";a:2:{s:8:"instance";s:33:"dojox.atom.widget.FeedEntryEditor";s:7:"summary";s:0:"";}s:43:"dojox.atom.widget.FeedEntryEditor._editMode";a:3:{s:8:"instance";s:33:"dojox.atom.widget.FeedEntryEditor";s:7:"private";b:1;s:7:"summary";s:0:"";}s:41:"dojox.atom.widget.FeedEntryEditor._toLoad";a:3:{s:8:"instance";s:33:"dojox.atom.widget.FeedEntryEditor";s:7:"private";b:1;s:7:"summary";s:0:"";}s:56:"dojox.atom.widget.FeedEntryEditor.entryTitleSelect.value";a:2:{s:8:"instance";s:33:"dojox.atom.widget.FeedEntryEditor";s:7:"summary";s:0:"";}s:50:"dojox.atom.widget.FeedEntryEditor._editors.authors";a:3:{s:8:"instance";s:33:"dojox.atom.widget.FeedEntryEditor";s:14:"private_parent";b:1;s:7:"summary";s:0:"";}s:55:"dojox.atom.widget.FeedEntryEditor._editors.contributors";a:3:{s:8:"instance";s:33:"dojox.atom.widget.FeedEntryEditor";s:14:"private_parent";b:1;s:7:"summary";s:0:"";}s:45:"dojox.atom.widget.FeedEntryEditor._editors.id";a:3:{s:8:"instance";s:33:"dojox.atom.widget.FeedEntryEditor";s:14:"private_parent";b:1;s:7:"summary";s:0:"";}s:50:"dojox.atom.widget.FeedEntryEditor._editors.updated";a:3:{s:8:"instance";s:33:"dojox.atom.widget.FeedEntryEditor";s:14:"private_parent";b:1;s:7:"summary";s:0:"";}s:58:"dojox.atom.widget.FeedEntryEditor.entrySummarySelect.value";a:2:{s:8:"instance";s:33:"dojox.atom.widget.FeedEntryEditor";s:7:"summary";s:0:"";}s:58:"dojox.atom.widget.FeedEntryEditor.entryContentSelect.value";a:2:{s:8:"instance";s:33:"dojox.atom.widget.FeedEntryEditor";s:7:"summary";s:0:"";}s:40:"dojox.atom.widget.FeedEntryEditor.editor";a:2:{s:8:"instance";s:33:"dojox.atom.widget.FeedEntryEditor";s:7:"summary";s:0:"";}s:38:"dojox.atom.widget.FeedEntryEditor._new";a:3:{s:8:"instance";s:33:"dojox.atom.widget.FeedEntryEditor";s:7:"private";b:1;s:7:"summary";s:0:"";}s:48:"dojox.atom.widget.FeedEntryEditor._editors.title";a:3:{s:8:"instance";s:33:"dojox.atom.widget.FeedEntryEditor";s:14:"private_parent";b:1;s:7:"summary";s:0:"";}s:50:"dojox.atom.widget.FeedEntryEditor._editors.summary";a:3:{s:8:"instance";s:33:"dojox.atom.widget.FeedEntryEditor";s:14:"private_parent";b:1;s:7:"summary";s:0:"";}s:50:"dojox.atom.widget.FeedEntryEditor._editors.content";a:3:{s:8:"instance";s:33:"dojox.atom.widget.FeedEntryEditor";s:14:"private_parent";b:1;s:7:"summary";s:0:"";}s:30:"dojox.atom.widget.PeopleEditor";a:6:{s:4:"type";s:8:"Function";s:6:"chains";a:2:{s:9:"prototype";a:1:{i:0;s:13:"dijit._Widget";}s:4:"call";a:3:{i:0;s:13:"dijit._Widget";i:1;s:16:"dijit._Templated";i:2;s:16:"dijit._Container";}}s:6:"mixins";a:1:{s:9:"prototype";a:2:{i:0;s:26:"dijit._Templated.prototype";i:1;s:26:"dijit._Container.prototype";}}s:7:"summary";s:49:"An editor for dojox.atom.io.model.Person objects.";s:11:"description";s:143:"An editor for dojox.atom.io.model.Person objects. Displays multiple rows for the respective arrays of people. Can add/remove rows on the fly.";s:9:"classlike";b:1;}s:43:"dojox.atom.widget.PeopleEditor.templatePath";a:2:{s:9:"prototype";s:30:"dojox.atom.widget.PeopleEditor";s:7:"summary";s:0:"";}s:36:"dojox.atom.widget.PeopleEditor._rows";a:3:{s:9:"prototype";s:30:"dojox.atom.widget.PeopleEditor";s:7:"private";b:1;s:7:"summary";s:0:"";}s:39:"dojox.atom.widget.PeopleEditor._editors";a:4:{s:9:"prototype";s:30:"dojox.atom.widget.PeopleEditor";s:8:"instance";s:30:"dojox.atom.widget.PeopleEditor";s:7:"private";b:1;s:7:"summary";s:0:"";}s:37:"dojox.atom.widget.PeopleEditor._index";a:4:{s:9:"prototype";s:30:"dojox.atom.widget.PeopleEditor";s:8:"instance";s:30:"dojox.atom.widget.PeopleEditor";s:7:"private";b:1;s:7:"summary";s:0:"";}s:39:"dojox.atom.widget.PeopleEditor._numRows";a:4:{s:9:"prototype";s:30:"dojox.atom.widget.PeopleEditor";s:8:"instance";s:30:"dojox.atom.widget.PeopleEditor";s:7:"private";b:1;s:7:"summary";s:0:"";}s:41:"dojox.atom.widget.PeopleEditor.postCreate";a:4:{s:9:"prototype";s:30:"dojox.atom.widget.PeopleEditor";s:4:"type";s:8:"Function";s:6:"source";s:37723:"dojo.provide("dojox.atom.widget.FeedEntryEditor"); dojo.require("dojox.atom.widget.FeedEntryViewer"); dojo.require("dijit._Widget"); dojo.require("dijit._Templated"); dojo.require("dijit._Container"); dojo.require("dijit.Editor"); dojo.require("dijit.form.TextBox"); dojo.require("dijit.form.SimpleTextarea"); dojo.requireLocalization("dojox.atom.widget", "FeedEntryEditor"); dojo.requireLocalization("dojox.atom.widget", "PeopleEditor"); dojo.experimental("dojox.atom.widget.FeedEntryEditor"); dojo.declare("dojox.atom.widget.FeedEntryEditor",dojox.atom.widget.FeedEntryViewer,{ // summary: // An ATOM feed entry editor that allows viewing of the individual attributes of an entry. // description: // An ATOM feed entry editor that allows viewing of the individual attributes of an entry. _contentEditor: null, _oldContent: null, _setObject: null, enableEdit: false, _contentEditorCreator: null, _editors: {}, entryNewButton: null, _editable: false, //Flag denoting if the current entry is editable or not. //Templates for the HTML rendering. Need to figure these out better, admittedly. templatePath: dojo.moduleUrl("dojox.atom", "widget/templates/FeedEntryEditor.html"), postCreate: function(){ if(this.entrySelectionTopic !== ""){ this._subscriptions = [dojo.subscribe(this.entrySelectionTopic, this, "_handleEvent")]; } var _nlsResources = dojo.i18n.getLocalization("dojox.atom.widget", "FeedEntryViewer"); this.displayOptions.innerHTML = _nlsResources.displayOptions; this.feedEntryCheckBoxLabelTitle.innerHTML = _nlsResources.title; this.feedEntryCheckBoxLabelAuthors.innerHTML = _nlsResources.authors; this.feedEntryCheckBoxLabelContributors.innerHTML = _nlsResources.contributors; this.feedEntryCheckBoxLabelId.innerHTML = _nlsResources.id; this.close.innerHTML = _nlsResources.close; this.feedEntryCheckBoxLabelUpdated.innerHTML = _nlsResources.updated; this.feedEntryCheckBoxLabelSummary.innerHTML = _nlsResources.summary; this.feedEntryCheckBoxLabelContent.innerHTML = _nlsResources.content; _nlsResources = dojo.i18n.getLocalization("dojox.atom.widget", "FeedEntryEditor"); this.doNew.innerHTML = _nlsResources.doNew; this.edit.innerHTML = _nlsResources.edit; this.save.innerHTML = _nlsResources.save; this.cancel.innerHTML = _nlsResources.cancel; }, setEntry: function(/*object*/entry, /*object*/feed, /*boolean*/leaveMenuState){ // summary: // Function to set the current entry that is being edited. // description: // Function to set the current entry that is being edited. // // entry: // Instance of dojox.atom.io.model.Entry to display for reading/editing. if(this._entry !== entry){ //If we swap entries, we don't want to keep the menu states and modes. this._editMode=false; leaveMenuState=false; }else{ leaveMenuState = true; } dojox.atom.widget.FeedEntryEditor.superclass.setEntry.call(this, entry, feed); this._editable = this._isEditable(entry); if(!leaveMenuState && !this._editable){ dojo.style(this.entryEditButton, 'display', 'none'); dojo.style(this.entrySaveCancelButtons, 'display', 'none'); } if(this._editable && this.enableEdit){ if(!leaveMenuState){ dojo.style(this.entryEditButton, 'display', ''); //TODO double check this &&... if(this.enableMenuFade && this.entrySaveCancelButton){ dojo.fadeOut({node: this.entrySaveCancelButton,duration: 250}).play(); } } } }, _toggleEdit: function(){ // summary: // Internal function for toggling/enabling the display of edit mode // description: // Internal function for toggling/enabling the display of edit mode // // returns: // Nothing. if(this._editable && this.enableEdit){ dojo.style(this.entryEditButton, 'display', 'none'); dojo.style(this.entrySaveCancelButtons, 'display', ''); this._editMode = true; //Rebuild the view using the same entry and feed. this.setEntry(this._entry, this._feed, true); } }, _handleEvent: function(/*object*/entrySelectionEvent){ // summary: // Internal function for listening to a topic that will handle entry notification. // description: // Internal function for listening to a topic that will handle entry notification. // // entrySelectionEvent: // The topic message containing the entry that was selected for view. // // returns: // Nothing. if(entrySelectionEvent.source != this && entrySelectionEvent.action == "delete" && entrySelectionEvent.entry && entrySelectionEvent.entry == this._entry){ dojo.style(this.entryEditButton, 'display', 'none'); } dojox.atom.widget.FeedEntryEditor.superclass._handleEvent.call(this, entrySelectionEvent); }, _isEditable: function(/*object*/entry){ // summary: // Internal function for determining of a particular entry is editable. // description: // Internal function for determining of a particular entry is editable. // This is used for determining if the delete action should be displayed or not. // // entry: // The dojox.atom.io.model.Entry object to examine // // returns: // Boolean denoting if the entry seems editable or not.. var retVal = false; if(entry && entry !== null && entry.links && entry.links !== null){ for(var x in entry.links){ if(entry.links[x].rel && entry.links[x].rel == "edit"){ retVal = true; break; } } } return retVal; }, // The following set functions override the corresponding functions in FeedEntryViewer. These handle // the editMode flag by inserting appropriate editor widgets inside of just splashing the content in the page. setTitle: function(/*DOM node*/titleAnchorNode, /*boolean*/editMode, /*object*/entry){ // summary: // Function to set the contents of the title node in the template to some value from the entry. // description: // Function to set the contents of the title node in the template to some value from the entry. // This exists specifically so users can over-ride how the title data is filled out from an entry. // // titleAnchorNode: // The DOM node to attach the title data to. // editMode: // Boolean to indicate if the display should be in edit mode or not. // entry: // The Feed Entry to work with. // if(!editMode){ dojox.atom.widget.FeedEntryEditor.superclass.setTitle.call(this, titleAnchorNode, editMode, entry); if(entry.title && entry.title.value && entry.title.value !== null){ this.setFieldValidity("title", true); } }else{ if(entry.title && entry.title.value && entry.title.value !== null){ if(!this._toLoad){ this._toLoad = []; } this.entryTitleSelect.value = entry.title.type; var editor = this._createEditor(titleAnchorNode, entry.title, true, entry.title.type === "html" || entry.title.type === "xhtml"); editor.name = "title"; this._toLoad.push(editor); this.setFieldValidity("titleedit",true); this.setFieldValidity("title",true); } } }, setAuthors: function(/*DOM node*/authorsAnchorNode, /*boolean*/editMode, /*object*/entry){ // summary: // Function to set the contents of the author node in the template to some value from the entry. // description: // Function to set the contents of the author node in the template to some value from the entry. // This exists specifically so users can over-ride how the title data is filled out from an entry. // // authorsAnchorNode: // The DOM node to attach the author data to. // editMode: // Boolean to indicate if the display should be in edit mode or not. // entry: // The Feed Entry to work with. if(!editMode){ dojox.atom.widget.FeedEntryEditor.superclass.setAuthors.call(this, authorsAnchorNode, editMode, entry); if(entry.authors && entry.authors.length > 0){ this.setFieldValidity("authors", true); } }else{ if(entry.authors && entry.authors.length > 0){ this._editors.authors = this._createPeopleEditor(this.entryAuthorNode, {data: entry.authors, name: "Author"}); this.setFieldValidity("authors", true); } } }, setContributors: function(/*DOM node*/contributorsAnchorNode, /*boolean*/editMode, /*object*/entry){ // summary: // Function to set the contents of the contributor node in the template to some value from the entry. // description: // Function to set the contents of the contributor node in the template to some value from the entry. // This exists specifically so users can over-ride how the title data is filled out from an entry. // // contributorsAnchorNode: // The DOM node to attach the contributor data to. // editMode: // Boolean to indicate if the display should be in edit mode or not. // entry: // The Feed Entry to work with. if(!editMode){ dojox.atom.widget.FeedEntryEditor.superclass.setContributors.call(this, contributorsAnchorNode, editMode, entry); if(entry.contributors && entry.contributors.length > 0){ this.setFieldValidity("contributors", true); } }else{ if(entry.contributors && entry.contributors.length > 0){ this._editors.contributors = this._createPeopleEditor(this.entryContributorNode, {data: entry.contributors, name: "Contributor"}); this.setFieldValidity("contributors", true); } } }, setId: function(/*DOM node*/idAnchorNode, /*boolean*/editMode, /*object*/entry){ // summary: // Function to set the contents of the ID node in the template to some value from the entry. // description: // Function to set the contents of the ID node in the template to some value from the entry. // This exists specifically so users can over-ride how the title data is filled out from an entry. // // idAnchorNode: // The DOM node to attach the ID data to. // editMode: // Boolean to indicate if the display should be in edit mode or not. // entry: // The Feed Entry to work with. if(!editMode){ dojox.atom.widget.FeedEntryEditor.superclass.setId.call(this, idAnchorNode, editMode, entry); if(entry.id && entry.id !== null){ this.setFieldValidity("id", true); } }else{ if(entry.id && entry.id !== null){ this._editors.id = this._createEditor(idAnchorNode, entry.id); this.setFieldValidity("id",true); } } }, setUpdated: function(/*DOM node*/updatedAnchorNode, /*boolean*/editMode, /*object*/entry){ // summary: // Function to set the contents of the updated node in the template to some value from the entry. // description: // Function to set the contents of the updated node in the template to some value from the entry. // This exists specifically so users can over-ride how the title data is filled out from an entry. // // updatedAnchorNode: // The DOM node to attach the udpated data to. // editMode: // Boolean to indicate if the display should be in edit mode or not. // entry: // The Feed Entry to work with. if(!editMode){ dojox.atom.widget.FeedEntryEditor.superclass.setUpdated.call(this, updatedAnchorNode, editMode, entry); if(entry.updated && entry.updated !== null){ this.setFieldValidity("updated", true); } }else{ if(entry.updated && entry.updated !== null){ this._editors.updated = this._createEditor(updatedAnchorNode, entry.updated); this.setFieldValidity("updated",true); } } }, setSummary: function(/*DOM node*/summaryAnchorNode, /*boolean*/editMode, /*object*/entry){ // summary: // Function to set the contents of the summary node in the template to some value from the entry. // description: // Function to set the contents of the summary node in the template to some value from the entry. // This exists specifically so users can over-ride how the title data is filled out from an entry. // // summaryAnchorNode: // The DOM node to attach the summary data to. // editMode: // Boolean to indicate if the display should be in edit mode or not. // entry: // The Feed Entry to work with. if(!editMode){ dojox.atom.widget.FeedEntryEditor.superclass.setSummary.call(this, summaryAnchorNode, editMode, entry); if(entry.summary && entry.summary.value && entry.summary.value !== null){ this.setFieldValidity("summary", true); } }else{ if(entry.summary && entry.summary.value && entry.summary.value !== null){ if(!this._toLoad){ this._toLoad = []; } this.entrySummarySelect.value = entry.summary.type; var editor = this._createEditor(summaryAnchorNode, entry.summary, true, entry.summary.type === "html" || entry.summary.type === "xhtml"); editor.name = "summary"; this._toLoad.push(editor); this.setFieldValidity("summaryedit",true); this.setFieldValidity("summary",true); } } }, setContent: function(/*DOM node*/contentAnchorNode, /*boolean*/editMode, /*object*/entry){ // summary: // Function to set the contents of the content node in the template to some value from the entry. // description: // Function to set the contents of the content node in the template to some value from the entry. // This exists specifically so users can over-ride how the title data is filled out from an entry. // // summaryAnchorNode: // The DOM node to attach the content data to. // editMode: // Boolean to indicate if the display should be in edit mode or not. // entry: // The Feed Entry to work with. if(!editMode){ dojox.atom.widget.FeedEntryEditor.superclass.setContent.call(this, contentAnchorNode, editMode, entry); if(entry.content && entry.content.value && entry.content.value !== null){ this.setFieldValidity("content",true); } }else{ if(entry.content && entry.content.value && entry.content.value !== null){ if(!this._toLoad){ this._toLoad = []; } this.entryContentSelect.value = entry.content.type; var editor = this._createEditor(contentAnchorNode, entry.content, true, entry.content.type === "html" || entry.content.type === "xhtml"); editor.name = "content"; this._toLoad.push(editor); this.setFieldValidity("contentedit",true); this.setFieldValidity("content",true); } } }, _createEditor: function(/*DOM node*/anchorNode, /*DOM node*/node, /*boolean*/multiline, /*object*/rte){ // summary: // Function to create an appropriate text editor widget based on the given parameters. // description: // Function to create an appropriate text editor widget based on the given parameters. // // anchorNode: // The DOM node to attach the editor widget to. // node: // An object containing the value to be put into the editor. This ranges from an anonymous object // with a value parameter to a dojox.atom.io.model.Content object. // multiline: // A boolean indicating whether the content should be multiline (such as a textarea) instead of a // single line (such as a textbox). // rte: // A boolean indicating whether the content should be a rich text editor widget. // // returns: // Either a widget (for textarea or textbox widgets) or an anonymous object to be used to create a // rich text area widget. var viewNode; var box; if(!node){ if(rte){ // Returns an anonymous object which would then be loaded later, after the containing element // exists on the page. return {anchorNode: anchorNode, entryValue: "", editor: null, generateEditor: function(){ // The only way I found I could get the editor to behave consistently was to // create the content on a span, and allow the content editor to replace it. // This gets around the dynamic/delayed way in which content editors get created. var node = document.createElement("div"); node.innerHTML = this.entryValue; this.anchorNode.appendChild(node); var _editor = new dijit.Editor({}, node); this.editor = _editor; return _editor; } }; } if(multiline){ // If multiline, create a textarea viewNode = document.createElement("textarea"); anchorNode.appendChild(viewNode); dojo.style(viewNode, 'width', '90%'); box = new dijit.form.SimpleTextarea({},viewNode); }else{ // If single line, create a textbox. viewNode = document.createElement("input"); anchorNode.appendChild(viewNode); dojo.style(viewNode, 'width', '95%'); box = new dijit.form.TextBox({},viewNode); } box.attr('value', ''); return box; } // Check through the node parameter to get the value to be used. var value; if(node.value !== undefined){ value = node.value; }else if(node.attr){ value = node.attr('value'); }else{ value = node; } if(rte){ // Returns an anonymous object which would then be loaded later, after the containing element // exists on the page. if(value.indexOf("<") != -1){ value = value.replace(/') !== 0){ value = '
' + value + '
'; } } entry.title = new dojox.atom.io.model.Content("title", value, null, this.entryTitleSelect.value); modifiedEntry = true; } if(this._editors.id.attr('value') != entry.id){ entry.id = this._editors.id.attr('value'); modifiedEntry = true; } if(this._editors.summary && (this._editors.summary.attr('value') != entry.summary.value || this.entrySummarySelect.value != entry.summary.type)){ value = this._editors.summary.attr('value'); if(this.entrySummarySelect.value === "xhtml"){ value = this._enforceXhtml(value); if(value.indexOf('
') !== 0){ value = '
' + value + '
'; } } entry.summary = new dojox.atom.io.model.Content("summary", value, null, this.entrySummarySelect.value); modifiedEntry = true; } if(this._editors.content && (this._editors.content.attr('value') != entry.content.value || this.entryContentSelect.value != entry.content.type)){ value = this._editors.content.attr('value'); if(this.entryContentSelect.value === "xhtml"){ value = this._enforceXhtml(value); if(value.indexOf('
') !== 0){ value = '
' + value + '
'; } } entry.content = new dojox.atom.io.model.Content("content", value, null, this.entryContentSelect.value); modifiedEntry = true; } if(this._editors.authors){ if(modifiedEntry){ entry.authors = []; authors = this._editors.authors.getValues(); for(i in authors){ if(authors[i].name || authors[i].email || authors[i].uri){ entry.addAuthor(authors[i].name, authors[i].email, authors[i].uri); } } }else{ var currentAuthors = entry.authors; var searchAuthors = function(name, email, uri){ for(i in currentAuthors){ if(currentAuthors[i].name === name && currentAuthors[i].email === email && currentAuthors[i].uri === uri){ return true; } } return false; }; authors = this._editors.authors.getValues(); changed = false; for(i in authors){ if(!searchAuthors(authors[i].name, authors[i].email, authors[i].uri)){ changed = true; break; } } if(changed){ entry.authors = []; for(i in authors){ if(authors[i].name || authors[i].email || authors[i].uri){ entry.addAuthor(authors[i].name, authors[i].email, authors[i].uri); } } modifiedEntry = true; } } } if(this._editors.contributors){ if(modifiedEntry){ entry.contributors = []; contributors = this._editors.contributors.getValues(); for(i in contributors){ if(contributors[i].name || contributors[i].email || contributors[i].uri){ entry.addAuthor(contributors[i].name, contributors[i].email, contributors[i].uri); } } }else{ var currentContributors = entry.contributors; var searchContributors = function(name, email, uri){ for(i in currentContributors){ if(currentContributors[i].name === name && currentContributors[i].email === email && currentContributors[i].uri === uri){ return true; } } return false; }; contributors = this._editors.contributors.getValues(); changed = false; for(i in contributors){ if(searchContributors(contributors[i].name, contributors[i].email, contributors[i].uri)){ changed = true; break; } } if(changed){ entry.contributors = []; for(i in contributors){ if(contributors[i].name || contributors[i].email || contributors[i].uri){ entry.addContributor(contributors[i].name, contributors[i].email, contributors[i].uri); } } modifiedEntry = true; } } } if(modifiedEntry){ dojo.publish(this.entrySelectionTopic, [{action: "update", source: this, entry: entry, callback: this._handleSave }]); //TODO: REMOVE BELOW //var atomIO = new dojox.atom.io.Connection(); //atomIO.updateEntry(entry, dojo.hitch(this,this._handleSave)); //WARNING: Use above when testing with SimpleProxy (or any other servlet which // doesn't actually create a new entry and return it properly) //atomIO.updateEntry(entry, dojo.hitch(this,this._handleSave), true); } }else{ this._new = false; entry = new dojox.atom.io.model.Entry(); value = this._editors.title.attr('value'); if(this.entryTitleSelect.value === "xhtml"){ value = this._enforceXhtml(value); value = '
' + value + '
'; } entry.setTitle(value, this.entryTitleSelect.value); entry.id = this._editors.id.attr('value'); authors = this._editors.authors.getValues(); for(i in authors){ if(authors[i].name || authors[i].email || authors[i].uri){ entry.addAuthor(authors[i].name, authors[i].email, authors[i].uri); } } contributors = this._editors.contributors.getValues(); for(i in contributors){ if(contributors[i].name || contributors[i].email || contributors[i].uri){ entry.addContributor(contributors[i].name, contributors[i].email, contributors[i].uri); } } value = this._editors.summary.attr('value'); if(this.entrySummarySelect.value === "xhtml"){ value = this._enforceXhtml(value); value = '
' + value + '
'; } entry.summary = new dojox.atom.io.model.Content("summary", value, null, this.entrySummarySelect.value); value = this._editors.content.attr('value'); if(this.entryContentSelect.value === "xhtml"){ value = this._enforceXhtml(value); value = '
' + value + '
'; } entry.content = new dojox.atom.io.model.Content("content", value, null, this.entryContentSelect.value); dojo.style(this.entryNewButton, 'display', ''); dojo.publish(this.entrySelectionTopic, [{action: "post", source: this, entry: entry }]); } this._editMode = false; //Rebuild the view using the same entry and feed. this.setEntry(entry, this._feed, true); }, _handleSave: function(/*object*/entry, /*string*/location){ // summary: // Function for handling the save of an entry, cleaning up the display after the edit is completed. // description: // Function for handling the save of an entry, cleaning up the display after the edit is completed. // // entry: dojox.atom.io.model.Entry object // The entry that was saved. // Location: String // A URL to be used, not used here, but part of the call back from the AtomIO // returns: // Nothing. //Close the editor and revert out. this._editMode = false; //Rebuild the view using the same entry and feed. this.clear(); this.setEntry(entry, this.getFeed(), true); }, cancelEdits: function(){ // summary: // Cancels edits and reverts the editor to its previous state (display mode) // description: // Cancels edits and reverts the editor to its previous state (display mode) // // returns: // Nothing. this._new = false; dojo.style(this.entrySaveCancelButtons, 'display', 'none'); if(this._editable){ dojo.style(this.entryEditButton, 'display', ''); } dojo.style(this.entryNewButton, 'display', ''); this._editMode = false; //Rebuild the view using the same entry and feed. this.clearEditors(); this.setEntry(this.getEntry(), this.getFeed(), true); }, clear: function(){ // summary: // Clears the editor, destorys all editors, leaving the editor completely clear // description: // Clears the editor, destorys all editors, leaving the editor completely clear this._editable=false; this.clearEditors(); dojox.atom.widget.FeedEntryEditor.superclass.clear.apply(this); if(this._contentEditor){ // Note that the superclass clear destroys the widget since it's in the child widget list, // so this is just ref clearing. this._contentEditor = this._setObject = this._oldContent = this._contentEditorCreator = null; this._editors = {}; } }, clearEditors: function(){ for(var key in this._editors){ if(this._editors[key].declaredClass === "dijit.Editor"){ this._editors[key].close(false, true); } this._editors[key].destroy(); } this._editors = {}; }, _enforceXhtml: function(/*string*/html){ // summary: // Function for cleaning up/enforcing the XHTML standard in HTML returned from the editor2 widget. // description: // Function for cleaning up/enforcing the XHTML standard in HTML returned from the editor2 widget. // // html: // HTML string to be enforced as xhtml. // // returns: // string of cleaned up HTML. var xhtml = null; if(html){ //Handle
var brRegExp = /
/g; xhtml = html.replace(brRegExp, "
"); //Handle
xhtml = this._closeTag(xhtml, "hr"); //Handle xhtml = this._closeTag(xhtml, "img"); } return xhtml; }, _closeTag: function(/*string*/xhtml, /*string*/tag){ // summary: // Function for closing tags in a text of HTML/XHTML // description: // Function for closing tags in a text of HTML/XHTML // // xhtml: String // XHTML string which needs the closing tag. // tag: // The tag to close. // // returns: string of cleaned up HTML. // // NOTE: Probably should redo this function in a more efficient way. This could get expensive. var tagStart = "<" + tag; var tagIndex = xhtml.indexOf(tagStart); if(tagIndex !== -1){ while (tagIndex !== -1){ var tempString = ""; var foundTagEnd = false; for (var i = 0; i < xhtml.length; i++){ var c = xhtml.charAt(i); if(i <= tagIndex ||foundTagEnd){ tempString += c; } else { if(c === '>'){ tempString += "/"; foundTagEnd = true; } tempString +=c; } } xhtml = tempString; tagIndex = xhtml.indexOf(tagStart, tagIndex + 1); } } return xhtml; }, _toggleNew: function(){ // summary: // Function to put the editor into a state to create a new entry. // description: // Function to put the editor into a state to create a new entry. // Hide the edit/new buttons and show the save/cancel buttons. dojo.style(this.entryNewButton, 'display', 'none'); dojo.style(this.entryEditButton, 'display', 'none'); dojo.style(this.entrySaveCancelButtons, 'display', ''); // Reset the type select boxes to text. this.entrySummarySelect.value = "text"; this.entryContentSelect.value = "text"; this.entryTitleSelect.value = "text"; // Clear all nodes. this.clearNodes(); this._new = true; var _nlsResources = dojo.i18n.getLocalization("dojox.atom.widget", "FeedEntryViewer"); // Create all headers and editors. var titleHeader = new dojox.atom.widget.EntryHeader({title: _nlsResources.title}); this.entryTitleHeader.appendChild(titleHeader.domNode); this._editors.title = this._createEditor(this.entryTitleNode, null); this.setFieldValidity("title",true); var authorHeader = new dojox.atom.widget.EntryHeader({title: _nlsResources.authors}); this.entryAuthorHeader.appendChild(authorHeader.domNode); this._editors.authors = this._createPeopleEditor(this.entryAuthorNode, {name: "Author"}); this.setFieldValidity("authors", true); var contributorHeader = new dojox.atom.widget.EntryHeader({title: _nlsResources.contributors}); this.entryContributorHeader.appendChild(contributorHeader.domNode); this._editors.contributors = this._createPeopleEditor(this.entryContributorNode, {name: "Contributor"}); this.setFieldValidity("contributors", true); var idHeader = new dojox.atom.widget.EntryHeader({title: _nlsResources.id}); this.entryIdHeader.appendChild(idHeader.domNode); this._editors.id = this._createEditor(this.entryIdNode, null); this.setFieldValidity("id",true); var updatedHeader = new dojox.atom.widget.EntryHeader({title: _nlsResources.updated}); this.entryUpdatedHeader.appendChild(updatedHeader.domNode); this._editors.updated = this._createEditor(this.entryUpdatedNode, null); this.setFieldValidity("updated",true); var summaryHeader = new dojox.atom.widget.EntryHeader({title: _nlsResources.summary}); this.entrySummaryHeader.appendChild(summaryHeader.domNode); this._editors.summary = this._createEditor(this.entrySummaryNode, null, true); this.setFieldValidity("summaryedit",true); this.setFieldValidity("summary",true); var contentHeader = new dojox.atom.widget.EntryHeader({title: _nlsResources.content}); this.entryContentHeader.appendChild(contentHeader.domNode); this._editors.content = this._createEditor(this.entryContentNode, null, true); this.setFieldValidity("contentedit",true); this.setFieldValidity("content",true); // Show the sections. this._displaySections(); }, _displaySections: function(){ // summary: Function to display the appropriate sections based on validity. // description: Function to display the appropriate sections based on validity. // Hide select boxes. dojo.style(this.entrySummarySelect, 'display', 'none'); dojo.style(this.entryContentSelect, 'display', 'none'); dojo.style(this.entryTitleSelect, 'display', 'none'); // Show select boxes if the flags are set. if(this.isFieldValid("contentedit")){ dojo.style(this.entryContentSelect, 'display', ''); } if(this.isFieldValid("summaryedit")){ dojo.style(this.entrySummarySelect, 'display', ''); } if(this.isFieldValid("titleedit")){ dojo.style(this.entryTitleSelect, 'display', ''); } // Call super's _displaySections. dojox.atom.widget.FeedEntryEditor.superclass._displaySections.apply(this); // If we have editors to load after the nodes are created on the page, execute those now. if(this._toLoad){ for(var i in this._toLoad){ var editor; if(this._toLoad[i].generateEditor){ editor = dojo.hitch(this._toLoad[i], this._toLoad[i].generateEditor)(); }else{ editor = this._toLoad[i]; } this._editors[this._toLoad[i].name] = editor; this._toLoad[i] = null; } this._toLoad = null; } } }); dojo.declare("dojox.atom.widget.PeopleEditor",[dijit._Widget, dijit._Templated, dijit._Container],{ // summary: // An editor for dojox.atom.io.model.Person objects. // description: // An editor for dojox.atom.io.model.Person objects. Displays multiple rows for the respective arrays // of people. Can add/remove rows on the fly. templatePath: dojo.moduleUrl("dojox.atom", "widget/templates/PeopleEditor.html"), _rows: [], _editors: [], _index: 0, _numRows: 0, postCreate: function(){ // Initializer function for the PeopleEditor widget. var _nlsResources = dojo.i18n.getLocalization("dojox.atom.widget", "PeopleEditor"); if(this.name){ if(this.name == "Author"){ this.peopleEditorButton.appendChild(document.createTextNode("["+_nlsResources.addAuthor+"]")); }else if(this.name == "Contributor"){ this.peopleEditorButton.appendChild(document.createTextNode("["+_nlsResources.addContributor+"]")); } }else{ this.peopleEditorButton.appendChild(document.createTextNode("["+_nlsResources.add+"]")); } this._editors = []; if(!this.data || this.data.length===0){ this._createEditors(null, null, null, 0, this.name); this._index = 1; }else{ for(var i in this.data){ this._createEditors(this.data[i].name, this.data[i].email, this.data[i].uri, i); this._index++; this._numRows++; } }";s:7:"summary";s:0:"";}s:38:"dojox.atom.widget.PeopleEditor.destroy";a:4:{s:9:"prototype";s:30:"dojox.atom.widget.PeopleEditor";s:4:"type";s:8:"Function";s:6:"source";s:149:" for(var key in this._editors){ for(var key2 in this._editors[key]){ this._editors[key][key2].destroy(); } } this._editors = [];";s:7:"summary";s:0:"";}s:45:"dojox.atom.widget.PeopleEditor._createEditors";a:7:{s:9:"prototype";s:30:"dojox.atom.widget.PeopleEditor";s:4:"type";s:8:"Function";s:10:"parameters";a:5:{s:4:"name";a:2:{s:4:"type";s:6:"string";s:7:"summary";s:24:"The name of this Person.";}s:5:"email";a:2:{s:4:"type";s:6:"string";s:7:"summary";s:25:"The email of this Person.";}s:3:"uri";a:2:{s:4:"type";s:6:"string";s:7:"summary";s:17:"The Person's URI.";}s:5:"index";a:2:{s:4:"type";s:3:"int";s:7:"summary";s:37:"The row index to use for this Person.";}s:10:"widgetName";a:1:{s:4:"type";s:6:"string";}}s:6:"source";s:1752:" var row = document.createElement("tr"); this.peopleEditorEditors.appendChild(row); row.id = "removeRow"+index; var node = document.createElement("td"); node.setAttribute('align', 'right'); row.appendChild(node); node.colSpan = 2; if(this._numRows>0){ var hr = document.createElement("hr"); node.appendChild(hr); hr.id = "hr"+index; } row = document.createElement("span"); node.appendChild(row); row.className = "peopleEditorButton"; dojo.style(row, 'font-size', 'x-small'); dojo.connect(row, "onclick", this, "_removeEditor"); row.id = "remove"+index; node = document.createTextNode("[X]"); row.appendChild(node); row = document.createElement("tr"); this.peopleEditorEditors.appendChild(row); row.id = "editorsRow"+index; var labelNode = document.createElement("td"); row.appendChild(labelNode); dojo.style(labelNode, 'width', '20%'); node = document.createElement("td"); row.appendChild(node); row = document.createElement("table"); labelNode.appendChild(row); dojo.style(row, 'width', '100%'); labelNode = document.createElement("tbody"); row.appendChild(labelNode); row = document.createElement("table"); node.appendChild(row); dojo.style(row, 'width', '100%'); node = document.createElement("tbody"); row.appendChild(node); this._editors[index] = []; this._editors[index].push(this._createEditor(name, widgetName+'name'+index, 'Name:', labelNode, node)); this._editors[index].push(this._createEditor(email, widgetName+'email'+index, 'Email:', labelNode, node)); this._editors[index].push(this._createEditor(uri, widgetName+'uri'+index, 'URI:', labelNode, node));";s:7:"summary";s:77:"creates editor boxes (textbox widgets) for the individual values of a Person.";s:11:"description";s:77:"creates editor boxes (textbox widgets) for the individual values of a Person.";s:7:"private";b:1;}s:44:"dojox.atom.widget.PeopleEditor._createEditor";a:8:{s:9:"prototype";s:30:"dojox.atom.widget.PeopleEditor";s:4:"type";s:8:"Function";s:10:"parameters";a:5:{s:5:"value";a:2:{s:4:"type";s:6:"string";s:7:"summary";s:32:"The initial value of the textbox";}s:2:"id";a:2:{s:4:"type";s:6:"string";s:7:"summary";s:31:"The id the textbox should have.";}s:4:"name";a:2:{s:4:"type";s:6:"string";s:7:"summary";s:54:"The text to put in the label element for this textbox.";}s:9:"labelNode";a:2:{s:4:"type";s:8:"DOM node";s:7:"summary";s:32:"The node to attach the label to.";}s:4:"node";a:2:{s:4:"type";s:8:"DOM node";s:7:"summary";s:38:"The node to attach the editor rows to.";}}s:6:"source";s:727:" var row = document.createElement("tr"); labelNode.appendChild(row); var label = document.createElement("label"); label.setAttribute('for', id); label.appendChild(document.createTextNode(name)); labelNode = document.createElement("td"); labelNode.appendChild(label); row.appendChild(labelNode); row = document.createElement("tr"); node.appendChild(row); node = document.createElement("td"); row.appendChild(node); var viewNode = document.createElement("input"); viewNode.setAttribute('id', id); node.appendChild(viewNode); dojo.style(viewNode, 'width', '95%'); var box = new dijit.form.TextBox({},viewNode); box.attr('value', value); return box;";s:7:"summary";s:58:"Creates an individual editor widget (textbox) for a value.";s:11:"description";s:58:"Creates an individual editor widget (textbox) for a value.";s:14:"return_summary";s:14:"Editor widget.";s:7:"private";b:1;}s:44:"dojox.atom.widget.PeopleEditor._removeEditor";a:7:{s:9:"prototype";s:30:"dojox.atom.widget.PeopleEditor";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:5:"event";a:2:{s:4:"type";s:6:"object";s:7:"summary";s:66:"The event generated when the remove button is pressed on the page.";}}s:6:"source";s:698:" var target = null; if(dojo.isIE){ target = event.srcElement; }else{ target = event.target; } var id = target.id; id = id.substring(6); for(var key in this._editors[id]){ this._editors[id][key].destroy(); } var node = dojo.byId("editorsRow"+id); var parent = node.parentNode; parent.removeChild(node); node = dojo.byId("removeRow"+id); parent = node.parentNode; parent.removeChild(node); this._numRows--; if(this._numRows === 1 && parent.firstChild.firstChild.firstChild.tagName.toLowerCase() === "hr"){ node = parent.firstChild.firstChild; node.removeChild(node.firstChild); } this._editors[id] = null;";s:7:"summary";s:42:"Removes a Person from our list of editors.";s:11:"description";s:100:"Removes a Person from our list of editors by removing the block of editors that make up that Person.";s:7:"private";b:1;}s:35:"dojox.atom.widget.PeopleEditor._add";a:6:{s:9:"prototype";s:30:"dojox.atom.widget.PeopleEditor";s:4:"type";s:8:"Function";s:6:"source";s:92:" this._createEditors(null, null, null, this._index); this._index++; this._numRows++;";s:7:"summary";s:56:"Adds a new block of blank editors to represent a Person.";s:11:"description";s:56:"Adds a new block of blank editors to represent a Person.";s:7:"private";b:1;}s:40:"dojox.atom.widget.PeopleEditor.getValues";a:6:{s:9:"prototype";s:30:"dojox.atom.widget.PeopleEditor";s:4:"type";s:8:"Function";s:6:"source";s:249:" var values = []; for(var i in this._editors){ if(this._editors[i]){ values.push({name: this._editors[i][0].attr('value'), email: this._editors[i][1].attr('value'), uri: this._editors[i][2].attr('value')}); } } return values;";s:7:"summary";s:43:"Gets the values of this editor in an array.";s:11:"description";s:91:"Gets the values of this editor in an array, with each Person as an object within the array.";s:14:"return_summary";s:71:"An array of anonymous objects representing dojox.atom.io.model.Persons.";}s:35:"dojox.atom.widget.PeopleEditor.name";a:2:{s:8:"instance";s:30:"dojox.atom.widget.PeopleEditor";s:7:"summary";s:0:"";}s:42:"dojox.atom.widget.PeopleEditor.data.length";a:2:{s:8:"instance";s:30:"dojox.atom.widget.PeopleEditor";s:7:"summary";s:0:"";}s:17:"dojox.atom.widget";a:2:{s:4:"type";s:6:"Object";s:7:"summary";s:0:"";}s:10:"dojox.atom";a:2:{s:4:"type";s:6:"Object";s:7:"summary";s:0:"";}s:5:"dojox";a:2:{s:4:"type";s:6:"Object";s:7:"summary";s:0:"";}}