devsuite/cds/components/Crispage/DevSuite/PackagerComponent.php

123 lines
3.5 KiB
PHP
Raw Normal View History

2024-05-27 00:44:14 -04:00
<?php
namespace Crispage\DevSuite;
defined("ROOT") or die();
use \Crispage\Auth\CorePermissions;
class PackagerComponent extends \Crispage\Framework\Component {
public static function getExtensionInfo(): array {
return [
"id" => "crispage.devsuite.components.packager",
"version" => VERSION,
"package" => "crispage.devsuite",
"cache_policy" => \Crispage\Caching\CacheEngine::POL_NOCACHE
];
}
public function __construct(\Crispage $app, array $data) {
parent::__construct($app, $data);
}
public function render(): void {
?>
<form method="post" action="<?php echo WROOT; ?>/backend" class="cds_form">
<h1><?php ($this->app->i18n)("{%CDS_PACKAGER}"); ?></h1>
<input type="hidden" name="route" value="cds_packager" />
<input type="hidden" name="mode" value="build" />
<hr />
<h2><?php ($this->app->i18n)("{%PACKAGE_INFO}"); ?></h2>
<label for="package">
<?php ($this->app->i18n)("{%PACKAGE_ID}"); ?>
</label>
<input type="text" name="package" required />
<label for="version">
<?php ($this->app->i18n)("{%PACKAGE_VERSION}"); ?>
</label>
<input type="text" name="version" required />
<label for="pdata">
<?php ($this->app->i18n)("{%PACKAGE_DATA}"); ?>
</label>
<textarea name="pdata" rows="8" cols="52" required>generator = CDS <?php echo VERSION; ?></textarea>
<label for="dscripts">
<?php ($this->app->i18n)("{%COPY_DEFAULT_SCRIPTS}"); ?>
</label>
<input type="checkbox" name="dscripts" value="1" checked />
<br />
<label for="dplugins">
<?php ($this->app->i18n)("{%INSTALL_PLUGINS}"); ?>
</label>
<input type="checkbox" name="dplugins" value="1" checked />
<hr />
<h2><?php ($this->app->i18n)("{%REGISTERED_EXTENSIONS}"); ?></h2>
<table>
<thead>
<tr>
<th></th>
<th><?php ($this->app->i18n)("{%PACKAGE}") ?></th>
<th><?php ($this->app->i18n)("{%ID}") ?></th>
<th><?php ($this->app->i18n)("{%VERSION}") ?></th>
<th><?php ($this->app->i18n)("{%TYPE}") ?></th>
<th><?php ($this->app->i18n)("{%CLASS_NAME}") ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($this->data["extensions"] as $ext) { ?>
<tr>
<td><input type="checkbox" name="exts[]" value="<?php echo $ext->id; ?>" <?php if ($ext->package != "crispage.devsuite") echo "checked"; ?> /></td>
<td><?php echo $ext->package; ?></td>
<td><?php echo $ext->id; ?></td>
<td><?php echo $ext->version; ?></td>
<td><?php echo $ext->type; ?></td>
<td><?php echo $ext->classname; ?></td>
</tr>
<?php } ?>
</tbody>
</table>
<hr />
<h2><?php ($this->app->i18n)("{%CODE_DIRECTORIES}"); ?></h2>
<table>
<thead>
<tr>
<th></th>
<th><?php ($this->app->i18n)("{%PATH}") ?></th>
<th><?php ($this->app->i18n)("{%TYPE}") ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($this->data["codedirs"] as $dir) { ?>
<tr>
<td><input type="checkbox" name="cdirs[]" value="<?php echo $dir[0]; ?>" <?php if (str_starts_with($dir[0], "/user")) echo "checked"; ?> /></td>
<td><?php echo $dir[0]; ?></td>
<td><?php echo $dir[1]; ?></td>
</tr>
<?php } ?>
<tr>
<td>
<label for="files">
<?php ($this->app->i18n)("{%ADDITIONAL_FILES}"); ?>
</label>
</td>
<td>
<textarea name="files" rows="8" cols="52"></textarea>
</td>
</tr>
</tbody>
</table>
<hr />
<input type="submit" value="<?php ($this->app->i18n)("{%BUILD_PACKAGE}"); ?>" />
</form>
<?php
}
}
?>