mirror of
https://github.com/godotengine/godot-asset-library.git
synced 2026-02-25 06:33:01 +03:00
255 lines
14 KiB
PHTML
255 lines
14 KiB
PHTML
<?php if(!isset($_asset_values)) {
|
|
$_asset_values = [];
|
|
}
|
|
$_asset_values = array_merge([
|
|
'title' => '',
|
|
'category_id' => '0',
|
|
'godot_version' => '',
|
|
'version_string' => '',
|
|
'download_provider' => '',
|
|
'download_commit' => '',
|
|
'browse_url' => '',
|
|
'issues_url' => '',
|
|
'icon_url' => '',
|
|
'description' => '',
|
|
'cost' => '',
|
|
'previews' => [],
|
|
], $_asset_values);
|
|
?>
|
|
|
|
<div class="form-group">
|
|
<label class="col-md-4 control-label required_mark" for="title">Asset Name</label>
|
|
<div class="col-md-5">
|
|
<input id="title" name="title" type="text" placeholder="One-button game creation tool" class="form-control input-md" required="" value="<?php echo esc($_asset_values['title']) ?>">
|
|
<!-- <span class="help-block">The name of the asset.</span> -->
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label class="col-md-4 control-label required_mark" for="description">Description</label>
|
|
<div class="col-md-5">
|
|
<textarea class="form-control" id="description" name="description" placeholder="This tool allows you to make games with the click of a button. It supports..." required="" rows="7"><?php echo esc($_asset_values['description']) ?></textarea>
|
|
<!-- <span class="help-block">The description which would be visible on the asset page.</span> -->
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label class="col-md-4 control-label required_mark" for="category">Category</label>
|
|
<div class="col-md-5">
|
|
<select id="category" name="category_id" class="form-control" required="">
|
|
<?php if(!$_asset_values['category_id']) { ?>
|
|
<option value="" selected="">
|
|
Select...
|
|
</option>
|
|
<?php } ?>
|
|
<?php foreach($constants['category_type'] as $type => $type_name) if(is_int($type)) { ?>
|
|
<optgroup label="<?php echo esc(ucfirst($type_name . 's')) ?>">
|
|
<?php foreach($categories as $key => $category) if($category['type'] == $type) { ?>
|
|
<option value="<?php echo esc($category['id']) ?>" <?php if($category['id'] == $_asset_values['category_id']) echo 'selected=""'; ?>>
|
|
<?php echo esc($category['name']) ?>
|
|
</option>
|
|
<?php } ?>
|
|
</optgroup>
|
|
<?php } ?>
|
|
</select>
|
|
<!-- <span class="help-block">The category the asset belongs to.</span> -->
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label class="col-md-4 control-label required_mark" for="license">License</label>
|
|
<div class="col-md-5">
|
|
<select id="license" name="cost" class="form-control" required="">
|
|
<?php if(!$_asset_values['cost']) { ?>
|
|
<option value="" selected="">
|
|
Select...
|
|
</option>
|
|
<?php } ?>
|
|
<?php foreach($constants['licenses'] as $id => $name) { ?>
|
|
<option value="<?php echo raw($id) ?>" <?php if($id == $_asset_values['cost']) echo 'selected=""'; ?>>
|
|
<?php echo esc($name) ?>
|
|
</option>
|
|
<?php } ?>
|
|
</select>
|
|
<span class="help-block">The license under which the asset is available. Check <a href="https://opensource.org/licenses">opensource.org</a> for a more detailed description of each. In case an OSI-approved license you are using is missing, please add the license in <a href="https://github.com/godotengine/godot-asset-library/blob/master/src/constants.php">this file</a> and open a pull request.</span>
|
|
<span class="help-block"><strong>Note:</strong> The license you specify here should also be included in the repository you are submitting under a standard name, such as LICENSE or LICENSE.md</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label class="col-md-4 control-label required_mark" for="download_provider">Repository host</label>
|
|
<div class="col-md-5">
|
|
<select id="download_provider" name="download_provider" class="form-control" required="">
|
|
<?php if(!$_asset_values['download_provider']) { ?>
|
|
<option value="" selected="">
|
|
Select...
|
|
</option>
|
|
<?php } ?>
|
|
<?php foreach($constants['download_provider'] as $id => $name) if(is_int($id) && $id >= 0) { ?>
|
|
<option value="<?php echo esc($name) ?>" <?php if($name === $_asset_values['download_provider']) echo 'selected=""'; ?>>
|
|
<?php echo esc($name) ?>
|
|
</option>
|
|
<?php } ?>
|
|
<option value="Custom" <?php if("Custom" == $_asset_values['download_provider']) echo 'selected=""'; ?>>
|
|
Custom
|
|
</option>
|
|
</select>
|
|
<span class="help-block">The site or service hosting your repository.<br>
|
|
The <strong>Custom</strong> download provider can be used to link to premade ZIP archives, such as those uploaded on GitHub Releases. This is useful for GDNative/GDExtension add-ons which contain precompiled binaries. This can also be useful when <a href="https://stackoverflow.com/questions/14783127/git-archive-export-with-submodules-git-archive-all-recursive">including submodules in the ZIP</a> is desired (as submodules are <em>not</em> included in automatically generated ZIPs from GitHub or GitLab).<br>
|
|
If your repository host is missing, you might like to <a href="https://github.com/godotengine/asset-library/issues">open an issue</a> about it.</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label class="col-md-4 control-label required_mark" for="browse">Repository URL</label>
|
|
<div class="col-md-5">
|
|
<input id="browse" name="browse_url" type="text" placeholder="https://host.example/user/repository" class="form-control input-md" required="" value="<?php echo esc($_asset_values['browse_url']) ?>">
|
|
<span class="help-block">The URL you use to browse your repository.</span>
|
|
<span class="help-block"><strong>Note:</strong> Do not give the clone URL (the one that ends in <code>.git</code>), but give the one you use to browse your code.</span>
|
|
<span class="help-block">When using the <strong>Custom</strong> download provider, this is used for browsing only.</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label class="col-md-4 control-label" for="issues">Issues URL</label>
|
|
<div class="col-md-5">
|
|
<input id="issues" name="issues_url" type="text" placeholder="https://host.example/user/repository/issues" class="form-control input-md" value="<?php echo esc($_asset_values['issues_url']) ?>">
|
|
<span class="help-block">Optional, in case you are not using the one supplied by the repository host. Leave empty if unsure.</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label class="col-md-4 control-label required_mark" for="godot_version">Godot version</label>
|
|
<div class="col-md-5">
|
|
<select id="godot_version" name="godot_version" class="form-control" required="">
|
|
<?php if(!$_asset_values['godot_version']) { ?>
|
|
<option value="" selected="">
|
|
Select...
|
|
</option>
|
|
<?php } elseif(!in_array($_asset_values['godot_version'], $constants['common_godot_versions'])) { ?>
|
|
<option value="<?php echo esc($_asset_values['godot_version']) ?>" selected="">
|
|
<?php echo esc(ucfirst($_asset_values['godot_version'])) ?>
|
|
</option>
|
|
<?php } ?>
|
|
<?php foreach($constants['common_godot_versions'] as $version) { ?>
|
|
<option value="<?php echo esc($version) ?>" <?php if($version == $_asset_values['godot_version']) echo 'selected=""'; ?>>
|
|
<?php echo esc(ucfirst(str_replace('_', ' ', $version))) ?>
|
|
</option>
|
|
<?php } ?>
|
|
</select>
|
|
<!-- <span class="help-block">The version of Godot the asset works with.</span> -->
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label class="col-md-4 control-label required_mark" for="version">Asset Version</label>
|
|
<div class="col-md-5">
|
|
<input id="version" name="version_string" type="text" placeholder="e.g. 1.0.0 or 1.0" class="form-control input-md" required="" value="<?php echo esc($_asset_values['version_string']) ?>">
|
|
<!-- <span class="help-block">A human-readable version of the asset, e.g. <code>1.0</code> or <code>1.0.0</code>.</span> -->
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label class="col-md-4 control-label required_mark" for="commit">Download Commit/URL</label>
|
|
<div class="col-md-5">
|
|
<input id="commit" name="download_commit" type="text" placeholder="Git commit hash (or download URL if using Custom download provider)" class="form-control input-md" required="" value="<?php echo esc($_asset_values['download_commit']) ?>">
|
|
<span class="help-block">The commit hash that should be downloaded. Expects 40 or 64 hexadecimal digits <em>fully</em> specifying a Git commit.</span>
|
|
<span class="help-block">When using the <strong>Custom</strong> download provider, this must be set to the full download URL instead of a commit hash.</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label class="col-md-4 control-label required_mark" for="icon">Icon URL</label>
|
|
<div class="col-md-5">
|
|
<input id="icon" name="icon_url" type="text" placeholder="https://host.example/user/repository/raw/icon.(png|jpg)" class="form-control input-md" required="" value="<?php echo esc($_asset_values['icon_url']) ?>">
|
|
</div>
|
|
</div>
|
|
|
|
<?php for ($i=0; $i < count($_asset_values['previews']) + 3; $i++) {
|
|
if($i < count($_asset_values['previews'])) $preview = $_asset_values['previews'][$i];
|
|
else $preview = ['type' => 'image', 'link' => '', 'thumbnail' => ''];
|
|
?>
|
|
<div class="panel panel-default">
|
|
<div class="panel-heading form-inline">
|
|
<div class="text-center">
|
|
<span class="panel-title">
|
|
<?php if($i < count($_asset_values['previews'])) {
|
|
if(isset($preview['edit_preview_id'])) {
|
|
echo 'Revise ' . raw($preview['operation']) . ' operation';
|
|
} else {
|
|
echo 'Update original preview';
|
|
}
|
|
} else {
|
|
echo 'Add preview';
|
|
} ?>
|
|
</span>
|
|
|
|
<?php if($i < count($_asset_values['previews'])) { ?>
|
|
<?php if(isset($preview['edit_preview_id'])) { // Existing edit ?>
|
|
|
|
<input type="hidden" name="previews[<?php echo $i ?>][edit_preview_id]" value="<?php echo esc($preview['edit_preview_id']) ?>">
|
|
<input type="hidden" name="previews[<?php echo $i ?>][enabled]" value="true">
|
|
<label>
|
|
<input type="checkbox" name="previews[<?php echo $i ?>][remove]" value="true">
|
|
Cancel
|
|
</label>
|
|
|
|
<?php } else { // From base asset ?>
|
|
<input type="hidden" name="previews[<?php echo $i ?>][preview_id]" value="<?php echo esc($preview['preview_id']) ?>">
|
|
<label>
|
|
<input type="checkbox" name="previews[<?php echo $i ?>][enabled]" value="true">
|
|
Enable
|
|
</label>
|
|
<label>
|
|
<input type="radio" name="previews[<?php echo $i ?>][operation]" value="update" checked="">
|
|
Update
|
|
</label>
|
|
<label>
|
|
<input type="radio" name="previews[<?php echo $i ?>][operation]" value="remove">
|
|
Remove
|
|
</label>
|
|
|
|
<?php } ?>
|
|
<?php } else { ?>
|
|
<input type="hidden" name="previews[<?php echo $i ?>][operation]" value="insert">
|
|
<label>
|
|
<input type="checkbox" name="previews[<?php echo $i ?>][enabled]" value="true" onchange="document.getElementById('previews[<?php echo $i ?>][link]').required = this.checked;">
|
|
Enable
|
|
</label>
|
|
<?php } ?>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="panel-body">
|
|
<div class="form-group">
|
|
<label class="col-md-4 control-label required_mark" for="previews[<?php echo $i ?>][type]">Type</label>
|
|
<div class="col-md-5">
|
|
<select id="previews[<?php echo $i ?>][type]" name="previews[<?php echo $i ?>][type]" class="form-control">
|
|
<?php $types = ['image' => 'Image', 'video' => 'Video'] ?>
|
|
<?php foreach($types as $id => $name) { ?>
|
|
<option value="<?php echo raw($id) ?>" <?php if($id == $preview['type']) echo 'selected=""'; ?>>
|
|
<?php echo esc($name) ?>
|
|
</option>
|
|
<?php } ?>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label class="col-md-4 control-label required_mark" for="previews[<?php echo $i ?>][link]">Image/YouTube Link</label>
|
|
<div class="col-md-5">
|
|
<input id="previews[<?php echo $i ?>][link]" name="previews[<?php echo $i ?>][link]" type="text" placeholder="Image/YouTube Link" class="form-control input-md" value="<?php echo esc($preview['link']) ?>">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label class="col-md-4 control-label" for="previews[<?php echo $i ?>][thumbnail]">Link to thumbnail</label>
|
|
<div class="col-md-5">
|
|
<input id="previews[<?php echo $i ?>][thumbnail]" name="previews[<?php echo $i ?>][thumbnail]" type="text" placeholder="Image Link" class="form-control input-md" value="<?php echo esc($preview['thumbnail']) ?>">
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
<?php } ?>
|