/
form.html.php
75 lines (69 loc) · 1.94 KB
/
form.html.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<h2><?=$this->title($this->_request->action == 'add' ? 'New Paste' : 'Edit Paste'); ?></h2>
<?=$this->form->create($paste, compact('url') + array('method' => 'POST')); ?>
<?php if (isset($paste->id) && isset($paste->rev)): ?>
<?=$this->form->hidden('id'); ?>
<?=$this->form->hidden('rev'); ?>
<?php endif; ?>
<div class="section paste-content">
<?=$this->form->field('content', array(
'type' => 'textarea'
)); ?>
<div class="notice">Pastes are publicly viewable. Paste wisely.</div>
</div>
<div class="section paste-meta">
<?=$this->form->field('author', array(
'label' => 'Author'
)); ?>
<?php
/* Promote most used languages to the top. */
$languages = array(
'bash',
'css',
'diff',
'gettext',
'php',
'powershell',
'ini',
'javascript',
'sql',
'mysql',
'text',
'xml',
'-------------'
) + $languages;
?>
<?=$this->form->field('language', array(
'type' => 'select',
'list' => array_combine($languages, $languages)
)); ?>
<?=$this->form->field('remember', array(
'label' => 'remember',
'type' => 'checkbox',
'checked' => true
)); ?>
<span class="help">Store last used settings.</span>
<?=$this->form->field('private', array(
'type' => 'checkbox',
'label' => 'private'
)); ?>
<span class="help">Will need URL to view paste.</span>
<?php if ((isset($paste->id) && !empty($paste->immutable)) || !isset($paste->id)) : ?>
<?=$this->form->field('immutable', array(
'type' => 'checkbox',
'label' => 'immutable'
)); ?>
<span class="help">Prevents editing of paste.</span>
<?php endif; ?>
<!-- Catch Me If You Can -->
<?=$this->form->text('catch', array(
'style' => 'position:absolute; margin-left: -5000px;'
)); ?>
<?php if (isset($paste->id)): ?>
<?=$this->form->submit('save') ?>
<?=$this->form->submit('save as copy', array('name' => 'copy')); ?>
<?php else: ?>
<?=$this->form->submit('paste this') ?>
<?php endif; ?>
</div>
<div style="clear:both;"></div>
<?=$this->form->end(); ?>