forked from GATEOverflow/q2a-book
-
Notifications
You must be signed in to change notification settings - Fork 0
/
qa-book-admin.php
executable file
·539 lines (490 loc) · 21.7 KB
/
qa-book-admin.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
<?php
class qa_book_admin {
function option_default($option) {
switch($option) {
case 'book_plugin_sort_q':
return 0;
case 'book_plugin_inc':
return 0;
case 'book_plugin_req_qv_no':
return 2;
case 'book_plugin_req_av_no':
return 2;
case 'book_plugin_enable_custom_filter_1':
return 0;
case 'book_plugin_enable_custom_filter_2':
return 0;
case 'book_plugin_enable_custom_filter_3':
return 0;
case 'book_plugin_enable_custom_filter_4':
return 0;
case 'book_plugin_enable_custom_filter_5':
return 0;
case 'book_plugin_custom_filter_1':
return "where qs.tags like 'gate%'";
case 'book_plugin_custom_filter_2':
return "where qs.tags like 'gate%'";
case 'book_plugin_custom_filter_3':
return "where qs.tags like 'gate%'";
case 'book_plugin_custom_filter_4':
return "where qs.tags like 'gate%'";
case 'book_plugin_custom_filter_5':
return "where qs.tags like 'gate%'";
case 'book_plugin_custom_filter_6':
return "where qs.tags like 'gate%'";
case 'book_plugin_custom_filter_7':
return "where qs.tags like 'gate%'";
case 'book_plugin_custom_filter_8':
return "where qs.tags like 'gate%'";
case 'book_plugin_custom_filter_9':
return "where qs.tags like 'gate%'";
case 'book_plugin_custom_filter_10':
return "where qs.tags like 'gate%'";
case 'book_plugin_custom_filter_1_desc':
return "The questions included are restricted to these conditions";
case 'book_plugin_custom_filter_2_desc':
return "The questions included are restricted to these conditions";
case 'book_plugin_custom_filter_3_desc':
return "The questions included are restricted to these conditions";
case 'book_plugin_custom_filter_4_desc':
return "The questions included are restricted to these conditions";
case 'book_plugin_custom_filter_5_desc':
return "The questions included are restricted to these conditions";
case 'book_plugin_custom_filter_6_desc':
return "The questions included are restricted to these conditions";
case 'book_plugin_custom_filter_7_desc':
return "The questions included are restricted to these conditions";
case 'book_plugin_custom_filter_8_desc':
return "The questions included are restricted to these conditions";
case 'book_plugin_custom_filter_9_desc':
return "The questions included are restricted to these conditions";
case 'book_plugin_custom_filter_10_desc':
return "The questions included are restricted to these conditions";
case 'book_plugin_refresh_last':
return time();
case 'book_plugin_refresh_hours':
return 24;
case 'book_plugin_loc':
return dirname(__FILE__).'/book.html';
case 'book_plugin_loc_pdf':
return dirname(__FILE__).'/book.pdf';
case 'book_plugin_request':
return 'book';
case 'book_plugin_request_pdf':
return 'book.pdf';
case 'book_plugin_show_a':
return '1';
case 'book_plugin_intro':
return 'This book was created programatically by [site-title] on [date].';
case 'book_plugin_ack':
return 'Thanks to all the contributors of [site-title].';
case 'book_plugin_css':
return file_get_contents(dirname(__FILE__).'/book.css');
case 'book_plugin_black_css':
return file_get_contents(dirname(__FILE__).'/book.css');
case 'book_plugin_template':
return file_get_contents(dirname(__FILE__).'/template.html');
case 'book_plugin_template_front':
return file_get_contents(dirname(__FILE__).'/front.html');
case 'book_plugin_template_toc':
return file_get_contents(dirname(__FILE__).'/toc.html');
case 'book_plugin_template_back':
return file_get_contents(dirname(__FILE__).'/back.html');
case 'book_plugin_template_category':
return file_get_contents(dirname(__FILE__).'/category.html');
case 'book_plugin_template_questions':
return file_get_contents(dirname(__FILE__).'/questions.html');
case 'book_plugin_template_question':
return file_get_contents(dirname(__FILE__).'/question.html');
case 'book_plugin_template_answer':
return file_get_contents(dirname(__FILE__).'/answer.html');
default:
return null;
}
}
function allow_template($template)
{
return ($template!='admin');
}
function getcategoryoptions($selected)
{
$cats = array();
$option='<option value="0">Select</option>';
$navcats = qa_book_getallcats($cats, true);
foreach($cats as $cat)
{
$option .= '<option '.(in_array($cat['categoryid'], $selected)? 'selected': '').' value="'.$cat['categoryid'].'">'.$cat['title'].'</option>';
}
return $option;
}
function admin_form(&$qa_content)
{
// Process form input
$ok = null;
if (qa_clicked('book_plugin_process') || qa_clicked('book_plugin_save')) {
qa_opt('book_plugin_active',(bool)qa_post_text('book_plugin_active'));
qa_book_set('book_plugin_shuffle',(bool)qa_post_text('book_plugin_shuffle'));
qa_book_set('book_plugin_cats',(bool)qa_post_text('book_plugin_cats'));
qa_book_set('book_plugin_catex', implode(",", $_POST['book_plugin_catex']));
for($i=1; $i <= 10; $i++) {
qa_book_set('book_plugin_enable_custom_filter'.$i,(bool)qa_post_text('book_plugin_enable_custom_filter'.$i), true);
qa_book_set('book_plugin_custom_filter'.$i,qa_post_text('book_plugin_custom_filter'.$i), true);
qa_book_set('book_plugin_custom_filter'.$i.'_desc',qa_post_text('book_plugin_custom_filter'.$i.'_desc'), true);
}
qa_book_set('book_plugin_sort_q',(int)qa_post_text('book_plugin_sort_q'));
qa_book_set('book_plugin_show_a',(bool)qa_post_text('book_plugin_show_a'));
qa_book_set('book_plugin_push_a',(bool)qa_post_text('book_plugin_push_a'));
qa_book_set('book_plugin_req_sel',(bool)qa_post_text('book_plugin_req_sel'));
qa_book_set('book_plugin_req_ans',(bool)qa_post_text('book_plugin_req_ans'));
qa_book_set('book_plugin_req_abest',(bool)qa_post_text('book_plugin_req_abest'));
qa_book_set('book_plugin_req_abest_max',(int)qa_post_text('book_plugin_req_abest_max'));
qa_book_set('book_plugin_req_qv',(bool)qa_post_text('book_plugin_req_qv'));
qa_book_set('book_plugin_req_av',(bool)qa_post_text('book_plugin_req_av'));
qa_book_set('book_plugin_req_qv_no',(int)qa_post_text('book_plugin_req_qv_no'));
qa_book_set('book_plugin_req_av_no',(int)qa_post_text('book_plugin_req_av_no'));
qa_book_set('book_plugin_static',(bool)qa_post_text('book_plugin_static'));
qa_book_set('book_plugin_pdf',(bool)qa_post_text('book_plugin_pdf'));
qa_book_set('book_plugin_loc',qa_post_text('book_plugin_loc'));
qa_book_set('book_plugin_loc_pdf',qa_post_text('book_plugin_loc_pdf'));
qa_book_set('book_plugin_refresh',(bool)qa_post_text('book_plugin_refresh'));
qa_book_set('book_plugin_refresh_time',(bool)qa_post_text('book_plugin_refresh_time'));
qa_book_set('book_plugin_refresh_cron',(bool)qa_post_text('book_plugin_refresh_cron'));
qa_book_set('book_plugin_refresh_hours',(int)qa_post_text('book_plugin_refresh_hours'));
qa_book_set('book_plugin_request',qa_post_text('book_plugin_request'));
qa_book_set('book_plugin_request_pdf',qa_post_text('book_plugin_request_pdf'));
qa_book_set('book_plugin_prefix',(bool)qa_post_text('book_plugin_prefix'));
qa_book_set('book_plugin_specialtags',qa_post_text('book_plugin_specialtags'));
qa_book_set('book_plugin_css',qa_post_text('book_plugin_css'));
qa_book_set('book_plugin_black_css',qa_post_text('book_plugin_black_css'));
qa_book_set('book_plugin_ack',qa_post_text('book_plugin_ack'));
qa_book_set('book_plugin_intro',qa_post_text('book_plugin_intro'));
qa_book_set('book_plugin_template',qa_post_text('book_plugin_template'));
qa_book_set('book_plugin_template_front',qa_post_text('book_plugin_template_front'));
qa_book_set('book_plugin_template_back',qa_post_text('book_plugin_template_back'));
qa_book_set('book_plugin_template_toc',qa_post_text('book_plugin_template_toc'));
qa_book_set('book_plugin_template_category',qa_post_text('book_plugin_template_category'));
qa_book_set('book_plugin_template_questions',qa_post_text('book_plugin_template_questions'));
qa_book_set('book_plugin_template_question',qa_post_text('book_plugin_template_question'));
qa_book_set('book_plugin_template_answer',qa_post_text('book_plugin_template_answer'));
if(qa_clicked('book_plugin_process') && qa_opt('book_plugin_static'))
$ok = qa_book_plugin_createBook();
else
$ok = qa_lang('admin/options_saved');
}
else if (qa_clicked('book_plugin_reset')) {
foreach($_POST as $i => $v) {
$def = $this->option_default($i);
if($def !== null) qa_book_set($i,$def);
}
$ok = qa_lang('admin/options_reset');
}
// Create the form for display
$fields = array();
$fields[] = array(
'label' => 'Activate Plugin',
'tags' => 'NAME="book_plugin_active"',
'value' => qa_opt('book_plugin_active'),
'type' => 'checkbox',
);
$fields[] = array(
'label' => 'Shuffle Questions',
'tags' => 'NAME="book_plugin_shuffle"',
'value' => qa_book_get('book_plugin_shuffle'),
'type' => 'checkbox',
);
$fields[] = array(
'type' => 'blank',
);
for($i = 1; $i <= 10; $i++) {
$fields[] = array(
'label' => 'Enable Custom Filter '.$i,
'tags' => 'NAME="book_plugin_enable_custom_filter'.$i.'" onchange="if(this.checked) $(\'#book_plugin_custom_filter'.$i.'_div\').show(); else $(\'#book_plugin_custom_filter'.$i.'_div\').hide();"',
'value' => qa_book_get('book_plugin_enable_custom_filter'.$i, true),
'type' => 'checkbox',
);
$fields[] = array(
'value' => '<div style="display:'.(qa_book_get('book_plugin_enable_custom_filter'.$i,true)?'block':'none').'" id="book_plugin_custom_filter'.$i.'_div"><i>Custom query filter'.$i.' string</i><br/><input name="book_plugin_custom_filter'.$i.'" id="book_plugin_custom_filter'.$i.'" value="'.qa_book_get('book_plugin_custom_filter'.$i, true).'">
<br/><i>Text to be added in Book</i><br/><textarea name="book_plugin_custom_filter'.$i.'_desc" rows="10" id="book_plugin_custom_filter'.$i.'_desc">'.qa_book_get('book_plugin_custom_filter'.$i.'_desc', true).'</textarea>
</div>',
'type' => 'static',
);
}
$fields[] = array(
'label' => 'Sort By Categories',
'tags' => 'onchange="if(this.checked) $(\'#book_plugin_cat_div\').show(); else $(\'#book_plugin_cat_div\').hide();" NAME="book_plugin_cats"',
'value' => qa_book_get('book_plugin_cats'),
'type' => 'checkbox',
);
$exccat = $this->getcategoryoptions(explode(",",qa_book_get('book_plugin_catex')));
$fields[] = array(
'value' => '<span style="display:'.(qa_book_get('book_plugin_cats')?'block':'none').'" id="book_plugin_cat_div"><i>Categories to exclude (multi-select with CTRL/CMD):</i><br/><select multiple name="book_plugin_catex[]" id="book_plugin_catex>" '.$exccat.'"</select></span>',
'type' => 'static',
'note' => 'Selecting a parent category excludes all child categories',
);
$sort = array(
'votes',
'date',
);
$fields[] = array(
'id' => 'book_plugin_sort_q',
'label' => 'Sort questions by',
'tags' => 'NAME="book_plugin_sort_q" ID="book_plugin_sort_q"',
'type' => 'select',
'options' => $sort,
'value' => @$sort[qa_book_get('book_plugin_sort_q')],
);
$fields[] = array(
'label' => 'Include Answers',
'tags' => 'NAME="book_plugin_show_a"',
'value' => qa_book_get('book_plugin_show_a'),
'type' => 'checkbox',
);
$fields[] = array(
'label' => 'Push Answers',
'note' => 'Moves answers from below question to the end of the Topic/Category',
'tags' => 'NAME="book_plugin_push_a"',
'value' => qa_book_get('book_plugin_push_a'),
'type' => 'checkbox',
);
$fields[] = array(
'type' => 'blank',
);
$fields[] = array(
'value' => '<b>Restrict inclusion to:</b>',
'type' => 'static',
);
$fields[] = array(
'label' => 'Selected answers',
'tags' => 'NAME="book_plugin_req_sel"',
'value' => qa_book_get('book_plugin_req_sel'),
'type' => 'checkbox',
);
$fields[] = array(
'label' => 'Answered Questions',
'tags' => 'NAME="book_plugin_req_ans"',
'value' => qa_book_get('book_plugin_req_ans'),
'type' => 'checkbox',
);
$fields[] = array(
'label' => 'Highest voted answers',
'tags' => 'onclick="if(this.checked) $(\'#book_plugin_req_abest_max_div\').show(); else $(\'#book_plugin_req_abest_max_div\').hide();" NAME="book_plugin_req_abest"',
'value' => qa_book_get('book_plugin_req_abest'),
'type' => 'checkbox',
);
$fields[] = array(
'value' => '<span id="book_plugin_req_abest_max_div" style="display:'.(qa_book_get('book_plugin_req_abest')?'block':'none').'">max number of answers to include: <input name="book_plugin_req_abest_max" size="3" value="'.(qa_book_get('book_plugin_req_abest_max')?qa_book_get('book_plugin_req_abest_max'):'').'"></span>',
'type' => 'static',
);
$fields[] = array(
'label' => 'Questions with minimum votes',
'tags' => 'onclick="if(this.checked) $(\'#book_plugin_req_qv_div\').show(); else $(\'#book_plugin_req_qv_div\').hide();" NAME="book_plugin_req_qv"',
'value' => qa_book_get('book_plugin_req_qv'),
'type' => 'checkbox',
);
$fields[] = array(
'value' => '<span id="book_plugin_req_qv_div" style="display:'.(qa_book_get('book_plugin_req_qv')?'block':'none').'">min. votes for inclusion: <input name="book_plugin_req_qv_no" size="3" value="'.qa_book_get('book_plugin_req_qv_no').'"></span>',
'type' => 'static',
);
$fields[] = array(
'label' => 'Answers with minimum votes',
'tags' => 'onclick="if(this.checked) $(\'#book_plugin_req_av_div\').show(); else $(\'#book_plugin_req_av_div\').hide();" NAME="book_plugin_req_av"',
'value' => qa_book_get('book_plugin_req_av'),
'type' => 'checkbox',
);
$fields[] = array(
'value' => '<span id="book_plugin_req_av_div" style="display:'.(qa_book_get('book_plugin_req_av')?'block':'none').'">min. votes for inclusion: <input name="book_plugin_req_av_no" size="3" value="'.qa_book_get('book_plugin_req_av_no').'"></span>',
'type' => 'static',
);
$fields[] = array(
'type' => 'blank',
);
$fields[] = array(
'label' => 'Create Static Book',
'note' => '<i>if this is unchecked, accessing the book page will recreate the book on every view</i>',
'tags' => 'onclick="if(this.checked) $(\'#book_plugin_loc\').show(); else $(\'#book_plugin_loc\').hide();" NAME="book_plugin_static"',
'value' => qa_book_get('book_plugin_static'),
'type' => 'checkbox',
);
$fields[] = array(
'value' => '<span id="book_plugin_loc" style="display:'.(qa_book_get('book_plugin_static')?'block':'none').'">Location (must be writable): <input name="book_plugin_loc" value="'.qa_book_get('book_plugin_loc').'"></span>',
'type' => 'static',
);
$fields[] = array(
'type' => 'blank',
);
$fields[] = array(
'label' => 'Create Static PDF',
'note' => '<i>requires wkhtmltopdf - see README.rst</i>',
'tags' => 'onclick="if(this.checked) $(\'#book_plugin_loc_pdf\').show(); else $(\'#book_plugin_loc_pdf\').hide();" NAME="book_plugin_pdf"',
'value' => qa_book_get('book_plugin_pdf'),
'type' => 'checkbox',
);
$fields[] = array(
'value' => '<span id="book_plugin_loc_pdf" style="display:'.(qa_book_get('book_plugin_pdf')?'block':'none').'">Location (must be writable): <input name="book_plugin_loc_pdf" value="'.qa_book_get('book_plugin_loc_pdf').'"></span>',
'type' => 'static',
);
$fields[] = array(
'type' => 'blank',
);
$fields[] = array(
'label' => 'Recreate Static Book',
'tags' => 'onclick="if(this.checked) $(\'#book_plugin_refresh_hours\').show(); else $(\'#book_plugin_refresh_hours\').hide();" NAME="book_plugin_refresh"',
'value' => qa_book_get('book_plugin_refresh'),
'type' => 'checkbox',
);
$cron_url = qa_opt('site_url').qa_book_get('book_plugin_request').'?cron=true';
$fields[] = array(
'value' => '<div id="book_plugin_refresh_hours" style="display:'.(qa_book_get('book_plugin_refresh')?'block':'none').'">minimum time to recreate: <input name="book_plugin_refresh_hours" value="'.qa_book_get('book_plugin_refresh_hours').'" size="3"> hours<br/><i>if this is set to zero, the auto-recreate will not run, and the cron url may be called at any time.<br/><br/><input type="checkbox" name="book_plugin_refresh_time" '.(qa_book_get('book_plugin_refresh_time')?'checked':'').'> recreate on next access after above interval<br/><br/><input type="checkbox" name="book_plugin_refresh_cron" '.(qa_book_get('book_plugin_refresh_cron')?'checked':'').'>recreate via cron url below<br/><span style="font-style:italic;">url is currently <a href="'.$cron_url.'">'.$cron_url.'</a></span></div>',
'type' => 'static',
);
$fields[] = array(
'type' => 'blank',
);
$fields[] = array(
'label' => 'Book Permalink',
'note' => '<i>the url used to access the book, either via static file, or on the fly</i>',
'tags' => 'NAME="book_plugin_request"',
'value' => qa_book_get('book_plugin_request'),
);
$fields[] = array(
'label' => 'Prefix Tag to Question Title',
'tags' => 'onclick="if(this.checked) $(\'#book_plugin_specialtags_div\').show(); else $(\'#book_plugin_specialtags_div\').hide();" NAME="book_plugin_prefix"',
'note' => 'Prefixes the most lightly used tag in tagstring to the Question title',
'value' => qa_book_get('book_plugin_prefix'),
'type' => 'checkbox',
);
$fields[] = array(
'tags' => 'NAME="book_plugin_specialtags"',
'value' => '<div id="book_plugin_specialtags_div" style="display:'.(qa_book_get('book_plugin_prefix')?'block':'none').'">
<p><i>Special Tags (comma separated)</i></p>
<textarea rows="10" name="book_plugin_specialtags">'. qa_book_get('book_plugin_specialtags').'</textarea>
<p><i>These tagnames won\'t be considered for Adding to Question Title Prefix</i></p>
</div>',
'type' => 'static',
);
$fields[] = array(
'label' => 'Book PDF Permalink',
'note' => '<i>the url used to access the PDF file; should correspond with static PDF location above</i>',
'tags' => 'NAME="book_plugin_request_pdf"',
'value' => qa_book_get('book_plugin_request_pdf'),
);
$fields[] = array(
'type' => 'blank',
);
$fields[] = array(
'label' => 'Book CSS',
'note' => '<i>book.css</i>',
'tags' => 'NAME="book_plugin_css"',
'value' => qa_book_get('book_plugin_css'),
'type' => 'textarea',
'rows' => '10',
);
$fields[] = array(
'label' => 'Book monochrome CSS',
'note' => '<i>book.css</i>',
'tags' => 'NAME="book_plugin_black_css"',
'value' => qa_book_get('book_plugin_black_css'),
'type' => 'textarea',
'rows' => '10',
);
$fields[] = array(
'type' => 'blank',
);
$fields[] = array(
'label' => 'Book Template',
'note' => '<i>template.html</i>',
'tags' => 'NAME="book_plugin_template"',
'value' => qa_book_get('book_plugin_template'),
'type' => 'textarea',
'rows' => '10',
);
$fields[] = array(
'label' => 'Front Cover Template',
'note' => '<i>front.html</i>',
'tags' => 'NAME="book_plugin_template_front"',
'value' => qa_book_get('book_plugin_template_front'),
'type' => 'textarea',
'rows' => '10',
);
$fields[] = array(
'label' => 'Back Cover Template',
'note' => '<i>back.html</i>',
'tags' => 'NAME="book_plugin_template_back"',
'value' => qa_book_get('book_plugin_template_back'),
'type' => 'textarea',
'rows' => '10',
);
$fields[] = array(
'label' => 'Introduction',
'tags' => 'NAME="book_plugin_intro"',
'value' => qa_book_get('book_plugin_intro'),
'type' => 'textarea',
'rows' => '10',
);
$fields[] = array(
'label' => 'Acknowledgement',
'tags' => 'NAME="book_plugin_ack"',
'value' => qa_book_get('book_plugin_ack'),
'type' => 'textarea',
'rows' => '20',
);
$fields[] = array(
'label' => 'Table of Contents Template',
'note' => '<i>toc.html</i>',
'tags' => 'NAME="book_plugin_template_toc"',
'value' => qa_book_get('book_plugin_template_toc'),
'type' => 'textarea',
'rows' => '10',
);
$fields[] = array(
'label' => 'Category Template',
'note' => '<i>category.html - used when sorting by categories</i>',
'tags' => 'NAME="book_plugin_template_category"',
'value' => qa_book_get('book_plugin_template_category'),
'type' => 'textarea',
'rows' => '10',
);
$fields[] = array(
'label' => 'Questions Template',
'note' => '<i>questions.html - used when not sorting by categories</i>',
'tags' => 'NAME="book_plugin_template_questions"',
'value' => qa_book_get('book_plugin_template_questions'),
'type' => 'textarea',
'rows' => '10',
);
$fields[] = array(
'label' => 'Question Template',
'note' => '<i>question.html</i>',
'tags' => 'NAME="book_plugin_template_question"',
'value' => qa_book_get('book_plugin_template_question'),
'type' => 'textarea',
'rows' => '10',
);
$fields[] = array(
'label' => 'Answer Template',
'note' => '<i>answer.html</i>',
'tags' => 'NAME="book_plugin_template_answer"',
'value' => qa_book_get('book_plugin_template_answer'),
'type' => 'textarea',
'rows' => '10',
);
return array(
'ok' => ($ok && !isset($error)) ? $ok : null,
'fields' => $fields,
'buttons' => array(
array(
'label' => qa_lang_html('admin/save_options_button'),
'tags' => 'NAME="book_plugin_save"',
),
array(
'label' => 'Process',
'tags' => 'NAME="book_plugin_process"',
),
array(
'label' => qa_lang_html('admin/reset_options_button'),
'tags' => 'NAME="book_plugin_reset"',
),
),
);
}
}