View | Details | Raw Unified | Return to bug 6759
Collapse All | Expand All

(-)a/plugins/generic/tinymce/TinyMCEPlugin.inc.php (-100 / +125 lines)
 Lines 69-104   class TinyMCEPlugin extends GenericPlugin { Link Here 
69
		switch ("$page/$op") {
69
		switch ("$page/$op") {
70
			case 'admin/settings':
70
			case 'admin/settings':
71
			case 'admin/saveSettings':
71
			case 'admin/saveSettings':
72
				$fields[] = 'intro';
72
				$fields[0][] = 'intro';
73
				$fields[] = 'aboutField';
73
				$fields[0][] = 'aboutField';
74
				break;
74
				break;
75
			case 'admin/createJournal':
75
			case 'admin/createJournal':
76
			case 'admin/updateJournal':
76
			case 'admin/updateJournal':
77
			case 'admin/editJournal':
77
			case 'admin/editJournal':
78
				$fields[] = 'description';
78
				$fields[0][] = 'description';
79
				break;
79
				break;
80
			case 'author/submit':
80
			case 'author/submit':
81
			case 'author/saveSubmit':
81
			case 'author/saveSubmit':
82
				switch (array_shift(Request::getRequestedArgs())) {
82
				switch (array_shift(Request::getRequestedArgs())) {
83
					case 1: $fields[] = 'commentsToEditor'; break;
83
					case 1: $fields[0][] = 'commentsToEditor'; break;
84
					case 3:
84
					case 3:
85
						$count = max(1, count($templateMgr->get_template_vars('authors')));
85
						$count = max(1, count($templateMgr->get_template_vars('authors')));
86
						for ($i=0; $i<$count; $i++) {
86
						for ($i=0; $i<$count; $i++) {
87
							$fields[] = "authors-$i-biography";
87
							$fields[0][] = "authors-$i-biography";
88
							$fields[] = "authors-$i-competingInterests";
88
							$fields[0][] = "authors-$i-competingInterests";
89
						}
89
						}
90
						$fields[] = 'abstract';
90
						$fields[0][] = 'abstract';
91
						$fields[1][] = 'title';
91
						break;
92
						break;
92
				}
93
				}
93
				break;
94
				break;
94
			case 'author/submitSuppFile':
95
			case 'author/submitSuppFile':
95
			case 'author/saveSubmitSuppFile':
96
			case 'author/saveSubmitSuppFile':
96
				$fields[] = 'description'; break;
97
				$fields[0][] = 'description'; break;
97
			case 'editor/createIssue':
98
			case 'editor/createIssue':
98
			case 'editor/issueData':
99
			case 'editor/issueData':
99
			case 'editor/editIssue':
100
			case 'editor/editIssue':
100
				$fields[] = 'description';
101
				$fields[0][] = 'description';
101
				$fields[] = 'coverPageDescription';
102
				$fields[0][] = 'coverPageDescription';
102
				break;
103
				break;
103
			case 'author/viewCopyeditComments':
104
			case 'author/viewCopyeditComments':
104
			case 'author/postCopyeditComment':
105
			case 'author/postCopyeditComment':
 Lines 146-166   class TinyMCEPlugin extends GenericPlugin { Link Here 
146
			case 'layoutEditor/postProofreadComment':
147
			case 'layoutEditor/postProofreadComment':
147
			case 'layoutEditor/editComment':
148
			case 'layoutEditor/editComment':
148
			case 'layoutEditor/saveComment':
149
			case 'layoutEditor/saveComment':
149
				$fields[] = 'comments';
150
				$fields[0][] = 'comments';
150
				break;
151
				break;
151
			case 'manager/createAnnouncement':
152
			case 'manager/createAnnouncement':
152
			case 'manager/editAnnouncement':
153
			case 'manager/editAnnouncement':
153
			case 'manager/updateAnnouncement':
154
			case 'manager/updateAnnouncement':
154
				$fields[] = 'descriptionShort';
155
				$fields[0][] = 'descriptionShort';
155
				$fields[] = 'description';
156
				$fields[0][] = 'description';
156
				break;
157
				break;
157
			case 'manager/importexport':
158
			case 'manager/importexport':
158
				$count = max(1, count($templateMgr->get_template_vars('authors')));
159
				$count = max(1, count($templateMgr->get_template_vars('authors')));
159
				for ($i=0; $i<$count; $i++) {
160
				for ($i=0; $i<$count; $i++) {
160
					$fields[] = "authors-$i-biography";
161
					$fields[0][] = "authors-$i-biography";
161
					$fields[] = "authors-$i-competingInterests";
162
					$fields[0][] = "authors-$i-competingInterests";
162
				}
163
				}
163
				$fields[] = 'abstract';
164
				$fields[0][] = 'abstract';
165
				$fields[1][] = 'title';
164
				break;
166
				break;
165
			case 'user/profile':
167
			case 'user/profile':
166
			case 'user/register':
168
			case 'user/register':
 Lines 169-248   class TinyMCEPlugin extends GenericPlugin { Link Here 
169
			case 'subscriptionManager/updateUser':
171
			case 'subscriptionManager/updateUser':
170
			case 'manager/createUser':
172
			case 'manager/createUser':
171
			case 'manager/updateUser':
173
			case 'manager/updateUser':
172
				$fields[] = 'mailingAddress';
174
				$fields[0][] = 'mailingAddress';
173
				$fields[] = 'biography';
175
				$fields[0][] = 'biography';
174
				break;
176
				break;
175
			case 'manager/editReviewForm':
177
			case 'manager/editReviewForm':
176
			case 'manager/updateReviewForm':
178
			case 'manager/updateReviewForm':
177
			case 'manager/createReviewForm':
179
			case 'manager/createReviewForm':
178
				$fields[] = 'description';
180
				$fields[0][] = 'description';
179
				break;
181
				break;
180
			case 'manager/editReviewFormElement':
182
			case 'manager/editReviewFormElement':
181
			case 'manager/updateReviewFormElement':
183
			case 'manager/updateReviewFormElement':
182
			case 'manager/createReviewFormElement':
184
			case 'manager/createReviewFormElement':
183
				$fields[] = 'question';
185
				$fields[0][] = 'question';
184
				break;
186
				break;
185
			case 'manager/editSection':
187
			case 'manager/editSection':
186
			case 'manager/updateSection':
188
			case 'manager/updateSection':
187
			case 'manager/createSection':
189
			case 'manager/createSection':
188
				$fields[] = 'policy';
190
				$fields[0][] = 'policy';
189
				break;
191
				break;
190
			case 'manager/setup':
192
			case 'manager/setup':
191
			case 'manager/saveSetup':
193
			case 'manager/saveSetup':
192
				$args = Request::getRequestedArgs();
194
				$args = Request::getRequestedArgs();
193
				switch (array_shift($args)) {
195
				switch (array_shift($args)) {
194
					case 1:
196
					case 1:
195
						$fields[] = 'mailingAddress';
197
						$fields[0][] = 'mailingAddress';
196
						$fields[] = 'contactMailingAddress';
198
						$fields[0][] = 'contactMailingAddress';
197
						$fields[] = 'publisherNote';
199
						$fields[0][] = 'publisherNote';
198
						$fields[] = 'sponsorNote';
200
						$fields[0][] = 'sponsorNote';
199
						$fields[] = 'contributorNote';
201
						$fields[0][] = 'contributorNote';
200
						$fields[] = 'history';
202
						$fields[0][] = 'history';
201
						break;
203
						break;
202
					case 2:
204
					case 2:
203
						$fields[] = 'focusScopeDesc';
205
						$fields[0][] = 'focusScopeDesc';
204
						$fields[] = 'reviewPolicy';
206
						$fields[0][] = 'reviewPolicy';
205
						$fields[] = 'reviewGuidelines';
207
						$fields[0][] = 'reviewGuidelines';
206
						$fields[] = 'privacyStatement';
208
						$fields[0][] = 'privacyStatement';
207
						$customAboutItems = $templateMgr->get_template_vars('customAboutItems');
209
						$customAboutItems = $templateMgr->get_template_vars('customAboutItems');
208
						$count = max(1, isset($customAboutItems[$formLocale])?count($customAboutItems[$formLocale]):0);
210
						$count = max(1, isset($customAboutItems[$formLocale])?count($customAboutItems[$formLocale]):0);
209
						for ($i=0; $i<$count; $i++) {
211
						for ($i=0; $i<$count; $i++) {
210
							// 1 extra in case of new field
212
							// 1 extra in case of new field
211
							$fields[] = "customAboutItems-$i-content";
213
							$fields[0][] = "customAboutItems-$i-content";
212
						}
214
						}
213
						$fields[] = 'lockssLicense';
215
						$fields[0][] = 'lockssLicense';
214
						break;
216
						break;
215
					case 3:
217
					case 3:
216
						$fields[] = 'authorGuidelines';
218
						$fields[0][] = 'authorGuidelines';
217
						$submissionChecklist = $templateMgr->get_template_vars('submissionChecklist');
219
						$submissionChecklist = $templateMgr->get_template_vars('submissionChecklist');
218
						$count = max(1, isset($submissionChecklist[$formLocale])?count($submissionChecklist[$formLocale]):0);
220
						$count = max(1, isset($submissionChecklist[$formLocale])?count($submissionChecklist[$formLocale]):0);
219
						for ($i=0; $i<$count; $i++) {
221
						for ($i=0; $i<$count; $i++) {
220
							$fields[] = "submissionChecklist-$i";
222
							$fields[0][] = "submissionChecklist-$i";
221
						}
223
						}
222
						$fields[] = 'copyrightNotice';
224
						$fields[0][] = 'copyrightNotice';
223
						$fields[] = 'competingInterestGuidelines';
225
						$fields[0][] = 'competingInterestGuidelines';
224
						break;
226
						break;
225
					case 4:
227
					case 4:
226
						$fields[] = 'openAccessPolicy';
228
						$fields[0][] = 'openAccessPolicy';
227
						$fields[] = 'pubFreqPolicy';
229
						$fields[0][] = 'pubFreqPolicy';
228
						$fields[] = 'announcementsIntroduction';
230
						$fields[0][] = 'announcementsIntroduction';
229
						$fields[] = 'copyeditInstructions';
231
						$fields[0][] = 'copyeditInstructions';
230
						$fields[] = 'layoutInstructions';
232
						$fields[0][] = 'layoutInstructions';
231
						$fields[] = 'refLinkInstructions';
233
						$fields[0][] = 'refLinkInstructions';
232
						$fields[] = 'proofInstructions';
234
						$fields[0][] = 'proofInstructions';
233
						break;
235
						break;
234
					case 5:
236
					case 5:
235
						$fields[] = 'description';
237
						$fields[0][] = 'description';
236
						$fields[] = 'additionalHomeContent';
238
						$fields[0][] = 'additionalHomeContent';
237
						$fields[] = 'journalPageHeader';
239
						$fields[0][] = 'journalPageHeader';
238
						$fields[] = 'journalPageFooter';
240
						$fields[0][] = 'journalPageFooter';
239
						$fields[] = 'readerInformation';
241
						$fields[0][] = 'readerInformation';
240
						$fields[] = 'librarianInformation';
242
						$fields[0][] = 'librarianInformation';
241
						$fields[] = 'authorInformation';
243
						$fields[0][] = 'authorInformation';
242
						break;
244
						break;
243
				}
245
				}
244
				break;
246
				break;
245
			case 'reviewer/submission': $fields[] = 'competingInterests'; break;
247
			case 'reviewer/submission': $fields[0][] = 'competingInterests'; break;
246
			case 'reviewer/viewPeerReviewComments':
248
			case 'reviewer/viewPeerReviewComments':
247
			case 'reviewer/postPeerReviewComment':
249
			case 'reviewer/postPeerReviewComment':
248
			case 'editor/viewPeerReviewComments':
250
			case 'editor/viewPeerReviewComments':
 Lines 251-258   class TinyMCEPlugin extends GenericPlugin { Link Here 
251
			case 'sectionEditor/postPeerReviewComment':
253
			case 'sectionEditor/postPeerReviewComment':
252
			case 'reviewer/editComment':
254
			case 'reviewer/editComment':
253
			case 'reviewer/saveComment':
255
			case 'reviewer/saveComment':
254
				$fields[] = 'authorComments';
256
				$fields[0][] = 'authorComments';
255
				$fields[] = 'comments';
257
				$fields[0][] = 'comments';
256
				break;
258
				break;
257
			case 'rtadmin/editContext':
259
			case 'rtadmin/editContext':
258
			case 'rtadmin/editSearch':
260
			case 'rtadmin/editSearch':
 Lines 260-275   class TinyMCEPlugin extends GenericPlugin { Link Here 
260
			case 'rtadmin/createContext':
262
			case 'rtadmin/createContext':
261
			case 'rtadmin/createSearch':
263
			case 'rtadmin/createSearch':
262
			case 'rtadmin/createVersion':
264
			case 'rtadmin/createVersion':
263
				$fields[] = 'description';
265
				$fields[0][] = 'description';
264
				break;
266
				break;
265
			case 'editor/createReviewer':
267
			case 'editor/createReviewer':
266
			case 'sectionEditor/createReviewer':
268
			case 'sectionEditor/createReviewer':
267
				$fields[] = 'mailingAddress';
269
				$fields[0][] = 'mailingAddress';
268
				$fields[] = 'biography';
270
				$fields[0][] = 'biography';
269
				break;
271
				break;
270
			case 'editor/submissionNotes':
272
			case 'editor/submissionNotes':
271
			case 'sectionEditor/submissionNotes':
273
			case 'sectionEditor/submissionNotes':
272
				$fields[] = 'note';
274
				$fields[0][] = 'note';
273
				break;
275
				break;
274
			case 'author/viewMetadata':
276
			case 'author/viewMetadata':
275
			case 'sectionEditor/viewMetadata':
277
			case 'sectionEditor/viewMetadata':
 Lines 281-296   class TinyMCEPlugin extends GenericPlugin { Link Here 
281
			case 'copyeditor/saveMetadata':
283
			case 'copyeditor/saveMetadata':
282
				$count = max(1, count($templateMgr->get_template_vars('authors')));
284
				$count = max(1, count($templateMgr->get_template_vars('authors')));
283
				for ($i=0; $i<$count; $i++) {
285
				for ($i=0; $i<$count; $i++) {
284
					$fields[] = "authors-$i-biography";
286
					$fields[0][] = "authors-$i-biography";
285
					$fields[] = "authors-$i-competingInterests";
287
					$fields[0][] = "authors-$i-competingInterests";
286
				}
288
				}
287
				$fields[] = 'abstract';
289
				$fields[0][] = 'abstract';
290
				$fields[1][] = 'title';
288
				break;
291
				break;
289
			case 'sectionEditor/editSuppFile':
292
			case 'sectionEditor/editSuppFile':
290
			case 'editor/editSuppFile':
293
			case 'editor/editSuppFile':
291
			case 'sectionEditor/saveSuppFile':
294
			case 'sectionEditor/saveSuppFile':
292
			case 'editor/saveSuppFile':
295
			case 'editor/saveSuppFile':
293
				$fields[] = 'description';
296
				$fields[0][] = 'description';
294
				break;
297
				break;
295
			case 'subscriptionManager/editSubscription':
298
			case 'subscriptionManager/editSubscription':
296
			case 'subscriptionManager/createSubscription':
299
			case 'subscriptionManager/createSubscription':
 Lines 298-320   class TinyMCEPlugin extends GenericPlugin { Link Here 
298
			case 'manager/editSubscription':
301
			case 'manager/editSubscription':
299
			case 'manager/createSubscription':
302
			case 'manager/createSubscription':
300
			case 'manager/updateSubscription':
303
			case 'manager/updateSubscription':
301
				$fields[] = 'notes';
304
				$fields[0][] = 'notes';
302
				break;
305
				break;
303
			case 'manager/subscriptionPolicies':
306
			case 'manager/subscriptionPolicies':
304
			case 'manager/saveSubscriptionPolicies':
307
			case 'manager/saveSubscriptionPolicies':
305
			case 'subscriptionManager/subscriptionPolicies':
308
			case 'subscriptionManager/subscriptionPolicies':
306
			case 'subscriptionManager/saveSubscriptionPolicies':
309
			case 'subscriptionManager/saveSubscriptionPolicies':
307
				$fields[] = 'subscriptionMailingAddress';
310
				$fields[0][] = 'subscriptionMailingAddress';
308
				$fields[] = 'subscriptionAdditionalInformation';
311
				$fields[0][] = 'subscriptionAdditionalInformation';
309
				$fields[] = 'delayedOpenAccessPolicy';
312
				$fields[0][] = 'delayedOpenAccessPolicy';
310
				$fields[] = 'authorSelfArchivePolicy';
313
				$fields[0][] = 'authorSelfArchivePolicy';
311
				break;
314
				break;
312
			case 'manager/editSubscriptionType':
315
			case 'manager/editSubscriptionType':
313
			case 'manager/createSubscriptionType':
316
			case 'manager/createSubscriptionType':
314
			case 'manager/updateSubscriptionType':
317
			case 'manager/updateSubscriptionType':
315
				$fields[] = 'description';
318
				$fields[0][] = 'description';
316
				break;
319
				break;
317
			case 'comment/add': $fields[] = 'commentBody'; break;
320
			case 'comment/add': $fields[0][] = 'commentBody'; break;
318
		}
321
		}
319
		HookRegistry::call('TinyMCEPlugin::getEnableFields', array(&$this, &$fields));
322
		HookRegistry::call('TinyMCEPlugin::getEnableFields', array(&$this, &$fields));
320
		return $fields;
323
		return $fields;
 Lines 340-381   class TinyMCEPlugin extends GenericPlugin { Link Here 
340
		if (!empty($enableFields)) {
343
		if (!empty($enableFields)) {
341
			$baseUrl = $templateManager->get_template_vars('baseUrl');
344
			$baseUrl = $templateManager->get_template_vars('baseUrl');
342
			$additionalHeadData = $templateManager->get_template_vars('additionalHeadData');
345
			$additionalHeadData = $templateManager->get_template_vars('additionalHeadData');
343
			$enableFields = join(',', $enableFields);
346
			$enableFields[0] = join(',', $enableFields[0]);
347
			$enableFields[1] = join(',', $enableFields[1]);
344
			$allLocales = Locale::getAllLocales();
348
			$allLocales = Locale::getAllLocales();
345
			$localeList = array();
349
			$localeList = array();
346
			foreach ($allLocales as $key => $locale) {
350
			foreach ($allLocales as $key => $locale) {
347
				$localeList[] = String::substr($key, 0, 2);
351
				$localeList[] = String::substr($key, 0, 2);
348
			}
352
			}
349
353
			$tinymceScript = '<script language="javascript" type="text/javascript" src="'.$baseUrl.'/'.TINYMCE_JS_PATH.'/tiny_mce_gzip.js"></script>
350
			$tinymceScript = '
354
				<script language="javascript" type="text/javascript">
351
			<script language="javascript" type="text/javascript" src="'.$baseUrl.'/'.TINYMCE_JS_PATH.'/tiny_mce_gzip.js"></script>
355
						tinyMCE_GZ.init({
352
			<script language="javascript" type="text/javascript">
356
							relative_urls : "false",
353
				tinyMCE_GZ.init({
357
							plugins : "paste,ibrowser,fullscreen",
354
					relative_urls : "false",
358
							themes : "advanced",
355
					plugins : "paste,ibrowser,fullscreen",
359
							languages : "' . join(',', $localeList) . '",
356
					themes : "advanced",
360
							disk_cache : true
357
					languages : "' . join(',', $localeList) . '",
361
						});
358
					disk_cache : true
362
					</script>';
359
				});
363
			if (!empty($enableFields[0])) {
360
			</script>
364
				$tinymceScript .= '
361
			<script language="javascript" type="text/javascript">
365
				<script language="javascript" type="text/javascript">
362
				tinyMCE.init({
366
					tinyMCE.init({
363
					entity_encoding : "raw",
367
						entity_encoding : "raw",
364
					plugins : "paste,ibrowser,fullscreen",
368
						plugins : "paste,ibrowser,fullscreen",
365
					mode : "exact",
369
						mode : "exact",
366
					language : "' . String::substr(Locale::getLocale(), 0, 2) . '",
370
						language : "' . String::substr(Locale::getLocale(), 0, 2) . '",
367
					elements : "' . $enableFields . '",
371
						elements : "' . $enableFields[0] . '",
368
					relative_urls : false,
372
						relative_urls : false,
369
					forced_root_block : false,
373
						forced_root_block : false,
370
					paste_auto_cleanup_on_paste : true,
374
						paste_auto_cleanup_on_paste : true,
371
					apply_source_formatting : false,
375
						apply_source_formatting : false,
372
					theme : "advanced",
376
						theme : "advanced",
373
					theme_advanced_buttons1 : "cut,copy,paste,|,bold,italic,underline,bullist,numlist,|,link,unlink,help,code,fullscreen,ibrowser",
377
						theme_advanced_buttons1 : "cut,copy,paste,|,bold,italic,underline,bullist,numlist,|,link,unlink,help,code,fullscreen,ibrowser",
374
					theme_advanced_buttons2 : "",
378
						theme_advanced_buttons2 : "",
375
					theme_advanced_buttons3 : ""
379
						theme_advanced_buttons3 : ""
376
				});
380
					});
377
			</script>';
381
				</script>';
378
382
			}
383
			if (!empty($enableFields[1])) {
384
				$tinymceScript .= '
385
				<script language="javascript" type="text/javascript">
386
					tinyMCE.init({
387
						
388
						entity_encoding : "raw",
389
						plugins : "paste,ibrowser,fullscreen",
390
						mode : "exact",
391
						language : "' . String::substr(Locale::getLocale(), 0, 2) . '",
392
						elements : "' . $enableFields[1] . '",
393
						relative_urls : false,
394
						forced_root_block : false,
395
						paste_auto_cleanup_on_paste : true,
396
						apply_source_formatting : false,
397
						theme : "advanced",
398
						theme_advanced_buttons1 : "cut,copy,paste,bold,italic,underline",
399
						theme_advanced_buttons2 : "",
400
						theme_advanced_buttons3 : ""
401
					});
402
				</script>';
403
			}	
379
			$templateManager->assign('additionalHeadData', $additionalHeadData."\n".$tinymceScript);
404
			$templateManager->assign('additionalHeadData', $additionalHeadData."\n".$tinymceScript);
380
		}
405
		}
381
		return false;
406
		return false;

Return to bug 6759