diff --git a/application/core/FHCAPI_Controller.php b/application/core/FHCAPI_Controller.php index fea4e76f0..e59740ded 100644 --- a/application/core/FHCAPI_Controller.php +++ b/application/core/FHCAPI_Controller.php @@ -89,6 +89,10 @@ class FHCAPI_Controller extends FHC_Controller // For JSON Requests (as opposed to multipart/form-data) get the $_POST variable from the input stream instead if ($this->input->get_request_header('Content-Type', true) == 'application/json') $_POST = json_decode($this->security->xss_clean($this->input->raw_input_stream), true); + elseif (isset($_POST['_jsondata'])) { + $_POST = array_merge($_POST, json_decode($_POST['_jsondata'], true)); + unset($_POST['_jsondata']); + } } @@ -98,7 +102,7 @@ class FHCAPI_Controller extends FHC_Controller /** * @param array $data - * @param string (optional) $type + * @param string $type (optional) * @return void */ public function addError($data, $type = null) @@ -171,6 +175,33 @@ class FHCAPI_Controller extends FHC_Controller exit; } + /** + * @param array $error + * @param string $type (optional) + * @return void + */ + protected function terminateWithError($error, $type = null) + { + $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); + $this->addError($error, $type); + $this->setStatus(self::STATUS_ERROR); + exit; + } + + /** + * @param stdclass $result + * @param string $errortype + * @return void + */ + protected function checkForErrors($result, $errortype = self::ERROR_TYPE_GENERAL) + { + // TODO(chris): IMPLEMENT! + if (isError($result)) { + $this->terminateWithError(getError($result), $errortype); + } + return $result->retval; + } + // TODO(chris): complete list diff --git a/public/js/apps/api/userdata.js b/public/js/apps/api/userdata.js new file mode 100644 index 000000000..defea2cbb --- /dev/null +++ b/public/js/apps/api/userdata.js @@ -0,0 +1,58 @@ +export default { + //! API Calls for Profil Views + + getGemeinden: function(nation,zip=null){ + const url = + FHC_JS_DATA_STORAGE_OBJECT.app_root + + `cis.php/Cis/Profil/getGemeinden`; + return axios.get(url,{params:{nation:nation,zip:zip}}); + }, + + getAllNationen:function(){ + const url = + FHC_JS_DATA_STORAGE_OBJECT.app_root + + `cis.php/Cis/Profil/getAllNationen`; + return axios.get(url); + }, + + getView: function (uid) { + const url = + FHC_JS_DATA_STORAGE_OBJECT.app_root + `cis.php/Cis/Profil/getView/${uid}`; + return axios.get(url); + }, + + sperre_foto_function: function (value) { + const url = + FHC_JS_DATA_STORAGE_OBJECT.app_root + + `cis.php/Cis/Profil/foto_sperre_function/${value}`; + return axios.get(url); + }, + + isStudent: function (uid) { + const url = + FHC_JS_DATA_STORAGE_OBJECT.app_root + + `cis.php/Cis/Profil/isStudent/${uid}`; + return axios.get(url); + }, + + isMitarbeiter: function (uid) { + const url = + FHC_JS_DATA_STORAGE_OBJECT.app_root + + `cis.php/Cis/Profil/isMitarbeiter/${uid}`; + return axios.get(url); + }, + + getZustellAdresse: function () { + const url = + FHC_JS_DATA_STORAGE_OBJECT.app_root + + `cis.php/Cis/Profil/getZustellAdresse`; + return axios.get(url); + }, + + getZustellKontakt: function () { + const url = + FHC_JS_DATA_STORAGE_OBJECT.app_root + + `cis.php/Cis/Profil/getZustellKontakt`; + return axios.get(url); + }, +}; diff --git a/public/js/components/Form/Input.js b/public/js/components/Form/Input.js index 4103c75cf..11ad357a5 100644 --- a/public/js/components/Form/Input.js +++ b/public/js/components/Form/Input.js @@ -120,13 +120,19 @@ export default { if (!c.includes('form-check-input') && !c.includes('btn-check')) classes.push('form-check-input'); break; + case 'color': + if (!c.includes('form-control-color')) + classes.push('form-control-color'); + if (!c.includes('form-control')) + classes.push('form-control'); + break; case 'autocomplete': case 'datepicker': classes.push('p-0'); classes.push('border-0'); - case 'color': - if (!c.includes('form-control-color')) - classes.push('form-control-color'); + if (!c.includes('form-control')) + classes.push('form-control'); + break; case 'text': case 'number': case 'password': @@ -200,13 +206,9 @@ export default { this.valid = valid; // NOTE(chris): On a list of radios/checkboxes only add the feedback message to the last item if (this.name && (this.lcType == 'radio' || this.lcType == 'checkbox')) { - let n = this.$el.nextSibling; - for (; n; n = n.nextSibling) - if (n.nodeType == 1 - && n.__vueParentComponent?.ctx?.lcType == this.lcType - && n.__vueParentComponent?.ctx?.name == this.name - ) - return; + const selector = 'input[type="' + this.lcType + '"][name="' + this.name + '"]'; + if ([...this.$el.parentNode.querySelectorAll(selector)].pop() != this.$refs.input) + return; } this.feedback = feedback; }, diff --git a/public/js/components/Form/Upload/Dms.js b/public/js/components/Form/Upload/Dms.js index da37a2105..fe58fa74b 100644 --- a/public/js/components/Form/Upload/Dms.js +++ b/public/js/components/Form/Upload/Dms.js @@ -75,7 +75,7 @@ export default {