/** * Show the form that allows importing a new static product or manual zip file * * @global OutputPage $wgOut * @param PonyDocsProduct $product * @param mixed $manual PonyDocsManual or NULL */ private function showImportForm($product, $manual) { global $wgOut; $productName = $product->getShortName(); $productLongName = $product->getLongName(); $versions = PonyDocsProductVersion::LoadVersionsForProduct($productName); if (!is_null($manual)) { $manualName = $manual->getShortName(); } $wgOut->addHTML('<h3>Import to Version</h3>'); // Only display form if at least one version is defined if (count($versions) > 0) { $action = "/Special:StaticDocImport/{$productName}"; if (!is_null($manual)) { $action .= "/{$manualName}"; } $wgOut->addHTML('<form action="' . $action . '" method="post" enctype="multipart/form-data">' . "\n" . '<label for="archivefile">File to upload:</label>' . '<input id="archivefile" name="archivefile" type="file" />' . '<input type="hidden" name="product" value="' . $productName . '"/>' . "\n"); if (!is_null($manual)) { $wgOut->addHTML('<input type="hidden" name="manual" value="' . $manualName . '"/>' . "\n"); } $wgOut->addHTML('<select name="version">'); foreach ($versions as $version) { $wgOut->addHTML('<option value="' . $version->getVersionName() . '">' . $version->getVersionName() . "</option>\n"); } $wgOut->addHTML("</select>\n"); $wgOut->addHTML('<input type="hidden" name="action" value="add"/>' . "\n" . '<input type="submit" name="submit" value="Submit"/>' . "\n" . '</form>' . "\n"); $wgOut->addHTML("<p>Notes on upload file:</p>\n" . "<ul>\n" . "<li>should be zip format</li>\n" . "<li>verify it does not contain unneeded files: e.g. Mac OS resource, or Windows thumbs, etc.</li>\n" . "<li>requires a index.html file in the root directory</li>\n" . "<li>links to documents within content must be relative for them to work</li>\n" . "<li>may or may not contain sub directories</li>\n" . "<li>may not be bigger than " . ini_get('upload_max_filesize') . "</li>\n" . "</ul>\n"); } else { $wgOut->addHTML("There are currently no versions defined for {$productLongName}." . "In order to upload static documentation please define at least one version and one manual from the" . "links below.\n"); } }