As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
onActionAddNoteReal: function EMPSP_onActionAddNoteReal() { var scope = this; // Intercept before dialog show var doBeforeDialogShow = function EMPSP_onAddNoteReal_doBeforeDialogShow(p_form, p_dialog) { // Dialog title var fileSpan = '<span>' + $html(Alfresco.constants.SITE) + '</span>'; var empNameSpan = '<span>' + $html(this.options.empName) + '</span>'; var siteInput = '<input type="hidden" id="' + p_dialog.id + "-site" + '" name="site" value="' + $html(Alfresco.constants.SITE) + '" />'; Alfresco.util.populateHTML( [ p_dialog.id + "-dialogTitle", scope.msg("add-a-note.title", fileSpan, empNameSpan)], [ p_dialog.id + "-siteCode", siteInput] ); // Now set up the HTML text editor tinyMCE.init({ mode : "exact", elements: p_dialog.id + "-content", convert_fonts_to_spans: false, theme: 'advanced', width: "100%", height: "200px", theme_advanced_buttons1: "bold,italic,underline,|,bullist,numlist,|,forecolor,|,undo,redo,removeformat", theme_advanced_toolbar_location: "top", theme_advanced_toolbar_align: "left", theme_advanced_statusbar_location: "bottom", theme_advanced_resizing: false, theme_advanced_buttons2: null, theme_advanced_buttons3: null, theme_advanced_path: false, language: Alfresco.constants.JS_LOCALE.substring(0,2) }); }; // Using Forms Service, so always create new instance var uniqueFormId = this.id + "-addNote-" + Alfresco.util.generateDomId(); var addNote = new Alfresco.module.SimpleDialog(uniqueFormId); var actionUrl = YAHOO.lang.substitute(Alfresco.constants.PROXY_URI + "api/node/{nodeRef}/comments", { nodeRef: this.options.nodeRef.replace(":/", "") }); var templateUrl = YAHOO.lang.substitute(Alfresco.constants.URL_SERVICECONTEXT + "components/form?itemKind={itemKind}&itemId={itemId}&destination={destination}&mode={mode}&submitType={submitType}&formId={formId}&showCancelButton=true", { itemKind: "node", itemId: this.options.nodeRef, mode: "edit", submitType: "json", formId: "fg-add-comment" }); addNote.setOptions( { width: "50em", templateUrl: templateUrl, actionUrl: actionUrl, destroyOnHide: true, doBeforeDialogShow: { fn: doBeforeDialogShow, scope: this }, doBeforeFormSubmit: { fn: function EMPSP_onAddNoteBFS(p_form) { if(tinyMCE.activeEditor.isDirty()) { // Make sure the editors content is saved down to the form this._setBusy(this.msg("message.details.wait",Alfresco.constants.SITE, this.options.empName)); tinyMCE.activeEditor.save(); tinyMCE.activeEditor.undoManager.clear(); tinyMCE.activeEditor.nodeChanged(); } }, scope: this }, doBeforeAjaxRequest: { fn: function EMPSP_onAddNoteBFAR() { /* * If the notes box was blank then * don't invoke the ajax save, * we set busy in _setBusy / _releaseBusy */ if(!this.busy) { return false; } else { return true; } }, scope: this }, onSuccess: { fn: function EMPSP_onAddNote_success(response) { this._releaseBusy(); // Display success message Alfresco.util.PopupManager.displayMessage( { text: this.msg("message.details.success",this.options.empNo,this.options.empName) }); YAHOO.Bubbling.fire("interDashletMessage", { message: "commentadded" }); }, scope: this }, onFailure: { fn: function EMPSP_onAddNote_failure(response) { this._releaseBusy(); Alfresco.util.PopupManager.displayMessage( { text: this.msg("message.details.failure",this.options.empNo,this.options.empName) }); }, scope: this } }).show(); },
failureCallback: { fn :this._formLoadFailure, obj: this, scope:this }, scope: this,
onTemplateLoaded: function(response) { var containerDiv = document.createElement("div"); containerDiv.innerHTML = response.serverResponse.responseText; var panelDiv = Dom.getFirstChild(containerDiv); this.widgets.panel = Alfresco.util.createYUIPanel(panelDiv, { modal: true, draggable: false, constraintoviewport: true, fixedcenter: true, close: true, visible: false }); this.widgets.cancelButton = Alfresco.util.createYUIButton(this, "cancel-button", this.onCancelButtonClick); this.widgets.okButton = Alfresco.util.createYUIButton(this, "ok-button",null, { type: "submit" }); var createForm = new Alfresco.forms.Form(this.id + "-form"); var elTitle = Dom.get(this.id + "-title"), elShortName = Dom.get(this.id + "-shortName"); createForm.addValidation(elTitle, Alfresco.forms.validation.mandatory, null, "keyup", this.msg("validation-hint.mandatory")); createForm.addValidation(elTitle, Alfresco.forms.validation.length, { max: 256, crop: true }, "keyup"); createForm.setAJAXSubmit(true, { successCallback: { fn: this.onSuccess, scope: this }, failureCallback: { fn: this.onFailure, scope: this } }); createForm.setSubmitAsJSON(true); // We're in a popup, so need the tabbing fix createForm.applyTabFix(); createForm.init(); this.widgets.panel.show(); }