* database response model * database collection config * new database scopes * database service update * database execption codes * remove read write permission from database model * updating tests and fixing some bugs * server side tests are now passing * databases api * tests for database endpoint * composer update * fix error * formatting * formatting fixes * get database test * more updates to events and usage * more usage updates * fix delete type * fix test * delete database * more fixes * databaseId in attributes and indexes * more fixes * fix issues * fix index subquery * fix console scope and index query * updating tests as required * fix phpcs errors and warnings * updates to review suggestions * UI progress * ui updates and cleaning up * fix type * rework database events * update tests * update types * event generation fixed * events config updated * updating context to support multiple * realtime updates * fix ids * update context * validator updates * fix naming conflict * fix tests * fix lint errors * fix wprler and realtime tests * fix webhooks test * fix event validator and other tests * formatting fixes * removing leftover var_dumps * remove leftover comment * update usage params * usage metrics updates * update database usage * fix usage * specs update * updates to usage * fix UI and usage * fix lints * internal id fixes * fixes for internal Id * renaming services and related files * rename tests * rename doc link * rename readme * fix test name * tests: fixes for 0.15.x sync Co-authored-by: Torsten Dittmann <torsten.dittmann@googlemail.com>
94 lines
No EOL
4.1 KiB
PHTML
94 lines
No EOL
4.1 KiB
PHTML
<?php
|
|
|
|
use Appwrite\Utopia\View;
|
|
|
|
$collection = $this->getParam('collection', null);
|
|
$collections = $this->getParam('collections', []);
|
|
$rules = $collection->getAttribute('rules', []);
|
|
$key = $this->getParam('key', null);
|
|
$type = $this->getParam('type', null);
|
|
$parent = $this->getParam('parent', true);
|
|
$namespace = $this->getParam('namespace', 'project-document');
|
|
$array = $this->getParam('array', false);
|
|
|
|
?>
|
|
|
|
<?php if($parent): ?>
|
|
<input name="documentId" type="hidden" data-ls-bind="{{router.params.id}}" />
|
|
<input name="collectionId" type="hidden" data-ls-bind="{{router.params.collection}}" />
|
|
<?php else: ?>
|
|
<?php /*<div class="margin-bottom-small text-size-small" data-ls-if="({{<?php echo $this->escape($namespace); ?>.$id}})">
|
|
<span data-ls-bind="Document #{{<?php echo $this->escape($namespace); ?>.$id}}"></span>
|
|
<a data-ls-attrs="href=/console/database/document?id={{<?php echo $this->escape($namespace); ?>.$id}}&collection={{<?php echo $this->escape($namespace); ?>.$collection}}&project={{router.params.project}}" class="pull-end" target="_blank">Edit in a new window <i class="icon-link-ext"></i></a>
|
|
</div>
|
|
<div class="margin-bottom-small text-size-small" data-ls-if="(!{{<?php echo $this->escape($namespace); ?>.$id}})">
|
|
Create a new child document
|
|
</div> */ ?>
|
|
<?php endif; ?>
|
|
|
|
<fieldset name="<?php echo $this->escape($key); ?>"<?php if(!$array): ?> data-cast-to="object"<?php endif; ?> class="<?php if($type === 'document'): ?> info<?php endif; ?>">
|
|
<?php if(!$parent): ?>
|
|
<input name="$id" type="hidden" data-ls-bind="{{<?php echo $this->escape($namespace); ?>.$id}}" />
|
|
<input name="$collection" type="hidden" data-ls-bind="<?php echo $this->escape($collection->getId()); ?>" />
|
|
<input name="$permissions" type="hidden" data-ls-bind="{{<?php echo $this->escape($namespace); ?>.$permissions}}" data-cast-to="json" />
|
|
<?php endif; ?>
|
|
|
|
<ul>
|
|
<?php foreach($rules as $rule):
|
|
$key = $rule['key'] ?? '';
|
|
$label = $rule['label'] ?? '';
|
|
$type = $rule['type'] ?? '';
|
|
$array = $rule['array'] ?? false;
|
|
$required = $rule['required'] ?? false;
|
|
$list = $rule['list'] ?? false;
|
|
$comp = new View(__DIR__.'/rules/'.$type.'.phtml');
|
|
$loop = new View(__DIR__.'/rules/array.phtml');
|
|
|
|
$comp
|
|
->setParam('key', $key)
|
|
->setParam('array', $array)
|
|
->setParam('required', $required)
|
|
->setParam('list', $list)
|
|
->setParam('namespace', $namespace.'.'.$key)
|
|
->setParam('collections', $collections)
|
|
;
|
|
|
|
$loop
|
|
->setParam('type', $type)
|
|
->setParam('key', $key)
|
|
->setParam('array', $array)
|
|
->setParam('required', $required)
|
|
->setParam('list', $list)
|
|
->setParam('namespace', $namespace.'.'.$key)
|
|
->setParam('comp', $comp)
|
|
->setParam('collections', $collections)
|
|
;
|
|
?>
|
|
<li>
|
|
<label class="margin-bottom-no<?php if($type === 'document'): ?> margin-top-large<?php endif; ?>"<?php if($parent): ?> data-forms-nav-anchor="<?php echo $this->escape($key); ?>"<?php endif; ?>>
|
|
<?php echo $this->escape($label); ?>
|
|
|
|
<?php if($array): ?>
|
|
<span class="text-size-small text-fade"> (Array)</span>
|
|
<?php endif; ?>
|
|
|
|
<?php if($required): ?>
|
|
<div class="text-size-xs text-danger text-fade"> required</div>
|
|
<?php endif; ?>
|
|
|
|
<?php if(!$required): ?>
|
|
<div class="text-size-xs text-fade"> optional</div>
|
|
<?php endif; ?>
|
|
</label>
|
|
|
|
<div class="margin-top-small margin-bottom">
|
|
<?php if(!$array): ?>
|
|
<?php echo $comp->render(); ?>
|
|
<?php else: ?>
|
|
<?php echo $loop->render(); ?>
|
|
<?php endif; ?>
|
|
</div>
|
|
</li>
|
|
<?php endforeach; ?>
|
|
</ul>
|
|
</fieldset>
|