From 377b1ecdd0c094995f934dea4bb6a2579d4e8be0 Mon Sep 17 00:00:00 2001 From: Paminger Date: Sun, 19 Jun 2016 19:41:10 +0200 Subject: [PATCH] JSON-Forms --- application/controllers/system/Templates.php | 7 +-- application/views/system/templatesEdit.php | 20 ++++++- application/views/system/templatetextEdit.php | 17 +++++- application/views/templates/header.php | 11 ++++ application/views/widgets/jsoneditor.php | 21 +++++++ application/views/widgets/jsonforms.php | 10 ++++ application/views/widgets/phpjsonform.php | 21 +++++++ application/widgets/jsoneditor_widget.php | 32 ++++++++++ application/widgets/jsonforms_widget.php | 59 +++++++++++++++++++ application/widgets/phpjsonform_widget.php | 32 ++++++++++ composer.json | 29 +++++++++ 11 files changed, 249 insertions(+), 10 deletions(-) create mode 100644 application/views/widgets/jsoneditor.php create mode 100644 application/views/widgets/jsonforms.php create mode 100644 application/views/widgets/phpjsonform.php create mode 100644 application/widgets/jsoneditor_widget.php create mode 100644 application/widgets/jsonforms_widget.php create mode 100644 application/widgets/phpjsonform_widget.php diff --git a/application/controllers/system/Templates.php b/application/controllers/system/Templates.php index 3a16e4ccb..0f64ff9fa 100755 --- a/application/controllers/system/Templates.php +++ b/application/controllers/system/Templates.php @@ -87,6 +87,7 @@ class Templates extends FHC_Controller $data['bezeichnung'] = $this->input->post('bezeichnung', TRUE); $data['anmerkung'] = $this->input->post('anmerkung', TRUE); $data['mimetype'] = $this->input->post('mimetype', TRUE); + $data['attribute'] = $this->input->post('attribute', TRUE); $vorlage = $this->vorlagelib->saveVorlage($vorlage_kurzbz, $data); if ($vorlage->error) show_error($vorlage->retval); @@ -139,13 +140,11 @@ class Templates extends FHC_Controller public function preview($vorlagestudiengang_id) { + $formdata = $this->input->post('formdata', FALSE); + $daten = json_decode($formdata, TRUE); $vorlagetext = $this->vorlagelib->getVorlagetextById($vorlagestudiengang_id); if ($vorlagetext->error) show_error($vorlagetext->retval); - $daten = array - ( - 'vorname' => 'Christian' - ); $data = array ( 'text' => $this->vorlagelib->parseVorlagetext($vorlagetext->retval[0]->text, $daten) diff --git a/application/views/system/templatesEdit.php b/application/views/system/templatesEdit.php index f8bcc9b90..b9197f62c 100644 --- a/application/views/system/templatesEdit.php +++ b/application/views/system/templatesEdit.php @@ -1,18 +1,32 @@ load->view('templates/header', array('title' => 'TemplateEdit')); + $this->load->view('templates/header', array('title' => 'TemplateEdit', 'jsoneditor' => true)); ?>

Vorlage: vorlage_kurzbz; ?>

Bezeichnung: - Anmerkung: + Anmerkung:
+ MimeType:templatelib->widget("mimetype_widget", array('mimetype' => $vorlage->mimetype)); ?> + + Attribute: templatelib->widget("jsoneditor_widget", array('json' => $vorlage->attribute)); ?> + + - +
+ + diff --git a/application/views/system/templatetextEdit.php b/application/views/system/templatetextEdit.php index de6be6dde..b273c54a1 100644 --- a/application/views/system/templatetextEdit.php +++ b/application/views/system/templatetextEdit.php @@ -1,5 +1,5 @@ load->view('templates/header', array('title' => 'TemplateEdit', 'tinymce' => true)); + $this->load->view('templates/header', array('title' => 'TemplateEdit', 'tinymce' => true, 'jsonforms' => true)); ?>
@@ -18,13 +18,24 @@ StudiengangKZ: ?> - +

Preview-Data

- + templatelib->widget("jsonforms_widget", array('id' => 'dataform')); ?> + +
+ +