xref: /plugin/dev/www/index.php (revision 89e2f9d12769d43f18c28526a434579f54e63d0b)
1*89e2f9d1SAndreas Gohr<?php
2*89e2f9d1SAndreas Gohrrequire __DIR__ . '/../vendor/autoload.php';
3*89e2f9d1SAndreas Gohr
4*89e2f9d1SAndreas Gohr$WIZ = new dokuwiki\plugin\dev\www\PluginWizard();
5*89e2f9d1SAndreas Gohrtry {
6*89e2f9d1SAndreas Gohr    $archive = $WIZ->handle();
7*89e2f9d1SAndreas Gohr    if($archive) {
8*89e2f9d1SAndreas Gohr        header('Content-Type: application/zip');
9*89e2f9d1SAndreas Gohr        header('Content-Disposition: attachment; filename="plugin.zip"');
10*89e2f9d1SAndreas Gohr        echo $archive;
11*89e2f9d1SAndreas Gohr        exit;
12*89e2f9d1SAndreas Gohr    }
13*89e2f9d1SAndreas Gohr} catch (Exception $e) {
14*89e2f9d1SAndreas Gohr    // FIXME handle errors
15*89e2f9d1SAndreas Gohr}
16*89e2f9d1SAndreas Gohr
17*89e2f9d1SAndreas Gohrheader('Content-Type: text/html; charset=utf-8');
18*89e2f9d1SAndreas Gohr?>
19*89e2f9d1SAndreas Gohr<html lang="en">
20*89e2f9d1SAndreas Gohr<head>
21*89e2f9d1SAndreas Gohr    <title>DokuWiki Plugin Wizard</title>
22*89e2f9d1SAndreas Gohr    <script type="text/javascript">
23*89e2f9d1SAndreas Gohr        const ACTION_EVENTS = <?php echo json_encode($WIZ->getEvents()); ?>;
24*89e2f9d1SAndreas Gohr    </script>
25*89e2f9d1SAndreas Gohr
26*89e2f9d1SAndreas Gohr    <link rel="stylesheet" href="style.css" />
27*89e2f9d1SAndreas Gohr    <link rel="stylesheet" href="awesomplete.css" /
28*89e2f9d1SAndreas Gohr</head>
29*89e2f9d1SAndreas Gohr<body>
30*89e2f9d1SAndreas Gohr<main>
31*89e2f9d1SAndreas Gohr    <h1>DokuWiki Plugin Wizard</h1>
32*89e2f9d1SAndreas Gohr
33*89e2f9d1SAndreas Gohr
34*89e2f9d1SAndreas Gohr    <div class="intro">
35*89e2f9d1SAndreas Gohr        <p>
36*89e2f9d1SAndreas Gohr            This wizard generates a <a href="https://www.dokuwiki.org/devel:plugins">DokuWiki plugin</a>
37*89e2f9d1SAndreas Gohr            skeleton to help you get started with coding your plugin.
38*89e2f9d1SAndreas Gohr            Before using it you should familiarize your self with how plugins in DokuWiki work
39*89e2f9d1SAndreas Gohr            and determine what components your plugin will need.
40*89e2f9d1SAndreas Gohr        </p>
41*89e2f9d1SAndreas Gohr
42*89e2f9d1SAndreas Gohr        <p>
43*89e2f9d1SAndreas Gohr            To use it, fill in the general plugin info and add plugin components. Once you're
44*89e2f9d1SAndreas Gohr            done, click "create" and download your plugin skeleton.
45*89e2f9d1SAndreas Gohr        </p>
46*89e2f9d1SAndreas Gohr
47*89e2f9d1SAndreas Gohr        <p>
48*89e2f9d1SAndreas Gohr            Alternatively you can also use the <a href="https://www.dokuwiki.org/plugin:dev">dev plugin</a>.
49*89e2f9d1SAndreas Gohr            This plugin will also come in handy when editing and extending your plugin later.
50*89e2f9d1SAndreas Gohr        </p>
51*89e2f9d1SAndreas Gohr    </div>
52*89e2f9d1SAndreas Gohr
53*89e2f9d1SAndreas Gohr    <noscript>
54*89e2f9d1SAndreas Gohr        <div class="nojs">
55*89e2f9d1SAndreas Gohr            Sorry, this wizard needs JavaScript to do its magic. It will not work with your
56*89e2f9d1SAndreas Gohr            current setup.
57*89e2f9d1SAndreas Gohr        </div>
58*89e2f9d1SAndreas Gohr    </noscript>
59*89e2f9d1SAndreas Gohr
60*89e2f9d1SAndreas Gohr
61*89e2f9d1SAndreas Gohr    <form action="index.php" method="post" id="ajax__plugin_wiz">
62*89e2f9d1SAndreas Gohr
63*89e2f9d1SAndreas Gohr        <section>
64*89e2f9d1SAndreas Gohr            <div id="plugin_info">
65*89e2f9d1SAndreas Gohr                <h2>Plugin Information</h2>
66*89e2f9d1SAndreas Gohr
67*89e2f9d1SAndreas Gohr                <label>
68*89e2f9d1SAndreas Gohr                    <span>Plugin base name:</span>
69*89e2f9d1SAndreas Gohr                    <input type="text" name="base" required="required" pattern="^[a-z0-9]+$"
70*89e2f9d1SAndreas Gohr                           placeholder="yourplugin">
71*89e2f9d1SAndreas Gohr                    <small>(lowercase, no special chars)</small>
72*89e2f9d1SAndreas Gohr                </label>
73*89e2f9d1SAndreas Gohr
74*89e2f9d1SAndreas Gohr                <label>
75*89e2f9d1SAndreas Gohr                    <span>A short description of what the plugin does:</span>
76*89e2f9d1SAndreas Gohr                    <input type="text" name="desc" required="required"
77*89e2f9d1SAndreas Gohr                           placeholder="A plugin to flurb the blarg">
78*89e2f9d1SAndreas Gohr                </label>
79*89e2f9d1SAndreas Gohr
80*89e2f9d1SAndreas Gohr                <label>
81*89e2f9d1SAndreas Gohr                    <span>Your name:</span>
82*89e2f9d1SAndreas Gohr                    <input type="text" name="author" required="required" placeholder="Jane Doe">
83*89e2f9d1SAndreas Gohr                </label>
84*89e2f9d1SAndreas Gohr
85*89e2f9d1SAndreas Gohr                <label>
86*89e2f9d1SAndreas Gohr                    <span>Your E-Mail address:</span>
87*89e2f9d1SAndreas Gohr                    <input type="text" name="mail" required="required" placeholder="jane@example.com">
88*89e2f9d1SAndreas Gohr                </label>
89*89e2f9d1SAndreas Gohr
90*89e2f9d1SAndreas Gohr                <label>
91*89e2f9d1SAndreas Gohr                    <span>URL for the plugin:</span>
92*89e2f9d1SAndreas Gohr                    <input type="text" name="url" placeholder="https://www.dokuwiki.org/plugin:yourplugin">
93*89e2f9d1SAndreas Gohr                    <small>(leave empty for default dokuwiki.org location)</small>
94*89e2f9d1SAndreas Gohr                </label>
95*89e2f9d1SAndreas Gohr
96*89e2f9d1SAndreas Gohr                <label>
97*89e2f9d1SAndreas Gohr                    <input type="checkbox" name="use_lang" value="1"/>
98*89e2f9d1SAndreas Gohr                    <span>Use localization</span>
99*89e2f9d1SAndreas Gohr                </label>
100*89e2f9d1SAndreas Gohr
101*89e2f9d1SAndreas Gohr                <label>
102*89e2f9d1SAndreas Gohr                    <input type="checkbox" name="use_conf" value="1"/>
103*89e2f9d1SAndreas Gohr                    <span>Use configuration</span>
104*89e2f9d1SAndreas Gohr                </label>
105*89e2f9d1SAndreas Gohr
106*89e2f9d1SAndreas Gohr                <label>
107*89e2f9d1SAndreas Gohr                    <input type="checkbox" name="use_tests" value="1"/>
108*89e2f9d1SAndreas Gohr                    <span>Use unit tests</span>
109*89e2f9d1SAndreas Gohr                </label>
110*89e2f9d1SAndreas Gohr            </div>
111*89e2f9d1SAndreas Gohr
112*89e2f9d1SAndreas Gohr            <div id="plugin_components">
113*89e2f9d1SAndreas Gohr                <h2>Add Plugin Components</h2>
114*89e2f9d1SAndreas Gohr
115*89e2f9d1SAndreas Gohr                <label>
116*89e2f9d1SAndreas Gohr                    <span>Type:</span>
117*89e2f9d1SAndreas Gohr                    <select>
118*89e2f9d1SAndreas Gohr                        <?php foreach ($WIZ->getPluginTypes() as $type): ?>
119*89e2f9d1SAndreas Gohr                            <option value="<?php echo $type ?>"><?php echo ucfirst($type) ?></option>
120*89e2f9d1SAndreas Gohr                        <?php endforeach; ?>
121*89e2f9d1SAndreas Gohr                    </select>
122*89e2f9d1SAndreas Gohr                </label>
123*89e2f9d1SAndreas Gohr
124*89e2f9d1SAndreas Gohr                <label>
125*89e2f9d1SAndreas Gohr                    <span>Add as a Sub-Component:</span>
126*89e2f9d1SAndreas Gohr                    <input type="text" value="" pattern="^[a-z0-9]+$" placeholder="subcomponent"/>
127*89e2f9d1SAndreas Gohr                    <small>(leave empty to add top level)</small>
128*89e2f9d1SAndreas Gohr                </label>
129*89e2f9d1SAndreas Gohr
130*89e2f9d1SAndreas Gohr                <button type="button">Add Component</button>
131*89e2f9d1SAndreas Gohr
132*89e2f9d1SAndreas Gohr                <ul id="output"></ul>
133*89e2f9d1SAndreas Gohr
134*89e2f9d1SAndreas Gohr            </div>
135*89e2f9d1SAndreas Gohr        </section>
136*89e2f9d1SAndreas Gohr
137*89e2f9d1SAndreas Gohr        <button type="submit" name="plugin_wiz_create">Create and Download<br>Plugin Skeleton</button>
138*89e2f9d1SAndreas Gohr
139*89e2f9d1SAndreas Gohr    </form>
140*89e2f9d1SAndreas Gohr
141*89e2f9d1SAndreas Gohr</main>
142*89e2f9d1SAndreas Gohr<script src="awesomplete.min.js"></script>
143*89e2f9d1SAndreas Gohr<script src="script.js"></script>
144*89e2f9d1SAndreas Gohr</body>
145*89e2f9d1SAndreas Gohr</html>
146