2 rcs_id('$Id: VisualWiki.php,v 1.13 2004-09-06 12:13:00 rurban Exp $');
4 Copyright (C) 2002 Johannes Große (Johannes Große)
6 This file is (not yet) part of PhpWiki.
8 PhpWiki is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 PhpWiki is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with PhpWiki; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 * Produces graphical site map of PhpWiki
25 * Example for an image map creating plugin. It produces a graphical
26 * sitemap of PhpWiki by calling the <code>dot</code> commandline tool
27 * from graphviz (http://www.graphviz.org).
28 * @author Johannes Große
31 define('VISUALWIKI_ALLOWOPTIONS', true);
33 if (PHP_OS == "Darwin") { // Mac OS X
34 $dotbin = '/sw/bin/dot'; // graphviz via Fink
35 //$dotbin = '/usr/local/bin/dot';
37 // Name of the Truetypefont - at least LucidaSansRegular.ttf is always present on OS X
38 define('VISUALWIKIFONT', 'LucidaSansRegular');
40 // The default font paths do not find your fonts, set the path here:
41 $fontpath = "/System/Library/Frameworks/JavaVM.framework/Versions/1.3.1/Home/lib/fonts/";
42 //$fontpath = "/usr/X11R6/lib/X11/fonts/TTF/";
44 elseif (isWindows()) {
46 define('VISUALWIKIFONT', 'Arial');
48 $dotbin = '/usr/local/bin/dot';
49 if ($_SERVER["SERVER_NAME"] == 'phpwiki.sourceforge.net')
50 $dotbin = '/home/groups/p/ph/phpwiki/bin/dot';
52 // Name of the Truetypefont - Helvetica is probably easier to read
53 //define('VISUALWIKIFONT', 'Helvetica');
54 //define('VISUALWIKIFONT', 'Times');
55 //define('VISUALWIKIFONT', 'Arial');
56 define('VISUALWIKIFONT', 'luximr'); // sf.net, sf.net can only do gif
58 // The default font paths do not find your fonts, set the path here:
59 //$fontpath = "/usr/X11R6/lib/X11/fonts/TTF/";
60 //$fontpath = "/usr/share/fonts/default/TrueType/";
63 if (!defined('VISUALWIKI_ALLOWOPTIONS'))
64 define('VISUALWIKI_ALLOWOPTIONS', false);
66 require_once "lib/WikiPluginCached.php";
68 class WikiPlugin_VisualWiki
69 extends WikiPluginCached
72 * Sets plugin type to map production
74 function getPluginType() {
75 return PLUGIN_CACHED_MAP;
79 * Sets the plugin's name to VisualWiki. It can be called by
80 * <code><?plugin VisualWiki?></code>, now. This
81 * name must correspond to the filename and the class name.
87 function getVersion() {
88 return preg_replace("/[Revision: $]/", '',
89 "\$Revision: 1.13 $");
93 * Sets textual description.
95 function getDescription() {
96 return _("Visualizes the Wiki structure in a graph using the 'dot' commandline tool from graphviz.");
100 * Returns default arguments. This is put into a separate
101 * function to allow its usage by both <code>getDefaultArguments</code>
102 * and <code>checkArguments</code>
104 function defaultarguments() {
105 return array('imgtype' => 'png',
106 'width' => false, // was 5, scale it automatically
107 'height' => false, // was 7, scale it automatically
108 'colorby' => 'age', // sort by 'age' or 'revtime'
109 'fillnodes' => 'off',
111 'shape' => 'ellipse',
116 'neighbour_list' => '',
117 'exclude_list' => '',
118 'include_list' => '',
125 * Sets the default arguments. WikiPlugin also regards these as
126 * the allowed arguments. Since WikiPluginCached stores an image
127 * for each different set of parameters, there can be a lot of
128 * these (large) graphs if you allow different parameters.
129 * Set <code>VISUALWIKI_ALLOWOPTIONS</code> to <code>false</code>
130 * to allow no options to be set and use only the default paramters.
131 * This will need an disk space of about 20 Kbyte all the time.
133 function getDefaultArguments() {
134 if (VISUALWIKI_ALLOWOPTIONS)
135 return $this->defaultarguments();
141 * Substitutes each forbidden parameter value by the default value
142 * defined in <code>defaultarguments</code>.
144 function checkArguments(&$arg) {
146 $def = $this->defaultarguments();
148 if (($width < 3) || ($width > 15))
149 $arg['width'] = $def['width'];
151 if (($height < 3) || ($height > 20))
152 $arg['height'] = $def['height'];
154 if (($fontsize < 8) || ($fontsize > 24))
155 $arg['fontsize'] = $def['fontsize'];
157 if (!in_array($label, array('name', 'number')))
158 $arg['label'] = $def['label'];
160 if (!in_array($shape, array('ellipse', 'box', 'point', 'circle',
162 $arg['shape'] = $def['shape'];
164 if (!in_array($colorby, array('age', 'revtime')))
165 $arg['colorby'] = $def['colorby'];
167 if (!in_array($fillnodes, array('on', 'off')))
168 $arg['fillnodes'] = $def['fillnodes'];
170 if (($large_nb < 0) || ($large_nb > 50))
171 $arg['large_nb'] = $def['large_nb'];
173 if (($recent_nb < 0) || ($recent_nb > 50))
174 $arg['recent_nb'] = $def['recent_nb'];
176 if (($refined_nb < 0 ) || ( $refined_nb > 50))
177 $arg['refined_nb'] = $def['refined_nb'];
179 if (($backlink_nb < 0) || ($backlink_nb > 50))
180 $arg['backlink_nb'] = $def['backlink_nb'];
182 // ToDo: check if "ImageCreateFrom$imgtype"() exists.
183 if (!in_array($imgtype, $GLOBALS['PLUGIN_CACHED_IMGTYPES']))
184 $arg['imgtype'] = $def['imgtype'];
185 if (empty($fontname))
186 $arg['fontname'] = VISUALWIKIFONT;
190 * Checks options, creates help page if necessary, calls both
191 * database access and image map production functions.
192 * @return array($map,$html)
194 function getMap($dbi, $argarray, $request) {
195 if (!VISUALWIKI_ALLOWOPTIONS)
196 $argarray = $this->defaultarguments();
197 $this->checkArguments($argarray);
198 //extract($argarray);
199 if ($argarray['help'])
200 return array($this->helpImage(), ' '); // FIXME
201 $this->createColors();
202 $this->extract_wikipages($dbi, $argarray);
203 /* ($dbi, $large, $recent, $refined, $backlink,
204 $neighbour, $excludelist, $includelist, $color); */
205 return $this->invokeDot($argarray);
206 /* ($width, $height, $color, $shape, $text); */
210 * Sets the expire time to one day (so the image producing
211 * functions are called seldomly) or to about two minutes
212 * if a help screen is created.
214 function getExpire($dbi, $argarray, $request) {
215 if ($argarray['help'])
216 return '+120'; // 2 minutes
217 return sprintf('+%d', 3*86000); // approx 3 days
221 * Sets the imagetype according to user wishes and
222 * relies on WikiPluginCached to catch illegal image
224 * (I feel unsure whether this option is reasonable in
225 * this case, because png will definitely have the
228 * @return string 'png', 'gif', 'jpeg'
230 function getImageType($dbi, $argarray, $request) {
231 return $argarray['imgtype'];
235 * This gives an alternative text description of
236 * the image map. I do not know whether it interferes
237 * with the <code>title</code> attributes in <area>
238 * tags of the image map. Perhaps this will be removed.
241 function getAlt($dbi, $argstr, $request) {
242 return $this->getDescription();
245 // ------------------------------------------------------------------------------------------
248 * Returns an image containing a usage description of the plugin.
249 * @return string image handle
251 function helpImage() {
252 $def = $this->defaultarguments();
253 $other_imgtypes = $GLOBALS['PLUGIN_CACHED_IMGTYPES'];
254 unset ($other_imgtypes[$def['imgtype']]);
256 '<?plugin '.$this->getName() .
257 ' img' => ' = "' . $def['imgtype'] . "(default)|" . join('|',$GLOBALS['PLUGIN_CACHED_IMGTYPES']).'"',
258 'width' => ' = "width in inches"',
259 'height' => ' = "height in inches"',
260 'fontname' => ' = "font family"',
261 'fontsize' => ' = "fontsize in points"',
262 'colorby' => ' = "age|revtime|none"',
263 'fillnodes' => ' = "on|off"',
264 'shape' => ' = "ellipse(default)|box|circle|point"',
265 'label' => ' = "name|number"',
266 'large_nb' => ' = "number of largest pages to be selected"',
267 'recent_nb' => ' = "number of youngest pages"',
268 'refined_nb' => ' = "#pages with smallest time between revisions"',
269 'backlink_nb' => ' = "number of pages with most backlinks"',
270 'neighbour_list' => ' = "find pages linked from and to these pages"',
271 'exclude_list' => ' = "colon separated list of pages to be excluded"',
272 'include_list' => ' = "colon separated list" ?>'
275 foreach($helparr as $alignright => $alignleft) {
276 $length = max($length, strlen($alignright));
279 foreach($helparr as $alignright => $alignleft) {
280 $helptext .= substr(' '
281 . $alignright, -$length).$alignleft."\n";
283 return $this->text2img($helptext, 4, array(1, 0, 0),
284 array(255, 255, 255));
289 * Selects the first (smallest or biggest) WikiPages in
292 * @param number integer number of page names to be found
293 * @param category string attribute of the pages which is used
295 * @param minimum boolean true finds smallest, false finds biggest
296 * @return array list of page names found to be the best
298 function findbest($number, $category, $minimum ) {
299 // select the $number best in the category '$category'
300 $pages = &$this->pages;
301 $names = &$this->names;
305 foreach($names as $name) {
308 $selected[$name] = $pages[$name][$category];
310 //echo "<pre>$category "; var_dump($selected); "</pre>";
311 $compareto = $minimum ? 0x79999999 : -0x79999999;
314 foreach ($names as $name) {
318 if (($crit = $pages[$name][$category]) < $compareto) {
319 $selected[$name] = $crit;
320 asort($selected, SORT_NUMERIC);
321 array_pop($selected);
322 $compareto = end($selected);
324 } elseif (($crit = $pages[$name][$category]) > $compareto) {
325 $selected[$name] = $crit;
326 arsort($selected, SORT_NUMERIC);
327 array_pop($selected);
328 $compareto = end($selected);
331 //echo "<pre>$category "; var_dump($selected); "</pre>";
333 return array_keys($selected);
338 * Extracts a subset of all pages from the wiki and find their
339 * connections to other pages. Also collects some page features
340 * like size, age, revision number which are used to find the
341 * most attractive pages.
343 * @param dbi WikiDB database handle to access all Wiki pages
344 * @param LARGE integer number of largest pages which should
346 * @param RECENT integer number of the youngest pages to be included
347 * @param REFINED integer number of the pages with shortes revision
349 * @param BACKLINK integer number of the pages with most backlinks
350 * @param EXCLUDELIST string colon ':' separated list of page names which
351 * should not be displayed (like PhpWiki, for
353 * @param INCLUDELIST string colon separated list of pages which are
354 * allways included (for example your own
356 * @param COLOR string 'age', 'revtime' or 'none'; Selects which
357 * page feature is used to determine the
358 * filling color of the nodes in the graph.
361 function extract_wikipages($dbi, $argarray) {
362 // $LARGE, $RECENT, $REFINED, $BACKLINK, $NEIGHBOUR,
363 // $EXCLUDELIST, $INCLUDELIST,$COLOR
367 // FIXME: gettextify?
368 $exclude_list = explode(':', $exclude_list);
369 $include_list = explode(':', $include_list);
370 $neighbour_list = explode(':', $neighbour_list);
372 // FIXME remove INCLUDED from EXCLUDED
375 $allpages = $dbi->getAllPages();
376 $pages = &$this->pages;
378 while ($page = $allpages->next()) {
379 $name = $page->getName();
381 // skip exluded pages
382 if (in_array($name, $exclude_list)) {
387 // false = get links from actual page
388 // true = get links to actual page ("backlinks")
389 $backlinks = $page->getLinks(true);
391 $bconnection = array();
392 while ($blink = $backlinks->next()) {
393 array_push($bconnection, $blink->getName());
398 // include all neighbours of pages listed in $NEIGHBOUR
399 if (in_array($name,$neighbour_list)) {
400 $l = $page->getLinks(false);
402 while ($link = $l->next()) {
403 array_push($con, $link->getName());
405 $include_list = array_merge($include_list, $bconnection, $con);
412 $currev = $page->getCurrentRevision();
414 $pages[$name] = array(
415 'age' => $now-$currev->get('mtime'),
416 'revnr' => $currev->getVersion(),
418 'backlink_nb' => count($bconnection),
419 'backlinks' => $bconnection,
420 'size' => 1000 // FIXME
422 $pages[$name]['revtime'] = $pages[$name]['age'] / ($pages[$name]['revnr']);
428 $this->names = array_keys($pages);
430 $countpages = count($pages);
432 // now select each page matching to given parameters
433 $all_selected = array_unique(array_merge(
434 $this->findbest($recent_nb, 'age', true),
435 $this->findbest($refined_nb, 'revtime', true),
436 $x = $this->findbest($backlink_nb, 'backlink_nb', false),
437 // $this->findbest($large_nb, 'size', false),
440 foreach($all_selected as $name)
441 if (isset($pages[$name]))
442 $newpages[$name] = $pages[$name];
445 $this->pages = $newpages;
446 $pages = &$this->pages;
447 $this->names = array_keys($pages);
449 unset($all_selected);
451 $countpages = count($pages);
453 // remove dead links and collect links
455 while( list($name,$page) = each($pages) ) {
456 if (is_array($page['backlinks'])) {
457 reset($page['backlinks']);
458 while ( list($index, $link) = each( $page['backlinks'] ) ) {
459 if ( !isset($pages[$link]) || $link == $name ) {
460 unset($pages[$name]['backlinks'][$index]);
462 array_push($pages[$link]['links'],$name);
463 //array_push($this->everylink, array($link,$name));
469 if ($colorby == 'none')
471 list($oldestname) = $this->findbest(1, $colorby, false);
472 $this->oldest = $pages[$oldestname][$colorby];
473 foreach($this->names as $name)
474 $pages[$name]['color'] = $this->getColor($pages[$name][$colorby] / $this->oldest);
475 } // extract_wikipages
478 * Creates the text file description of the graph needed to invoke
481 * @param filename string name of the dot file to be created
482 * @param width float width of the output graph in inches
483 * @param height float height of the graph in inches
484 * @param colorby string color sceme beeing used ('age', 'revtime',
486 * @param shape string node shape; 'ellipse', 'box', 'circle', 'point'
487 * @param label string 'name': label by name,
488 * 'number': label by unique number
489 * @return boolean error status; true=ok; false=error
491 function createDotFile($filename, $argarray) {
493 if (!$fp = fopen($filename, 'w'))
496 $fillstring = ($fillnodes == 'on') ? 'style=filled,' : '';
499 $names = &$this->names;
500 $pages = &$this->pages;
502 $nametonumber = array_flip($names);
504 $dot = "digraph VisualWiki {\n" // }
505 . (!empty($fontpath) ? " fontpath=\"$fontpath\"\n" : "");
506 if ($width and $height)
507 $dot .= " size=\"$width,$height\";\n ";
511 $dot .= "edge [arrowhead=none];\nnode [shape=$shape,fontname=$fontname,width=0.15,height=0.15,fontsize=$fontsize];\n";
514 $dot .= "node [shape=$shape,fontname=$fontname,width=0.4,height=0.4,fontsize=$fontsize];\n";
517 $dot .= "node [shape=$shape,fontname=$fontname,width=0.25,height=0.25,fontsize=$fontsize];\n";
520 $dot .= "node [fontname=$fontname,shape=$shape,fontsize=$fontsize];\n" ;
524 foreach ($names as $name) {
526 $url = rawurlencode($name);
527 // patch to allow Page/SubPage
528 $url = preg_replace('/' . urlencode(SUBPAGE_SEPARATOR) . '/',
529 SUBPAGE_SEPARATOR, $url);
530 $nodename = ($label != 'name' ? $nametonumber[$name] + 1 : $name);
532 $dot .= " \"$nodename\" [URL=\"$url\"";
533 if ($colorby != 'none') {
534 $col = $pages[$name]['color'];
535 $dot .= sprintf(',%scolor="#%02X%02X%02X"', $fillstring,
536 $col[0], $col[1], $col[2]);
540 if (!empty($pages[$name]['links'])) {
542 if ($label != 'name')
543 foreach($pages[$name]['links'] as $linkname)
544 $linkarray[] = $nametonumber[$linkname] + 1;
546 $linkarray = $pages[$name]['links'];
547 $linkstring = join('"; "', $linkarray );
549 $c = count($pages[$name]['links']);
550 $dot .= " \"$nodename\" -> "
557 if ($colorby != 'none') {
558 $dot .= "\n subgraph cluster_legend {\n"
559 . " node[fontname=$fontname,shape=box,width=0.4,height=0.4,fontsize=$fontsize];\n"
560 . " fillcolor=lightgrey;\n"
562 . " fontname=$fontname;\n"
563 . " fontsize=$fontsize;\n"
564 . " label=\"".gettext("Legend")."\";\n";
565 $oldest= ceil($this->oldest / (24 * 3600));
568 for($i = 0; $i < $max; $i++) {
569 $time = floor($i / $max * $oldest);
570 $name = '"' . $time .' '. _("days") .'"';
571 $col = $this->getColor($i/$max);
572 $dot .= sprintf(' %s [%scolor="#%02X%02X%02X"];',
573 $name, $fillstring, $col[0], $col[1], $col[2])
577 $dot .= ' '. join(' -> ', $legend)
585 $ok = fwrite($fp, $dot);
586 $ok = fclose($fp) && $ok; // close anyway
592 * Execute system command.
594 * @param cmd string command to be invoked
595 * @return boolean error status; true=ok; false=error
597 function execute($cmd) {
598 exec($cmd, $outarr, $returnval); // normally 127
599 $errstr = join('',$outarr);
601 trigger_error($cmd.": ".$errstr, E_USER_WARNING);
604 return empty($errstr);
608 * Produces a dot file, calls dot twice to obtain an image and a
609 * text description of active areas for hyperlinking and returns
610 * an image and an html map.
612 * @param width float width of the output graph in inches
613 * @param height float height of the graph in inches
614 * @param colorby string color sceme beeing used ('age', 'revtime',
616 * @param shape string node shape; 'ellipse', 'box', 'circle', 'point'
617 * @param label string not used anymore
619 function invokeDot($argarray) {
621 //$cacheparams = $GLOBALS['CacheParams'];
622 $tempfiles = $this->tempnam('VisualWiki');
623 $gif = $argarray['imgtype'];
624 $ImageCreateFromFunc = "ImageCreateFrom$gif";
626 && $this->createDotFile($tempfiles.'.dot',$argarray)
627 && $this->execute("$dotbin -T$gif $tempfiles.dot -o $tempfiles.$gif")
628 && $this->execute("$dotbin -Timap $tempfiles.dot -o $tempfiles.map")
629 && file_exists( "$tempfiles.$gif" )
630 && file_exists( $tempfiles.'.map' )
631 && ($img = $ImageCreateFromFunc( "$tempfiles.$gif" ))
632 && ($fp = fopen($tempfiles.'.map','r'));
637 $line = fgets($fp, 1000);
638 if (substr($line, 0, 1) == '#')
640 list($shape, $url, $e1, $e2, $e3, $e4) = sscanf($line,
641 "%s %s %d,%d %d,%d");
642 if ($shape != 'rect')
645 // dot sometimes gives not allways the right order so
646 // so we have to sort a bit
651 $map->pushContent(HTML::area(array(
653 'coords' => "$x1,$y1,$x2,$y2",
655 'title' => rawurldecode($url),
659 //trigger_error("url=".$url);
662 $tempfiles.$gif: ".(file_exists("$tempfiles.$gif") ? filesize("$tempfiles.$gif"):'missing')."
663 $tempfiles.map: ".(file_exists("$tempfiles.map") ? filesize("$tempfiles.map"):'missing')."
667 // clean up tempfiles
668 if ($ok and !$argarray['debug'])
669 foreach (array('',".$gif",".map",".dot") as $ext) {
670 if (file_exists($tempfiles.$ext))
671 unlink($tempfiles.$ext);
675 return array($img, $map);
677 return array(false, false);
681 * Prepares some rainbow colors for the nodes of the graph
682 * and stores them in an array which may be accessed with
683 * <code>getColor</code>.
685 function createColors() {
686 $predefcolors = array(
687 array('red' => 255, 'green' => 0, 'blue' => 0),
688 array('red' => 255, 'green' => 255, 'blue' => 0),
689 array('red' => 0, 'green' => 255, 'blue' => 0),
690 array('red' => 0, 'green' => 255, 'blue' => 255),
691 array('red' => 0, 'green' => 0, 'blue' => 255),
692 array('red' => 100, 'green' => 100, 'blue' => 100)
696 $numberofcolors = count($predefcolors) * $steps;
699 foreach($predefcolors as $color) {
705 for ($i = 0; $i < $steps; $i++)
706 $this->ColorTab[++$promille / $numberofcolors * 1000] = array(
707 floor(interpolate( $oldcolor['red'], $color['red'], $i/$steps )),
708 floor(interpolate( $oldcolor['green'], $color['green'], $i/$steps )),
709 floor(interpolate( $oldcolor['blue'], $color['blue'], $i/$steps ))
713 //echo"<pre>"; var_dump($this->ColorTab); echo "</pre>";
717 * Translates a value from 0.0 to 1.0 into rainbow color.
718 * red -> orange -> green -> blue -> gray
720 * @param promille float value between 0.0 and 1.0
721 * @return array(red,green,blue)
723 function getColor($promille) {
724 foreach( $this->ColorTab as $pro => $col ) {
725 if ($promille*1000 < $pro)
728 $lastcol = end($this->ColorTab);
731 } // WikiPlugin_VisualWiki
734 * Linear interpolates a value between two point a and b
736 * @return float interpolated value
739 function interpolate($a, $b, $pos) {
740 return $a + ($b - $a) * $pos;
743 // $Log: not supported by cvs2svn $
744 // Revision 1.12 2004/09/06 12:08:50 rurban
745 // memory_limit on unix workaround
746 // VisualWiki: default autosize image
748 // Revision 1.11 2004/09/06 10:10:27 rurban
749 // fixed syntax error
751 // Revision 1.10 2004/06/19 10:06:38 rurban
752 // Moved lib/plugincache-config.php to config/*.ini
753 // use PLUGIN_CACHED_* constants instead of global $CacheParams
755 // Revision 1.9 2004/06/03 09:40:57 rurban
756 // WikiPluginCache improvements
758 // Revision 1.8 2004/01/26 09:18:00 rurban
759 // * changed stored pref representation as before.
760 // the array of objects is 1) bigger and 2)
761 // less portable. If we would import packed pref
762 // objects and the object definition was changed, PHP would fail.
763 // This doesn't happen with an simple array of non-default values.
764 // * use $prefs->retrieve and $prefs->store methods, where retrieve
765 // understands the interim format of array of objects also.
766 // * simplified $prefs->get() and fixed $prefs->set()
767 // * added $user->_userid and class '_WikiUser' portability functions
768 // * fixed $user object ->_level upgrading, mostly using sessions.
769 // this fixes yesterdays problems with loosing authorization level.
770 // * fixed WikiUserNew::checkPass to return the _level
771 // * fixed WikiUserNew::isSignedIn
772 // * added explodePageList to class PageList, support sortby arg
773 // * fixed UserPreferences for WikiUserNew
774 // * fixed WikiPlugin for empty defaults array
775 // * UnfoldSubpages: added pagename arg, renamed pages arg,
776 // removed sort arg, support sortby arg
778 // Revision 1.7 2003/03/03 13:57:31 carstenklapp
779 // Added fontpath (see PhpWiki:VisualWiki), tries to be smart about which OS.
780 // (This plugin still doesn't work for me on OS X, but at least image files
781 // are actually being created now in '/tmp/cache'.)
783 // Revision 1.6 2003/01/18 22:11:45 carstenklapp
785 // Reformatting & tabs to spaces;
786 // Added copyleft, getVersion, getDescription, rcs_id.
793 // c-hanging-comment-ender-p: nil
794 // indent-tabs-mode: nil