xref: /plugin/siteexport/helper.php (revision f161d4fba03cb6d24d9cc13577cad50481efcf26)
17d101cc1SGerry Weißbach<?php
27d101cc1SGerry Weißbach/**
36f1c90e9SGerry Weißbach * Siteexport Plugin helper
47d101cc1SGerry Weißbach *
57d101cc1SGerry Weißbach * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
64b73700eSGerry Weißbach * @author     i-net software <tools@inetsoftware.de>
74b73700eSGerry Weißbach * @author     Gerry Weissbach <gweissbach@inetsoftware.de>
87d101cc1SGerry Weißbach */
97d101cc1SGerry Weißbach
107d101cc1SGerry Weißbach// must be run within Dokuwiki
117d101cc1SGerry Weißbachif(!defined('DOKU_INC')) die();
12996c253aSGerry Weißbachrequire_once(DOKU_PLUGIN.'siteexport/preload.php');
13fd385364SGerry Weißbach
14fd385364SGerry Weißbachclass helper_plugin_siteexport_page_remove {
151e1afed6SGerry Weißbach    private $start, $end;
16fd385364SGerry Weißbach
170571ece2SScrutinizer Auto-Fixer    /**
180571ece2SScrutinizer Auto-Fixer     * @param integer $start
190571ece2SScrutinizer Auto-Fixer     * @param integer $end
200571ece2SScrutinizer Auto-Fixer     */
21a8c17ab5Si-net /// software    public function __construct($start, $end=null) {
221e1afed6SGerry Weißbach        $this->start = $start;
231e1afed6SGerry Weißbach        $this->end = $end;
24fd385364SGerry Weißbach    }
25fd385364SGerry Weißbach
26a8c17ab5Si-net /// software    public function _page_remove($elem) {
271e1afed6SGerry Weißbach        return $elem[2] >= $this->start && ( is_null( $this->end ) || $elem[2] <= $this->end);
28fd385364SGerry Weißbach    }
29fd385364SGerry Weißbach}
30fd385364SGerry Weißbach
317d101cc1SGerry Weißbachclass helper_plugin_siteexport extends DokuWiki_Plugin {
327d101cc1SGerry Weißbach
337d101cc1SGerry Weißbach    /*
347d101cc1SGerry Weißbach     * return all the templates that this wiki has
357d101cc1SGerry Weißbach     */
36a8c17ab5Si-net /// software    public function __getTemplates() {
377d101cc1SGerry Weißbach
387d101cc1SGerry Weißbach        // populate $this->_choices with a list of directories
397d101cc1SGerry Weißbach        $list = array();
407d101cc1SGerry Weißbach
417d101cc1SGerry Weißbach        $_dir = DOKU_INC . 'lib/tpl/';
427d101cc1SGerry Weißbach        $_pattern = '/^[\w-]+$/';
437d101cc1SGerry Weißbach        if ($dh = @opendir($_dir)) {
447d101cc1SGerry Weißbach            while (false !== ($entry = readdir($dh))) {
450571ece2SScrutinizer Auto-Fixer                if ($entry == '.' || $entry == '..') {
460571ece2SScrutinizer Auto-Fixer                    continue;
470571ece2SScrutinizer Auto-Fixer                }
480571ece2SScrutinizer Auto-Fixer                if ($entry == '.' || $entry == '..') {
490571ece2SScrutinizer Auto-Fixer                    continue;
500571ece2SScrutinizer Auto-Fixer                }
510571ece2SScrutinizer Auto-Fixer                if ($_pattern && !preg_match($_pattern,$entry)) {
520571ece2SScrutinizer Auto-Fixer                    continue;
530571ece2SScrutinizer Auto-Fixer                }
547d101cc1SGerry Weißbach
557d101cc1SGerry Weißbach                $file = (is_link($_dir.$entry)) ? readlink($_dir.$entry) : $entry;
560571ece2SScrutinizer Auto-Fixer                if (is_dir($_dir.$file)) {
570571ece2SScrutinizer Auto-Fixer                    $list[] = $entry;
580571ece2SScrutinizer Auto-Fixer                }
597d101cc1SGerry Weißbach            }
607d101cc1SGerry Weißbach            closedir($dh);
617d101cc1SGerry Weißbach        }
627d101cc1SGerry Weißbach
637d101cc1SGerry Weißbach
647d101cc1SGerry Weißbach        sort($list);
657d101cc1SGerry Weißbach        return $list;
667d101cc1SGerry Weißbach    }
677d101cc1SGerry Weißbach
687d101cc1SGerry Weißbach    /*
697d101cc1SGerry Weißbach     * Return array list of plugins that exist
707d101cc1SGerry Weißbach     */
71a8c17ab5Si-net /// software    public function __getPluginList() {
727d101cc1SGerry Weißbach        global $plugin_controller;
737d101cc1SGerry Weißbach
747d101cc1SGerry Weißbach        $allPlugins = array();
757842d330SGerry Weißbach        foreach ($plugin_controller->getList(null, true) as $plugin) { // All plugins
767d101cc1SGerry Weißbach            // check for CSS or JS
777842d330SGerry Weißbach            if (!file_exists(DOKU_PLUGIN . "$plugin/script.js") && !file_exists(DOKU_PLUGIN . "$plugin/style.css") && !file_exists(DOKU_PLUGIN . "$plugin/print.css")) { continue; }
787d101cc1SGerry Weißbach            $allPlugins[] = $plugin;
797d101cc1SGerry Weißbach        }
807d101cc1SGerry Weißbach
817d101cc1SGerry Weißbach        return array($allPlugins, $plugin_controller->getList());
827d101cc1SGerry Weißbach    }
8395c3174fSGerry Weißbach
84a8c17ab5Si-net /// software    public function _page_sort($a, $b)
85fd385364SGerry Weißbach    {
86fd385364SGerry Weißbach        if ( $a[2] == $b[2] ) {
87fd385364SGerry Weißbach            return 0;
88fd385364SGerry Weißbach        }
89fd385364SGerry Weißbach
90fd385364SGerry Weißbach        return $a[2] > $b[2] ? -1 : 1;
91fd385364SGerry Weißbach    }
92fd385364SGerry Weißbach
936292ca7aSGerry Weißbach    public function __getOrderedListOfPagesForID($IDs, $start=null)
94fd385364SGerry Weißbach    {
95fd385364SGerry Weißbach        global $conf;
96fd385364SGerry Weißbach        require_once(dirname(__FILE__)."/inc/functions.php");
97fd385364SGerry Weißbach        $functions = new siteexport_functions(false);
98fd385364SGerry Weißbach
996292ca7aSGerry Weißbach        if ( !is_array($IDs) ) {
1006292ca7aSGerry Weißbach            $IDs = array($IDs);
1016292ca7aSGerry Weißbach        }
1026292ca7aSGerry Weißbach
103fd385364SGerry Weißbach        $sites = $values = array();
1046292ca7aSGerry Weißbach        foreach( $IDs as $ID ) {
10539a762abSGerry Weißbach            $page = null;
106fd385364SGerry Weißbach            search($sites, $conf['datadir'], 'search_allpages', array(), $functions->getNamespaceFromID($ID, $page));
107fd385364SGerry Weißbach            foreach( $sites as $site ) {
108fd385364SGerry Weißbach
1090571ece2SScrutinizer Auto-Fixer                if ( $ID == $site['id'] ) {
1100571ece2SScrutinizer Auto-Fixer                    continue;
1110571ece2SScrutinizer Auto-Fixer                }
112fd385364SGerry Weißbach                $sortIdentifier = intval(p_get_metadata($site['id'], 'mergecompare'));
11339a762abSGerry Weißbach                $entry = array(':' . $site['id'], $functions->getSiteTitle($site['id']), $sortIdentifier);
11439a762abSGerry Weißbach
11539a762abSGerry Weißbach                if ( !in_array($entry[0], array_column($values, 0)) ) {
11639a762abSGerry Weißbach                    array_push($values, $entry);
117fd385364SGerry Weißbach                }
1186292ca7aSGerry Weißbach            }
11939a762abSGerry Weißbach        }
12039a762abSGerry Weißbach
121fd385364SGerry Weißbach
1221e1afed6SGerry Weißbach        if ( $start != null ) {
123fd385364SGerry Weißbach            // filter using the newerThanPage indicator
1241e1afed6SGerry Weißbach            $sortIdentifier = intval(p_get_metadata($start, 'mergecompare'));
12579f984a1SGerry Weißbach            $values = array_filter($values, array(new helper_plugin_siteexport_page_remove($sortIdentifier), '_page_remove'));
126fd385364SGerry Weißbach        }
127fd385364SGerry Weißbach
128fd385364SGerry Weißbach        usort($values, array($this, '_page_sort'));
129fd385364SGerry Weißbach
130fd385364SGerry Weißbach        return $values;
131fd385364SGerry Weißbach    }
132fd385364SGerry Weißbach
133a8c17ab5Si-net /// software    public function __getOrderedListOfPagesForStartEnd($ID, $start, $end)
1341e1afed6SGerry Weißbach    {
1351e1afed6SGerry Weißbach        $values = $this->__getOrderedListOfPagesForID($ID);
1361e1afed6SGerry Weißbach
1371e1afed6SGerry Weißbach           // filter using the newerThanPage indicator
1381e1afed6SGerry Weißbach        $values = array_filter($values, array(new helper_plugin_siteexport_page_remove(intval($start), intval($end)), '_page_remove'));
1391e1afed6SGerry Weißbach
1401e1afed6SGerry Weißbach        usort($values, array($this, '_page_sort'));
1411e1afed6SGerry Weißbach        return $values;
1421e1afed6SGerry Weißbach    }
1431e1afed6SGerry Weißbach
144a8c17ab5Si-net /// software    public function __siteexport_addpage() {
14595c3174fSGerry Weißbach
146*f161d4fbSatisne        global $ID, $conf, $INPUT;
14795c3174fSGerry Weißbach
14895c3174fSGerry Weißbach        $templateSwitching = false;
14995c3174fSGerry Weißbach        $pdfExport = false;
15095c3174fSGerry Weißbach        $translationAvailable = false;
15195c3174fSGerry Weißbach        $usenumberedheading = true;
152a8c17ab5Si-net /// software        $trans = array();
15395c3174fSGerry Weißbach
154996c253aSGerry Weißbach        $preload = plugin_load('preload', 'siteexport');
155996c253aSGerry Weißbach        if ($preload && $preload->__create_preload_function()) {
15695c3174fSGerry Weißbach            $templateSwitching = true;
15795c3174fSGerry Weißbach        }
15895c3174fSGerry Weißbach
159996c253aSGerry Weißbach        $dw2pdf = plugin_load('action', 'dw2pdf');
160996c253aSGerry Weißbach        if ($dw2pdf) {
16195c3174fSGerry Weißbach            $pdfExport = true;
16295c3174fSGerry Weißbach        }
16395c3174fSGerry Weißbach
1646f1c90e9SGerry Weißbach        $translation = plugin_load('helper', 'autotranslation');
165996c253aSGerry Weißbach        if ($translation) {
16695c3174fSGerry Weißbach            $translationAvailable = true;
167a8c17ab5Si-net /// software            $trans = $translation->translations;
16895c3174fSGerry Weißbach        }
16995c3174fSGerry Weißbach
170fd385364SGerry Weißbach        print $this->locale_xhtml((defined('DOKU_SITEEXPORT_MANAGER') ? 'manager' : '') . 'intro');
17195c3174fSGerry Weißbach
17295c3174fSGerry Weißbach        $form = new Doku_Form('siteexport', null, 'post');
17395c3174fSGerry Weißbach        $form->startFieldset($this->getLang('startingNamespace'));
17495c3174fSGerry Weißbach
17595c3174fSGerry Weißbach        $form->addElement(form_makeTextField('ns', $ID, $this->getLang('ns') . ':', 'ns'));
17695c3174fSGerry Weißbach        $form->addElement(form_makeTag('br'));
17795c3174fSGerry Weißbach        $form->addElement(form_makeTextField('ens', $ID, $this->getLang('ens') . ':', 'ens'));
17895c3174fSGerry Weißbach
17995c3174fSGerry Weißbach        $form->addElement(form_makeTag('br'));
180*f161d4fbSatisne        $form->addElement(form_makeListboxField('depthType', array("0.0" => $this->getLang('depth.pageOnly'), "1.0" => $this->getLang('depth.allSubNameSpaces'), "2.0" => $this->getLang('depth.specifiedDepth')), $INPUT->str('depthType', $this->getLang('depth.allSubNameSpaces'), true), $this->getLang('depthType') . ':', 'depthType', null, array_merge(array('class' => 'edit'))));
18195c3174fSGerry Weißbach
18295c3174fSGerry Weißbach        $form->addElement(form_makeTag('br'));
183*f161d4fbSatisne        $form->addElement(form_makeOpenTag("div", array('style' => 'display:' . ($INPUT->str('depthType') == "2" ? "block" : "none") . ';', 'id' => 'depthContainer')));
18495c3174fSGerry Weißbach        $form->addElement(form_makeTextField('depth', $this->getConf('depth'), $this->getLang('depth') . ':', 'depth'));
18595c3174fSGerry Weißbach        $form->addElement(form_makeCloseTag("div"));
18695c3174fSGerry Weißbach
18795c3174fSGerry Weißbach        $form->endFieldset();
18895c3174fSGerry Weißbach        $form->addElement(form_makeTag('br'));
18995c3174fSGerry Weißbach
19095c3174fSGerry Weißbach        $form->startFieldset($this->getLang('selectYourOptions'));
19195c3174fSGerry Weißbach        $form->addElement(form_makeCheckboxField('absolutePath', 1, $this->getLang('absolutePath') . ':', 'absolutePath'));
19295c3174fSGerry Weißbach        $form->addElement(form_makeTag('br'));
193a0318c58SGerry Weißbach        // The parameter needs lowercase
194a0318c58SGerry Weißbach        $form->addElement(form_makeCheckboxField('exportbody', 1, $this->getLang('exportBody') . ':', 'exportbody'));
19595c3174fSGerry Weißbach        $form->addElement(form_makeTag('br'));
196351a4959Si-net /// software        $form->addElement(form_makeCheckboxField('exportLinkedPages', 1, $this->getLang('exportLinkedPages') . ':', 'exportLinkedPages', 'sendIfNotSet', array('checked' => 'checked')));
1976c03fa62SGerry Weißbach        $form->addElement(form_makeTag('br'));
19895c3174fSGerry Weißbach        $form->addElement(form_makeCheckboxField('disableCache', 1, $this->getLang('disableCache') . ':', 'disableCache'));
19995c3174fSGerry Weißbach        $form->addElement(form_makeTag('br'));
20095c3174fSGerry Weißbach        $form->addElement(form_makeCheckboxField('addParams', 1, $this->getLang('addParams') . ':', 'addParams', null, array_merge(array('checked' => ($conf['userewrite'] != 1 ? 'checked' : '')))));
20195c3174fSGerry Weißbach        $form->addElement(form_makeTag('br'));
20295c3174fSGerry Weißbach        $form->addElement(form_makeTag('br'));
20395c3174fSGerry Weißbach        $form->addElement(form_makeListboxField('renderer', array_merge(array('', 'xhtml'), plugin_list('renderer')), '', $this->getLang('renderer') . ':', 'renderer', null, array_merge(array('class' => 'edit'))));
20495c3174fSGerry Weißbach
20595c3174fSGerry Weißbach        $form->addElement(form_makeTag('br'));
20695c3174fSGerry Weißbach        if ($templateSwitching) {
20795c3174fSGerry Weißbach            $form->addElement(form_makeListboxField('template', $this->__getTemplates(), $conf['template'], $this->getLang('template') . ':', 'template', null, array_merge(array('class' => 'edit'))));
20895c3174fSGerry Weißbach            $form->addElement(form_makeTag('br'));
20995c3174fSGerry Weißbach        } else
21095c3174fSGerry Weißbach        {
21195c3174fSGerry Weißbach            $form->addElement(form_makeTag('br'));
21295c3174fSGerry Weißbach            $form->addElement(form_makeOpenTag('p', array('style' => 'color: #a00;')));
21395c3174fSGerry Weißbach            $form->addElement('Can\'t create preload file in \'inc\' directory. Template switching is not available. Plugin disabling is not available.');
21495c3174fSGerry Weißbach            $form->addElement(form_makeCloseTag('p'));
21595c3174fSGerry Weißbach        }
21695c3174fSGerry Weißbach
21795c3174fSGerry Weißbach        $form->addElement(form_makeTag('br'));
21895c3174fSGerry Weißbach        $form->addElement(form_makeCheckboxField('pdfExport', 1, $this->getLang('pdfExport') . ':', 'pdfExport', null, $pdfExport ? array() : array_merge(array('disabled' => 'disabled'))));
219a8c17ab5Si-net /// software
220a8c17ab5Si-net /// software        // Hint for dw2pdf
221a8c17ab5Si-net /// software        $this->addPluginHint( $form, $pdfExport, "the PDF export", "dw2pdf" );
22295c3174fSGerry Weißbach
22395c3174fSGerry Weißbach        $form->addElement(form_makeTag('br'));
22495c3174fSGerry Weißbach        $form->addElement(form_makeCheckboxField('usenumberedheading', 1, $this->getLang('usenumberedheading') . ':', 'usenumberedheading', null, $usenumberedheading && $pdfExport ? array() : array_merge(array('disabled' => 'disabled'))));
22595c3174fSGerry Weißbach        $form->addElement(form_makeTag('br'));
22695c3174fSGerry Weißbach
227a8c17ab5Si-net /// software        // Hint for nodetailsxhtml
228a8c17ab5Si-net /// software        $this->addPluginHint( $form, $usenumberedheading, "numbered headings", "nodetailsxhtml" );
22995c3174fSGerry Weißbach
23095c3174fSGerry Weißbach        $form->endFieldset();
23195c3174fSGerry Weißbach        $form->addElement(form_makeTag('br'));
23295c3174fSGerry Weißbach
23395c3174fSGerry Weißbach        $form->startFieldset($this->getLang('helpCreationOptions'));
23495c3174fSGerry Weißbach        $form->addElement(form_makeCheckboxField('eclipseDocZip', 1, $this->getLang('eclipseDocZip') . ':', 'eclipseDocZip'));
23595c3174fSGerry Weißbach        $form->addElement(form_makeTag('br'));
23695c3174fSGerry Weißbach        $form->addElement(form_makeCheckboxField('JavaHelpDocZip', 1, $this->getLang('JavaHelpDocZip') . ':', 'JavaHelpDocZip'));
23795c3174fSGerry Weißbach        $form->addElement(form_makeTag('br'));
23895c3174fSGerry Weißbach        $form->addElement(form_makeCheckboxField('useTocFile', 1, $this->getLang('useTocFile') . ':', 'useTocFile'));
23995c3174fSGerry Weißbach        $form->addElement(form_makeTag('br'));
24095c3174fSGerry Weißbach        $form->addElement(form_makeCheckboxField('emptyTocElem', 1, $this->getLang('emptyTocElem') . ':', 'emptyTocElem'));
24195c3174fSGerry Weißbach        $form->addElement(form_makeTag('br'));
24295c3174fSGerry Weißbach        if (!$translationAvailable) {
24395c3174fSGerry Weißbach            $form->addElement(form_makeCheckboxField('TOCMapWithoutTranslation', 1, $this->getLang('TOCMapWithoutTranslation') . ':', 'TOCMapWithoutTranslation'));
24495c3174fSGerry Weißbach            $form->addElement(form_makeTag('br'));
24513326eabSGerry Weißbach        } else {
2460f428217SGerry Weißbach
2470f428217SGerry Weißbach            if (!is_array($trans)) {
2480f428217SGerry Weißbach                $trans = array($trans);
2490f428217SGerry Weißbach            }
2500f428217SGerry Weißbach
2510f428217SGerry Weißbach            $trans = array_unique(array_merge($trans, array($conf['lang'])));
2520f428217SGerry Weißbach            $form->addElement(form_makeListboxField('defaultLang', $trans, $conf['lang'], $this->getLang('defaultLang') . ':', 'defaultLang'));
25313326eabSGerry Weißbach            $form->addElement(form_makeTag('br'));
25495c3174fSGerry Weißbach        }
25595c3174fSGerry Weißbach        $form->endFieldset();
25695c3174fSGerry Weißbach        $form->addElement(form_makeTag('br'));
25795c3174fSGerry Weißbach
25895c3174fSGerry Weißbach        if ($templateSwitching)
25995c3174fSGerry Weißbach        {
26095c3174fSGerry Weißbach            $form->startFieldset($this->getLang('disablePluginsOption'));
26195c3174fSGerry Weißbach
26295c3174fSGerry Weißbach            $form->addElement(form_makeCheckboxField("disableall", 1, 'Disable All:', "disableall", 'forceVisible'));
26395c3174fSGerry Weißbach            $form->addElement(form_makeTag('br'));
26495c3174fSGerry Weißbach            $form->addElement(form_makeTag('br'));
26595c3174fSGerry Weißbach
26695c3174fSGerry Weißbach            list($allPlugins, $enabledPlugins) = $this->__getPluginList();
26795c3174fSGerry Weißbach            foreach ($allPlugins as $plugin) {
26895c3174fSGerry Weißbach                $form->addElement(form_makeCheckboxField("disableplugin[]", $plugin, $plugin . ':', "disableplugin_$plugin", null, (!in_array($plugin, $enabledPlugins) ? array('checked' => 'checked', 'disabled' => 'disabled') : array())));
26995c3174fSGerry Weißbach                $form->addElement(form_makeTag('br'));
27095c3174fSGerry Weißbach            }
27195c3174fSGerry Weißbach
27295c3174fSGerry Weißbach            $form->endFieldset();
27395c3174fSGerry Weißbach            $form->addElement(form_makeTag('br'));
27495c3174fSGerry Weißbach        }
27595c3174fSGerry Weißbach
27695c3174fSGerry Weißbach        $form->startFieldset( $this->getLang('customOptions') );
27795c3174fSGerry Weißbach        $form->addElement(form_makeOpenTag('p'));
27895c3174fSGerry Weißbach        $form->addElement( $this->getLang('customOptionsDescription') );
27995c3174fSGerry Weißbach        $form->addElement(form_makeCloseTag('p'));
28095c3174fSGerry Weißbach
28195c3174fSGerry Weißbach        $form->addElement(form_makeOpenTag('ul', array('id' => 'siteexport__customActions')));
28295c3174fSGerry Weißbach        $form->addElement(form_makeCloseTag('ul'));
28395c3174fSGerry Weißbach        $form->addElement(form_makeTag('br', array('class'=>'clear')));
28495c3174fSGerry Weißbach        $form->addElement(form_makeButton('submit', 'addoption', $this->getLang('addCustomOption') , array('style' => 'float:right;') ));
28595c3174fSGerry Weißbach
28695c3174fSGerry Weißbach        $form->endFieldset();
28795c3174fSGerry Weißbach        $form->addElement(form_makeTag('br'));
28895c3174fSGerry Weißbach
289fd385364SGerry Weißbach        if ( !defined('DOKU_SITEEXPORT_MANAGER') ) {
29095c3174fSGerry Weißbach
291fd385364SGerry Weißbach
292fd385364SGerry Weißbach            $form->startFieldset( $this->getLang('startProcess') );
29395c3174fSGerry Weißbach            $form->addElement(form_makeTextField('copyurl', "", $this->getLang('directDownloadLink') . ':', 'copyurl', null, array('readonly' => 'readonly') ));
29495c3174fSGerry Weißbach            $form->addElement(form_makeTag('br'));
29595c3174fSGerry Weißbach            $form->addElement(form_makeTextField('wgeturl', "", $this->getLang('wgetURLLink') . ':', 'wgeturl', null, array('readonly' => 'readonly') ));
29695c3174fSGerry Weißbach            $form->addElement(form_makeTag('br'));
29795c3174fSGerry Weißbach            $form->addElement(form_makeTextField('curlurl', "", $this->getLang('curlURLLink') . ':', 'curlurl', null, array('readonly' => 'readonly') ));
29895c3174fSGerry Weißbach            $form->addElement(form_makeTag('br', array('class'=>'clear')));
29995c3174fSGerry Weißbach            $form->addElement(form_makeButton('submit', 'siteexport', $this->getLang('start') , array('style' => 'float:right;')));
30095c3174fSGerry Weißbach            $form->endFieldset();
30195c3174fSGerry Weißbach            $form->addElement(form_makeTag('br'));
30295c3174fSGerry Weißbach
303fd385364SGerry Weißbach            $form->endFieldset();
304fd385364SGerry Weißbach            $form->addElement(form_makeTag('br'));
305fd385364SGerry Weißbach
30695c3174fSGerry Weißbach            $form->startFieldset( $this->getLang('status') );
30795c3174fSGerry Weißbach            $form->addElement(form_makeOpenTag('span', array('id' => 'siteexport__out')));
30895c3174fSGerry Weißbach
30995c3174fSGerry Weißbach            $form->addElement(form_makeCloseTag('span'));
31095c3174fSGerry Weißbach            $form->addElement(form_makeOpenTag('span', array('class' => 'siteexport__throbber')));
311f0a70e11Si-net /// software
312f0a70e11Si-net /// software            $throbber = DOKU_BASE.'lib/images/loading.gif';
313f0a70e11Si-net /// software            if ( !file_exists( $throbber) ) {
314f0a70e11Si-net /// software                $throbber = DOKU_BASE.'lib/images/throbber.gif';
315f0a70e11Si-net /// software            }
316f0a70e11Si-net /// software
317f0a70e11Si-net /// software            $form->addElement(form_makeTag('img', array('src' => $throbber, 'id' => 'siteexport__throbber')));
31895c3174fSGerry Weißbach            $form->addElement(form_makeCloseTag('span'));
31995c3174fSGerry Weißbach            $form->endFieldset();
32095c3174fSGerry Weißbach            $form->addElement(form_makeTag('br'));
32195c3174fSGerry Weißbach
322fd385364SGerry Weißbach        } else {
323fd385364SGerry Weißbach            $form->startFieldset( $this->getLang('startProcess') );
324fd385364SGerry Weißbach            $form->addElement(form_makeButton('submit', 'siteexport', $this->getLang('useOptionsInEditor') , array('style' => 'width:100%;')));
325fd385364SGerry Weißbach        }
32695c3174fSGerry Weißbach
32795c3174fSGerry Weißbach        $form->endFieldset();
328fd385364SGerry Weißbach        $form->addElement(form_makeTag('br'));
32995c3174fSGerry Weißbach
33095c3174fSGerry Weißbach        $form->printForm();
33195c3174fSGerry Weißbach    }
332a8c17ab5Si-net /// software
333a8c17ab5Si-net /// software    private function addPluginHint( &$form, $condition, $hint, $plugin ) {
334a8c17ab5Si-net /// software        if ($condition) { return; }
335a8c17ab5Si-net /// software
336a8c17ab5Si-net /// software        $form->addElement(form_makeOpenTag('p', array('style' => 'color: #a00;')));
337a8c17ab5Si-net /// software        $form->addElement('In order to use ' . $hint . ', please ');
338a8c17ab5Si-net /// software        $form->addElement(form_makeOpenTag('a', array('href' => 'http://www.dokuwiki.org/plugin:' . $plugin, 'alt' => 'install plugin', 'target' => '_blank')));
339a8c17ab5Si-net /// software        $form->addElement('install the ' . $plugin . ' plugin.');
340a8c17ab5Si-net /// software        $form->addElement(form_makeCloseTag('a'));
341a8c17ab5Si-net /// software        $form->addElement(form_makeCloseTag('p'));
342a8c17ab5Si-net /// software    }
343a8c17ab5Si-net /// software
3447d101cc1SGerry Weißbach}
345