1<?php
2/**
3 * DokuWiki Plugin multiorphan (Helper Component)
4 *
5 * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
6 * @author  i-net software <tools@inetsoftware.de>
7 */
8
9// must be run within Dokuwiki
10if (!defined('DOKU_INC')) die();
11
12class helper_plugin_multiorphan extends DokuWiki_Plugin {
13
14    /**
15     * Return info about supported methods in this Helper Plugin
16     *
17     * @return array of public methods
18     */
19    public function getMethods() {
20        return array(
21            array(
22                'name'   => 'getThreads',
23                'desc'   => 'returns pages with discussion sections, sorted by recent comments',
24                'params' => array(
25                    'namespace'         => 'string',
26                    'number (optional)' => 'integer'
27                ),
28                'return' => array('pages' => 'array')
29            ),
30            array(
31                // and more supported methods...
32            )
33        );
34    }
35
36    /**
37     * Constructs the base GUI
38     */
39    public function __multiorphan_gui() {
40
41
42        global $ID, $conf;
43
44        print $this->locale_xhtml('intro');
45
46        $form = new Doku_Form('multiorphan', null, 'post');
47        $form->startFieldset($this->getLang('startProcess'));
48
49        $form->addElement(form_makeTextField('ns', getNS($ID), $this->getLang('ns') . ':', 'ns'));
50        $form->addElement(form_makeTag('br'));
51
52        $form->addElement(form_makeTextField('filter', '', $this->getLang('idFilter') . ':', 'filter'));
53        $form->addElement(form_makeTag('br'));
54/*
55        $form->addElement(form_makeCheckboxField('purge', 1, $this->getLang('purge') . ':', 'purge'));
56        $form->addElement(form_makeTag('br'));
57*/
58        $form->addElement(form_makeCheckboxField('includeHidden', 1, $this->getLang('includeHidden') . ':', 'includeHidden'));
59        $form->addElement(form_makeTag('br'));
60
61        $form->addElement(form_makeCheckboxField('checkExternal', 1, $this->getLang('checkExternal') . '<span style="color:#00f">*</span>:', 'checkExternal'));
62        $form->addElement(form_makeTag('br'));
63
64        $form->addElement(form_makeCheckboxField('includeWindowsShares', 1, $this->getLang('includeWindowsShares') . '<span style="color:#00f">**</span>:', 'includeWindowsShares'));
65        $form->addElement(form_makeTag('br'));
66
67        $form->addElement(form_makeTextField('throttle', 0, $this->getLang('throttle') . ':', 'throttle'));
68        $form->addElement(form_makeTag('br'));
69
70        $form->addElement(form_makeButton('submit', 'multiorphan', $this->getLang('start') , array('style' => 'float:right;')));
71
72        $form->addElement(form_makeTag('br'));
73        $form->addElement(form_makeOpenTag('sub'));
74        $form->addElement('<span style="color:#00f">*</span> ');
75        $form->addElement($this->getLang('checkExternalHint'));
76        $form->addElement(form_makeTag('br'));
77        $form->addElement('<span style="color:#00f">**</span> ');
78        $form->addElement($this->getLang('includeWindowsSharesHint'));
79        $form->addElement(form_makeCloseTag('sub'));
80        $form->endFieldset();
81
82        $form->startFieldset( $this->getLang('status') );
83        $form->addElement(form_makeTag('div', array('id' => 'multiorphan__out')));
84        $form->addElement(form_makeOpenTag('span', array('class' => 'multiorphan__throbber')));
85        $form->addElement(form_makeTag('img', array('src' => DOKU_BASE.'lib/images/throbber.gif', 'id' => 'multiorphan__throbber')));
86        $form->addElement(form_makeCloseTag('span'));
87        $form->addElement(form_makeCloseTag('div'));
88        $form->endFieldset();
89
90        $this->__makeForm($form, 'pages');
91        $this->__makeForm($form, 'media');
92
93        $form->printForm();
94
95    }
96
97    private function __makeForm(&$form, $type) {
98
99        $form->startFieldset($this->getLang($type . '-result'));
100        $form->addElement(form_makeOpenTag('div', array('class' => 'multiorphan__result_group ' . $type)));
101
102        $form->addElement(form_makeOpenTag('h3', array('class' => 'header wanted')));
103        $form->addElement($this->getLang('wanted'));
104        $form->addElement(form_makeCloseTag('h3'));
105        $form->addElement(form_makeOpenTag('div', array('class' => 'multiorphan__result wanted')));
106        $form->addElement(form_makeCloseTag('div'));
107
108        $form->addElement(form_makeOpenTag('h3', array('class' => 'header orphan')));
109        $form->addElement($this->getLang('orphan'));
110        $form->addElement(form_makeCloseTag('h3'));
111        $form->addElement(form_makeOpenTag('div', array('class' => 'multiorphan__result orphan')));
112        $form->addElement(form_makeCloseTag('div'));
113
114        $form->addElement(form_makeOpenTag('h3', array('class' => 'header linked')));
115        $form->addElement($this->getLang('linked'));
116        $form->addElement(form_makeCloseTag('h3'));
117        $form->addElement(form_makeOpenTag('div', array('class' => 'multiorphan__result linked')));
118        $form->addElement(form_makeCloseTag('div'));
119
120        $form->addElement(form_makeCloseTag('div'));
121        $form->endFieldset();
122    }
123}
124
125// vim:ts=4:sw=4:et:
126