Changeset 335e66 in indico
- Timestamp:
- 10/12/10 17:29:04 (3 years ago)
- Branches:
- master, burotel, hello-world-walkthrough, ipv6, new-webex, v0.97-series, v0.98-series, v0.98.2, v0.98.3, v0.98b1, v0.98b2, v0.99, b8c30da8ebdbdcbd675a873997cc3e95f567de49, 4287315ec967a3da168d83963c14001db8487d53
- Children:
- 8eabfb, 138bf2
- Parents:
- 6e50e1
- Location:
- indico
- Files:
-
- 6 edited
-
MaKaC/webinterface/tpls/ConferenceCreation.tpl (modified) (1 diff)
-
MaKaC/webinterface/tpls/MeetingCreation.tpl (modified) (1 diff)
-
MaKaC/webinterface/tpls/SimpleEventCreation.tpl (modified) (1 diff)
-
htdocs/js/indico/Core/Auxiliar.js (modified) (1 diff)
-
htdocs/js/indico/Core/Widgets/RichText.js (modified) (5 diffs)
-
htdocs/js/indico/Legacy/Dialogs.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
indico/MaKaC/webinterface/tpls/ConferenceCreation.tpl
ra35282 r335e66 221 221 }); 222 222 223 var editor = new RichTextWidget(500, 200, "IndicoMinimal");223 var editor = new RichTextWidget(500, 200,'','rich',"IndicoMinimal"); 224 224 $E('descriptionBox').set(editor.draw()); 225 225 }); -
indico/MaKaC/webinterface/tpls/MeetingCreation.tpl
ra35282 r335e66 220 220 verifyDates(); 221 221 222 var editor = new RichTextWidget(500, 200, "IndicoMinimal");222 var editor = new RichTextWidget(500, 200,'','rich',"IndicoMinimal"); 223 223 $E('descriptionBox').set(editor.draw()); 224 224 }); -
indico/MaKaC/webinterface/tpls/SimpleEventCreation.tpl
ra35282 r335e66 189 189 190 190 191 var editor = new RichTextWidget(500, 200, "IndicoMinimal");191 var editor = new RichTextWidget(500, 200,'','rich',"IndicoMinimal"); 192 192 $E('descriptionBox').set(editor.draw()); 193 193 -
indico/htdocs/js/indico/Core/Auxiliar.js
ra35282 r335e66 31 31 32 32 var accessor = getAccessorDeep(source); 33 var field = new RichTextWidget(width, height );33 var field = new RichTextWidget(width, height, '', 'rich'); 34 34 35 35 var fieldDiv = field.draw(); -
indico/htdocs/js/indico/Core/Widgets/RichText.js
r6e50e1 r335e66 12 12 });*/ 13 13 14 type("RichText Widget", ["IWidget", "Accessor"],14 type("RichTextEditor", ["IWidget", "Accessor"], 15 15 { 16 16 draw: function() { 17 selfReference= this;17 var self = this; 18 18 this.div = Html.div({'id': 'text' + this.divId, style : {height: this.height + 75, width: this.width}}); 19 window.setTimeout(function() { 20 initializeEditor('text' + selfReference.divId , 21 selfReference.text , 22 selfReference.callbacks, 23 selfReference.width, 24 selfReference.height, 25 selfReference.toolbarSet); 19 20 setTimeout(function() { 21 initializeEditor( 22 self, 23 'text' + self.divId , 24 self.text , 25 self.callbacks, 26 self.width, 27 self.height, 28 self.toolbarSet); 26 29 },50); 27 30 return this.div; … … 66 69 return CKEDITOR.instances["text" + this.divId]; 67 70 } 68 69 71 }, 70 72 function(width, height, toolbarSet) { … … 78 80 }); 79 81 82 type("RichTextWidget", ["IWidget", "Accessor"], 83 { 84 draw: function() { 85 this.richDiv.append(this.rich.draw()); 86 return Html.div({}, 87 this.plain.draw(), 88 this.richDiv, 89 Widget.link(this.switchLink)); 90 }, 91 92 observe: function(callback) { 93 var self = this; 94 95 var observeFunc = function(value) { 96 97 self.plain.unbind(); 98 self.rich.unbind(); 99 100 if (value == 'rich') { 101 self.rich.observe(function() { 102 callback(self.rich); 103 }); 104 } else { 105 self.plain.observe(function() { 106 callback(self.plain); 107 }); 108 } 109 }; 110 111 this.selected.observe(observeFunc); 112 observeFunc(this.selected.get()); 113 }, 114 115 get: function() { 116 return this.activeAccessor.get(); 117 }, 118 119 set: function(value, noDetection) { 120 121 this.currentText = value; 122 123 if (!any(noDetection, false)) { 124 if ((this.isHtml(value)?'rich':'plain') != this.selected.get()) { 125 this.switchLink.get()(false); 126 } 127 } 128 129 if (value && (this.loaded || this.selected.get() == 'plain')) { 130 this.activeAccessor.set(value); 131 } 132 }, 133 134 synchronizePlain: function() { 135 this.currentText = this.rich.get(); 136 this.plain.set(this.currentText); 137 }, 138 139 synchronizeRich: function() { 140 this.currentText = this.plain.get(); 141 this.rich.set(this.currentText); 142 }, 143 144 isHtml: function(text) { 145 if (/<.*>[\s\S]*<\/.*>/.exec(text)) { 146 return true; 147 } else { 148 return false; 149 } 150 }, 151 152 postDraw: function() { 153 this.rich.postDraw(); 154 }, 155 156 destroy: function() { 157 this.rich.destroy(); 158 } 159 }, 160 function(width, height, initialText, mode, toolbarSet) { 161 162 var textAreaParams = { style: {} }; 163 textAreaParams.style.width = pixels(width); 164 textAreaParams.style.height = pixels(height); 165 166 this.plain = new RealtimeTextArea(textAreaParams); 167 this.rich = new RichTextEditor(width, height, toolbarSet); 168 this.richDiv = Html.div({}); 169 this.currentText = any(initialText, ''); 170 this.loaded = false; 171 172 this.selected = new WatchValue(); 173 174 var toPlainFunc = function(sync) { 175 self.plain.setStyle('display', 'block'); 176 self.richDiv.setStyle('display', 'none'); 177 self.switchLink.set('toRich'); 178 self.activeAccessor = self.plain; 179 self.selected.set('plain'); 180 if (sync !== false) { 181 self.synchronizePlain(); 182 } 183 }; 184 185 var toRichFunc = function(sync) { 186 self.plain.setStyle('display', 'none'); 187 self.richDiv.setStyle('display', 'block'); 188 self.switchLink.set('toPlain'); 189 self.activeAccessor = self.rich; 190 self.selected.set('rich'); 191 if (sync !== false) { 192 self.synchronizeRich(); 193 } 194 }; 195 196 var self = this; 197 this.switchLink = new Chooser( 198 { 199 toPlain: command( 200 toPlainFunc, 201 $T("switch to plain text")), 202 toRich: command( 203 toRichFunc, 204 $T("switch to rich text")) 205 }); 206 207 if (exists(mode) && mode=='rich') { 208 toRichFunc(); 209 } else if (exists(mode)){ 210 toPlainFunc(); 211 } else if (self.isHtml(self.currentText)) { 212 toRichFunc(); 213 } else { 214 toPlainFunc(); 215 } 216 217 this.rich.onLoad(function() { 218 self.loaded = true; 219 self.set(self.currentText, true); 220 }); 221 222 }); 223 224 80 225 type("RichTextInlineEditWidget", ["InlineEditWidget"], 81 226 { 82 227 _handleEditMode: function(value) { 83 228 84 this.description = new RichTextWidget(600, 400,'IndicoMinimal'); 229 this.description = new RichTextWidget(600, 400, 230 '','rich', 231 'IndicoMinimal'); 85 232 this.description.set(value); 86 233 return this.description.draw(); … … 133 280 134 281 135 function initializeEditor( editorId, text, callbacks, width, height, toolbarSet ){ 282 function initializeEditor( wrapper, editorId, text, callbacks, width, height, toolbarSet ){ 283 // "wrapper" is the actual Indico API object that represents an editor 284 136 285 try { 137 286 138 287 CKEDITOR.replace(editorId, {language : userLanguage, width : width, height : height - 75, 'toolbar': toolbarSet}); 139 CKEDITOR.instances[editorId].setData(text); 140 CKEDITOR.instances[editorId].on ('key', function(e) 288 289 var cki = CKEDITOR.instances[editorId]; 290 291 cki.setData(text); 292 cki.on ('key', function(e) 141 293 { 142 294 each(callbacks, function(func) { … … 144 296 }) 145 297 }); 298 299 // process onLoad events for each individual instance (wrapper) 300 cki.on ('instanceReady', function(e) 301 { 302 each(wrapper.onLoadList, function(callback) { 303 callback(); 304 }); 305 306 }); 307 146 308 } 147 309 catch (error) { 148 window.setTimeout(function() {149 initializeEditor( editorId, text, callbacks, width, height);310 setTimeout(function() { 311 initializeEditor(wrapper, editorId, text, callbacks, width, height); 150 312 },50); 151 313 } -
indico/htdocs/js/indico/Legacy/Dialogs.js
ra35282 r335e66 583 583 var killProgress = null; 584 584 585 var rtWidget = new RichTextWidget(700, 400,'IndicoFull');585 var rtWidget = new RichTextWidget(700, 400, '', 'rich', 'IndicoFull'); 586 586 587 587 var saveButton;
Note: See TracChangeset
for help on using the changeset viewer.
