Lines Matching +full:g +full:- +full:touch
6 * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
51 $table = Schema::cleanTableName($INPUT->str('table'));
52 if ($table && $INPUT->bool('save') && checkSecurityToken()) {
53 $builder = new SchemaBuilder($table, $INPUT->arr('schema'));
54 if (!$builder->build()) {
55 msg('something went wrong while saving', -1);
57 touch(action_plugin_struct_cache::getSchemaRefreshFile());
60 if ($table && $INPUT->bool('export')) {
62 header('Content-Type: application/json');
63 header("Content-Disposition: attachment; filename=$table.struct.json");
64 echo $builder->toJSON();
68 if ($table && $INPUT->bool('import')) {
72 msg('Something went wrong with the upload', -1);
75 if (!$builder->build()) {
76 msg('something went wrong while saving', -1);
78 touch(action_plugin_struct_cache::getSchemaRefreshFile());
84 if ($table && $INPUT->bool('importcsv')) {
87 $datatype = $INPUT->str('importtype');
95 $csvImporter->import();
96 msg($this->getLang('admin_csvdone'), 1);
98 msg(hsc($e->getMessage()), -1);
104 if ($table && $INPUT->bool('exportcsv')) {
105 header('Content-Type: text/csv');
106 header('Content-Disposition: attachment; filename="' . $table . '.csv";');
107 new CSVExporter($table, $INPUT->str('exporttype'));
112 if ($table && $INPUT->bool('delete')) {
113 if ($table != $INPUT->str('confirm')) {
114 msg($this->getLang('del_fail'), -1);
118 $schema->delete();
119 msg($this->getLang('del_ok'), 1);
120 touch(action_plugin_struct_cache::getSchemaRefreshFile());
123 msg(hsc($e->getMessage()), -1);
129 if ($table && $INPUT->bool('clear')) {
130 if ($table != $INPUT->str('confirm_clear')) {
131 msg($this->getLang('clear_fail'), -1);
135 $schema->clear();
136 msg($this->getLang('clear_ok'), 1);
137 touch(action_plugin_struct_cache::getSchemaRefreshFile());
140 msg(hsc($e->getMessage()), -1);
147 * Render HTML output, e.g. helpful text and a form
153 $table = Schema::cleanTableName($INPUT->str('table'));
157 echo $this->locale_xhtml('editor_edit');
158 echo '<h2>' . sprintf($this->getLang('edithl'), hsc($table)) . '</h2>';
160 if ($schema->getConfig()['internal']) {
161 echo $this->getLang('internal');
167 …echo '<li class="active"><a href="#plugin__struct_editor">' . $this->getLang('tab_edit') . '</a></…
169 echo '<li><a href="#plugin__struct_json">' . $this->getLang('tab_export') . '</a></li>';
171 … echo '<li><a href="#plugin__struct_delete">' . $this->getLang('tab_delete') . '</a></li>';
176 echo $editor->getEditor();
177 echo $this->htmlJson($schema);
178 echo $this->htmlDelete($schema);
180 echo $this->locale_xhtml('editor_intro');
181 echo $this->htmlNewschema();
193 $form = new Form(['enctype' => 'multipart/form-data', 'id' => 'plugin__struct_json']);
194 $form->setHiddenField('do', 'admin');
195 $form->setHiddenField('page', 'struct_schemas');
196 $form->setHiddenField('table', $schema->getTable());
199 $form->addFieldsetOpen($this->getLang('export'));
200 $form->addButton('export', $this->getLang('btn_export'));
201 $form->addFieldsetClose();
203 $form->addFieldsetOpen($this->getLang('import'));
204 $form->addElement(new InputElement('file', 'schemafile'))->attr('accept', '.json');
205 $form->addButton('import', $this->getLang('btn_import'));
206 $form->addHTML('<p>' . $this->getLang('import_warning') . '</p>');
207 $form->addFieldsetClose();
210 $form->addFieldsetOpen($this->getLang('admin_csvexport'));
211 $form->addTagOpen('legend');
212 $form->addHTML($this->getLang('admin_csvexport_datatype'));
213 $form->addTagClose('legend');
214 $form->addRadioButton('exporttype', $this->getLang('admin_csv_page'))
215 ->val(CSVExporter::DATATYPE_PAGE)
216 ->attr('checked', 'checked')->addClass('edit block');
217 $form->addRadioButton('exporttype', $this->getLang('admin_csv_lookup'))
218 ->val(CSVExporter::DATATYPE_GLOBAL)
219 ->addClass('edit block');
220 $form->addRadioButton('exporttype', $this->getLang('admin_csv_serial'))
221 ->val(CSVExporter::DATATYPE_SERIAL)
222 ->addClass('edit block');
223 $form->addHTML('<br>');
224 $form->addButton('exportcsv', $this->getLang('btn_export'));
225 $form->addFieldsetClose();
227 $form->addFieldsetOpen($this->getLang('admin_csvimport'));
228 $form->addTagOpen('legend');
229 $form->addHTML($this->getLang('admin_csvimport_datatype'));
230 $form->addTagClose('legend');
231 $form->addRadioButton('importtype', $this->getLang('admin_csv_page'))
232 ->val(CSVExporter::DATATYPE_PAGE)
233 ->attr('checked', 'checked')
234 ->addClass('edit block');
235 $form->addRadioButton('importtype', $this->getLang('admin_csv_lookup'))
236 ->val(CSVExporter::DATATYPE_GLOBAL)
237 ->addClass('edit block');
238 $form->addRadioButton('importtype', $this->getLang('admin_csv_serial'))
239 ->val(CSVExporter::DATATYPE_SERIAL)
240 ->addClass('edit block');
241 $form->addHTML('<br>');
242 $form->addElement(new InputElement('file', 'csvfile'))->attr('accept', '.csv');
243 $form->addButton('importcsv', $this->getLang('btn_import'));
244 $form->addCheckbox('createPage', 'Create missing pages')->addClass('block edit');
245 $form->addHTML(
247 $this->getLang('admin_csvhelp') . '</a></p>'
249 $form->addFieldsetClose();
251 return $form->toHTML();
263 $form->setHiddenField('do', 'admin');
264 $form->setHiddenField('page', 'struct_schemas');
265 $form->setHiddenField('table', $schema->getTable());
267 $form->addFieldsetOpen($this->getLang('btn_delete'));
268 $form->addHTML($this->locale_xhtml('delete_intro'));
269 $form->addTextInput('confirm', $this->getLang('del_confirm'));
270 $form->addButton('delete', $this->getLang('btn_delete'));
271 $form->addFieldsetClose();
273 $form->addFieldsetOpen($this->getLang('btn_clear'));
274 $form->addHTML($this->locale_xhtml('clear_intro'));
275 $form->addTextInput('confirm_clear', $this->getLang('clear_confirm'));
276 $form->addButton('clear', $this->getLang('btn_clear'));
277 $form->addFieldsetClose();
279 return $form->toHTML();
290 $form->addClass('struct_newschema');
291 $form->addFieldsetOpen($this->getLang('create'));
292 $form->setHiddenField('do', 'admin');
293 $form->setHiddenField('page', 'struct_schemas');
294 $form->addTextInput('table', $this->getLang('schemaname'));
295 $form->addButton('', $this->getLang('save'));
296 …$form->addHTML('<p>' . $this->getLang('createhint') . '</p>'); // FIXME is that true? we probably …
297 $form->addFieldsetClose();
298 return $form->toHTML();
315 $toc[] = html_mktocitem($link, $this->getLang('menu_assignments'), 0, '');
320 $toc[] = html_mktocitem($slink, $this->getLang('menu'), 0, '');
325 if ($schema->isInternal()) continue;
326 $table = $schema->getTable();