show.php (2761B)
1 <?php
2
3 function show_note(
4 string $user,
5 string $category,
6 string $filename
7 ) {
8
9 /* Read Note: if it does not exist yet, use empty string */
10 $content = read_note($user, $category, $filename);
11
12 /* generate old filename. leave empty if there was one */
13 if (!empty($category) && !empty($filename)) {
14 $filepath_t1 = $category . "/" . $filename;
15 } else {
16 $filepath_t1 = "";
17 }
18
19 ?>
20
21 <!-- Show Text Note Form -->
22 <form action="/" target="_self" method="post">
23 <label for="content"><?php echo $GLOBALS["i18n_note"]; ?></label>
24 <textarea id="content" name="content"><?php echo $content; ?></textarea>
25 <label for="category"><?php echo $GLOBALS["i18n_category"]; ?></label>
26 <input
27 id="category"
28 name="category"
29 type="text"
30 value="<?php echo $category; ?>"
31 >
32 <label for="filename"><?php echo $GLOBALS["i18n_filename"]; ?></label>
33 <input
34 id="filename"
35 name="filename"
36 type="text"
37 value="<?php echo $filename; ?>"
38 >
39 <input
40 id="filepath_t1"
41 name="filepath_t1"
42 type="hidden"
43 value="<?php echo $filepath_t1; ?>"
44 >
45 <input
46 id="action"
47 name="action"
48 type="hidden"
49 value="edit"
50 >
51 <input type="submit" value="<?php echo $GLOBALS["i18n_save"]; ?>">
52 </form>
53
54 <!-- delete button -->
55 <form action="/" method="post" id="delete">
56 <input
57 id="category"
58 name="category"
59 type="hidden"
60 value="<?php echo $category; ?>"
61 >
62 <input
63 id="filename"
64 name="filename"
65 type="hidden"
66 value="<?php echo $filename; ?>"
67 >
68 <input
69 id="action"
70 name="action"
71 type="hidden"
72 value="delete"
73 >
74 <input
75 class="danger"
76 type="button"
77 value="<?php echo $GLOBALS["i18n_delete"]; ?>"
78 onclick="deletion_confirm('delete');"
79 >
80 </form>
81
82 <?php
83
84 /* check whether any category is given and print a button for it */
85 if (!empty($category)) {
86
87 ?>
88
89 <!-- related notes -->
90 <div class="related">
91
92 <stretch class="inline"><?php echo $GLOBALS["i18n_related"]; ?>:</stretch>
93
94 <!-- current category button -->
95 <form action="/" method="post" class="inline">
96 <input
97 id="category"
98 name="category"
99 type="hidden"
100 value="<?php echo $category; ?>"
101 >
102 <input
103 id="action"
104 name="action"
105 type="hidden"
106 value="list"
107 >
108 <input
109 class="likenavitem"
110 type="submit"
111 value="<?php echo $category; ?>"
112 >
113 </form>
114
115 </div>
116
117 <?php
118
119 } // if-statement
120
121 } // function
122
123 ?>