Diffstat (limited to 'frontend/beta/js/Clipperz/PM/Components/RecordDetail/NotesComponent.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/beta/js/Clipperz/PM/Components/RecordDetail/NotesComponent.js | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/frontend/beta/js/Clipperz/PM/Components/RecordDetail/NotesComponent.js b/frontend/beta/js/Clipperz/PM/Components/RecordDetail/NotesComponent.js index 2066543..bb23e8d 100644 --- a/frontend/beta/js/Clipperz/PM/Components/RecordDetail/NotesComponent.js +++ b/frontend/beta/js/Clipperz/PM/Components/RecordDetail/NotesComponent.js @@ -1,150 +1,148 @@ /* -Copyright 2008-2011 Clipperz Srl +Copyright 2008-2013 Clipperz Srl -This file is part of Clipperz Community Edition. -Clipperz Community Edition is an online password manager. +This file is part of Clipperz, the online password manager. For further information about its features and functionalities please refer to http://www.clipperz.com. -* Clipperz Community Edition is free software: you can redistribute - it and/or modify it under the terms of the GNU Affero General Public - License as published by the Free Software Foundation, either version - 3 of the License, or (at your option) any later version. +* Clipperz is free software: you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. -* Clipperz Community Edition is distributed in the hope that it will - be useful, but WITHOUT ANY WARRANTY; without even the implied - warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* Clipperz is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. * You should have received a copy of the GNU Affero General Public - License along with Clipperz Community Edition. If not, see - <http://www.gnu.org/licenses/>. + License along with Clipperz. If not, see http://www.gnu.org/licenses/. */ if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } if (typeof(Clipperz.PM.Components) == 'undefined') { Clipperz.PM.Components = {}; } if (typeof(Clipperz.PM.Components.RecordDetail) == 'undefined') { Clipperz.PM.Components.RecordDetail = {}; } //############################################################################# Clipperz.PM.Components.RecordDetail.NotesComponent = function(anElement, args) { //MochiKit.Logging.logDebug(">>> new NotesComponent"); args = args || {}; Clipperz.PM.Components.RecordDetail.NotesComponent.superclass.constructor.call(this, anElement, args); this.mainComponent().addEditComponent(this); this._staticOffset = null; this._componentHeight = 50; this._mouseMoveIdentifier = null; this._mouseUpIdentifier = null; this.element().setVisibilityMode(YAHOO.ext.Element.DISPLAY); this.render(); //MochiKit.Logging.logDebug("<<< new NotesComponent"); return this; } //============================================================================= YAHOO.extendX(Clipperz.PM.Components.RecordDetail.NotesComponent, Clipperz.PM.Components.RecordDetail.AbstractComponent, { 'toString': function() { return "Clipperz.PM.Components.RecordDetail.NotesComponent component"; }, //------------------------------------------------------------------------- 'value': function() { return this.record().notes(); }, 'setValue': function(aValue) { this.record().setNotes(aValue); }, //------------------------------------------------------------------------- 'render': function() { //MochiKit.Logging.logDebug(">>> NotesComponent.render"); /* Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'td', colspan:'5', children:[ {tag:'span', cls:'noteFieldLabel', htmlString:Clipperz.PM.Strings['recordDetailNotesLabel']}, {tag:'div', cls:'noteFieldContent', id:this.getId('notes')} ]}); */ Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'span', cls:'noteFieldLabel', htmlString:Clipperz.PM.Strings['recordDetailNotesLabel']}); Clipperz.YUI.DomHelper.append(this.element().dom, {tag:'div', cls:'noteFieldContent', id:this.getId('notes'), children:[ {tag:'div', id:this.getId('resizableDiv'), cls:'resizable-textarea', children:[ {tag:'div', id:this.getId('contentView'), cls:'viewMode', html:""}, {tag:'div', id:this.getId('contentEdit'), children:[ {tag:'span', children:[ {tag:'textarea', id:this.getId('textarea'), html:""} ]} ]}, {tag:'div', id:this.getId('grippie'), cls:'grippie'} ]} ]}); this.getElement('contentView').setVisibilityMode(YAHOO.ext.Element.DISPLAY); this.getElement('contentEdit').setVisibilityMode(YAHOO.ext.Element.DISPLAY); MochiKit.Signal.connect(this.getId('grippie'), 'onmousedown', this, 'startResize'); this.update(); //MochiKit.Logging.logDebug("<<< NotesComponent.render"); }, //------------------------------------------------------------------------- 'updateViewMode': function() { //MochiKit.Logging.logDebug(">>> NotesComponent.updateViewMode"); // this.getElement('notes').update(this.value().replace(/\n/g, '<br>')); this.getElement('contentView').update(Clipperz.Base.sanitizeString(this.value()).replace(/\n/g, '<br>')); if (this.isNoteEmpty()) { this.element().hide(); } else { this.getElement('contentView').show(); this.getElement('contentView').setHeight(this.componentHeight()); } this.getElement('contentEdit').hide(); //MochiKit.Logging.logDebug("<<< NotesComponent.updateViewMode"); }, //------------------------------------------------------------------------- 'updateEditMode': function() { //MochiKit.Logging.logDebug(">>> NotesComponent.updateEditMode"); this.getDom('textarea').value = this.value().replace(/\n/g, Clipperz_normalizedNewLine); this.getElement('contentView').hide(); this.getElement('contentEdit').show(); this.getElement('textarea').setHeight(this.componentHeight()); //MochiKit.Logging.logDebug("<<< NotesComponent.updateEditMode"); }, //------------------------------------------------------------------------- 'synchronizeComponentValues': function() { //MochiKit.Logging.logDebug(">>> NotesComponent.synchronizeComponentValues"); if (this.getElement('textarea') != null) { this.setValue(this.getDom('textarea').value.replace(/(\x0a\x0d|\x0d\x0a)/g,'\n')); } //MochiKit.Logging.logDebug("<<< NotesComponent.synchronizeComponentValues"); }, //------------------------------------------------------------------------- 'componentHeight': function() { |