weekly release
[moodle.git] / filter / tex / filtersettings.php
CommitLineData
4317f92f 1<?php
220a90c5 2
dbf9e4ba
PS
3defined('MOODLE_INTERNAL') || die;
4
5if ($ADMIN->fulltree) {
6
7 require_once($CFG->dirroot.'/filter/tex/lib.php');
8
9 $items = array();
10 $items[] = new admin_setting_heading('filter_tex_latexheading', get_string('latexsettings', 'admin'), '');
11 $items[] = new admin_setting_configtextarea('filter_tex_latexpreamble', get_string('latexpreamble','admin'),
12 '', "\\usepackage[latin1]{inputenc}\n\\usepackage{amsmath}\n\\usepackage{amsfonts}\n\\RequirePackage{amsmath,amssymb,latexsym}\n");
13 $items[] = new admin_setting_configtext('filter_tex_latexbackground', get_string('backgroundcolour', 'admin'), '', '#FFFFFF');
14 $items[] = new admin_setting_configtext('filter_tex_density', get_string('density', 'admin'), '', '120', PARAM_INT);
15
16 if (PHP_OS=='Linux') {
17 $default_filter_tex_pathlatex = "/usr/bin/latex";
18 $default_filter_tex_pathdvips = "/usr/bin/dvips";
19 $default_filter_tex_pathconvert = "/usr/bin/convert";
20
21 } else if (PHP_OS=='Darwin') {
22 // most likely needs a fink install (fink.sf.net)
23 $default_filter_tex_pathlatex = "/sw/bin/latex";
24 $default_filter_tex_pathdvips = "/sw/bin/dvips";
25 $default_filter_tex_pathconvert = "/sw/bin/convert";
26
27 } else if (PHP_OS=='WINNT' or PHP_OS=='WIN32' or PHP_OS=='Windows') {
28 // note: you need Ghostscript installed (standard), miktex (standard)
29 // and ImageMagick (install at c:\ImageMagick)
30 $default_filter_tex_pathlatex = "\"c:\\texmf\\miktex\\bin\\latex.exe\" ";
31 $default_filter_tex_pathdvips = "\"c:\\texmf\\miktex\\bin\\dvips.exe\" ";
32 $default_filter_tex_pathconvert = "\"c:\\imagemagick\\convert.exe\" ";
33
34 } else {
35 $default_filter_tex_pathlatex = '';
36 $default_filter_tex_pathdvips = '';
37 $default_filter_tex_pathconvert = '';
38 }
39
40 $items[] = new admin_setting_configexecutable('filter_tex_pathlatex', get_string('pathlatex', 'admin'), '', $default_filter_tex_pathlatex);
41 $items[] = new admin_setting_configexecutable('filter_tex_pathdvips', get_string('pathdvips', 'admin'), '', $default_filter_tex_pathdvips);
42 $items[] = new admin_setting_configexecutable('filter_tex_pathconvert', get_string('pathconvert', 'admin'), '', $default_filter_tex_pathconvert);
43
44 // Even if we offer GIF and PNG formats here, in the update callback we check whether
45 // all the paths actually point to executables. If they don't, we force the setting
46 // to GIF, as that's the only format mimeTeX can produce.
47 $formats = array('gif' => 'GIF', 'png' => 'PNG');
48 $items[] = new admin_setting_configselect('filter_tex_convertformat', get_string('convertformat', 'admin'), get_string('configconvertformat', 'admin'), 'gif', $formats);
49
50 foreach ($items as $item) {
51 $item->set_updatedcallback('filter_tex_updatedcallback');
52 $settings->add($item);
53 }
54}