From ca667feb0dc76276c0f3025a368366a2155332f5 Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Mon, 20 Jun 2022 18:55:29 +0200 Subject: [PATCH 01/11] Added document type "Grant Agreement" for syncing of documents with Mobility Online --- system/dbupdate_3.3.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/system/dbupdate_3.3.php b/system/dbupdate_3.3.php index 7965a0518..cfa0ca8b0 100644 --- a/system/dbupdate_3.3.php +++ b/system/dbupdate_3.3.php @@ -6244,6 +6244,20 @@ if($result = @$db->db_query("SELECT 1 FROM system.tbl_berechtigung WHERE berecht } } +// Insert document type Grant Agreement +if($result = @$db->db_query("SELECT 1 FROM public.tbl_dokument WHERE dokument_kurzbz = 'GrantAgr';")) +{ + if($db->db_num_rows($result) == 0) + { + $qry = "INSERT INTO public.tbl_dokument(dokument_kurzbz, bezeichnung, bezeichnung_mehrsprachig) VALUES('GrantAgr', 'Grant Agreement', '{\"Grant Agreement\",\"Grant Agreement\"}');"; + + if(!$db->db_query($qry)) + echo 'public.tbl_dokument '.$db->db_last_error().'
'; + else + echo 'public.tbl_dokument: Added value \'GrantAgr\'
'; + } +} + // *** Pruefung und hinzufuegen der neuen Attribute und Tabellen echo '

Pruefe Tabellen und Attribute!

'; From 500bbec2c159af10e273ef9ac2f50aaff04345a3 Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Tue, 28 Jun 2022 19:07:09 +0200 Subject: [PATCH 02/11] added "hasSequence" = false to crm/Dokumentprestudent_model to avoid "lastval not found" error --- application/models/crm/Dokumentprestudent_model.php | 1 + 1 file changed, 1 insertion(+) diff --git a/application/models/crm/Dokumentprestudent_model.php b/application/models/crm/Dokumentprestudent_model.php index ab4764479..0a6669359 100644 --- a/application/models/crm/Dokumentprestudent_model.php +++ b/application/models/crm/Dokumentprestudent_model.php @@ -10,6 +10,7 @@ class Dokumentprestudent_model extends DB_Model parent::__construct(); $this->dbTable = 'public.tbl_dokumentprestudent'; $this->pk = array('prestudent_id', 'dokument_kurzbz'); + $this->hasSequence = false; } /** From 0055243a64a19b548c8b09196fdb81b6514eb2b6 Mon Sep 17 00:00:00 2001 From: KarpAlex Date: Wed, 27 Jul 2022 01:52:08 +0200 Subject: [PATCH 03/11] DmsLib: replaced _writeFile function with _copyFile to copy all file in one go (php copy method) instead of reading blocks and writing them --- application/libraries/DmsLib.php | 287 +++++++++++++------------------ 1 file changed, 118 insertions(+), 169 deletions(-) diff --git a/application/libraries/DmsLib.php b/application/libraries/DmsLib.php index b2c53a7d9..fccfe503b 100644 --- a/application/libraries/DmsLib.php +++ b/application/libraries/DmsLib.php @@ -50,62 +50,57 @@ class DmsLib $kategorie_kurzbz = null, $dokument_kurzbz = null, $beschreibung = null, $cis_suche = false, $schlagworte = null ) { - // write file with content of fileHandle - $writeFileResult = $this->_writeNewFile($name, $fileHandle); + // create unique filename, using original document name to detect file extension + $filename = $this->_getUniqueFilename($name); - if (isError($writeFileResult)) return $writeFileResult; + // copy file from fileHandle to dms folder + $copyFileResult = $this->_copyFile($fileHandle, $filename); - if (hasData($writeFileResult)) + if (isError($copyFileResult)) return $copyFileResult; + + // if file written successful, insert dms + $dmsResult = $this->_ci->DmsModel->insert( + array( + 'kategorie_kurzbz' => $kategorie_kurzbz, + 'dokument_kurzbz' => $dokument_kurzbz + ) + ); + + if (isError($dmsResult)) return $dmsResult; + + if (hasData($dmsResult)) { - $writeFileData = getData($writeFileResult); - $filename = $writeFileData->filename; + $dms_id = getData($dmsResult); + $version = 0; - // if file written successful, insert dms - $dmsResult = $this->_ci->DmsModel->insert( - array( - 'kategorie_kurzbz' => $kategorie_kurzbz, - 'dokument_kurzbz' => $dokument_kurzbz - ) + // insert dms version + $dmsVersion = array( + 'dms_id' => $dms_id, + 'version' => $version, + 'filename' => $filename, + 'mimetype' => $mimetype, + 'name' => $name, + 'beschreibung' => $beschreibung, + 'cis_suche' => $cis_suche, + 'schlagworte' => $schlagworte, + 'insertvon' => $this->_who, + 'insertamum' => date('Y-m-d H:i:s') ); - if (isError($dmsResult)) return $dmsResult; + $dmsVersionResult = $this->_ci->DmsVersionModel->insert($dmsVersion); - if (hasData($dmsResult)) - { - $dms_id = getData($dmsResult); - $version = 0; + if (isError($dmsVersionResult)) return $dmsVersionResult; - // insert dms version - $dmsVersion = array( - 'dms_id' => $dms_id, - 'version' => $version, - 'filename' => $filename, - 'mimetype' => $mimetype, - 'name' => $name, - 'beschreibung' => $beschreibung, - 'cis_suche' => $cis_suche, - 'schlagworte' => $schlagworte, - 'insertvon' => $this->_who, - 'insertamum' => date('Y-m-d H:i:s') - ); + // return dms info + $resObj = new stdClass(); + $resObj->dms_id = $dms_id; + $resObj->version = $version; + $resObj->filename = $filename; - $dmsVersionResult = $this->_ci->DmsVersionModel->insert($dmsVersion); - - if (isError($dmsVersionResult)) return $dmsVersionResult; - - // return dms info - $resObj = new stdClass(); - $resObj->dms_id = $dms_id; - $resObj->version = $version; - $resObj->filename = $filename; - - return success($resObj); - } - else - return error("error when inserting DMS"); + return success($resObj); } else - return error("file could not be written"); + return error("error when inserting DMS"); } /** @@ -125,46 +120,41 @@ class DmsLib $originalName = isset($name) ? $name : $lastVersion->name; - // write new file with content of fileHandle - $writeFileResult = $this->_writeNewFile($originalName, $fileHandle); + // create unique filename, using original document name to detect file extension + $filename = $this->_getUniqueFilename($originalName); - if (isError($writeFileResult)) return $writeFileResult; + // copy file from fileHandle to dms folder + $copyFileResult = $this->_copyFile($fileHandle, $filename); - if (hasData($writeFileResult)) - { - $writeFileData = getData($writeFileResult); - $filename = $writeFileData->filename; + if (isError($copyFileResult)) return $copyFileResult; - // insert new version - $newVersionNumber = $lastVersion->version + 1; + // insert new version + $newVersionNumber = $lastVersion->version + 1; - // if new parameters given, use them, otherwise use parameters from last version - $newVersion = array( - 'dms_id' => $dms_id, - 'name' => $originalName, - 'filename' => $filename, - 'version' => $newVersionNumber, - 'mimetype' => isset($mimetype) ? $mimetype : $lastVersion->mimetype, - 'beschreibung' => isset($beschreibung) ? $beschreibung : $lastVersion->beschreibung, - 'cis_suche' => isset($cis_suche) ? $cis_suche : $lastVersion->cis_suche, - 'schlagworte' => isset($schlagworte) ? $schlagworte : $lastVersion->schlagworte, - 'insertvon' => $this->_who, - 'insertamum' => date('Y-m-d H:i:s') - ); + // if new parameters given, use them, otherwise use parameters from last version + $newVersion = array( + 'dms_id' => $dms_id, + 'name' => $originalName, + 'filename' => $filename, + 'version' => $newVersionNumber, + 'mimetype' => isset($mimetype) ? $mimetype : $lastVersion->mimetype, + 'beschreibung' => isset($beschreibung) ? $beschreibung : $lastVersion->beschreibung, + 'cis_suche' => isset($cis_suche) ? $cis_suche : $lastVersion->cis_suche, + 'schlagworte' => isset($schlagworte) ? $schlagworte : $lastVersion->schlagworte, + 'insertvon' => $this->_who, + 'insertamum' => date('Y-m-d H:i:s') + ); - $addVersionResult = $this->_ci->DmsVersionModel->insert($newVersion); + $addVersionResult = $this->_ci->DmsVersionModel->insert($newVersion); - if (isError($addVersionResult)) return $addVersionResult; + if (isError($addVersionResult)) return $addVersionResult; - // return dms info - $resObj = new stdClass(); - $resObj->version = $newVersionNumber; - $resObj->filename = $filename; + // return dms info + $resObj = new stdClass(); + $resObj->version = $newVersionNumber; + $resObj->filename = $filename; - return success($resObj); - } - else - return error("file could not be written"); + return success($resObj); } else return error("last version not found"); @@ -185,44 +175,37 @@ class DmsLib if (hasData($lastVersionResult)) { $lastVersion = getData($lastVersionResult); + $filename = $lastVersion->filename; // update file in filesystem - $writeFileResult = $this->_writeFile($lastVersion->filename, $fileHandle); + $copyFileResult = $this->_copyFile($fileHandle, $filename); - if (isError($writeFileResult)) return $writeFileResult; + if (isError($copyFileResult)) return $copyFileResult; - if (hasData($writeFileResult)) - { - $writeFileData = getData($writeFileResult); - $filename = $writeFileData->filename; + // if new parameters given, use them, otherwise use parameters from last version + $newVersion = array( + 'name' => isset($name) ? $name : $lastVersion->name, + 'filename' => $filename, + 'mimetype' => isset($mimetype) ? $mimetype : $lastVersion->mimetype, + 'beschreibung' => isset($beschreibung) ? $beschreibung : $lastVersion->beschreibung, + 'cis_suche' => isset($cis_suche) ? $cis_suche : $lastVersion->cis_suche, + 'schlagworte' => isset($schlagworte) ? $schlagworte : $lastVersion->schlagworte, + ); - // if new parameters given, use them, otherwise use parameters from last version - $newVersion = array( - 'name' => isset($name) ? $name : $lastVersion->name, - 'filename' => $filename, - 'mimetype' => isset($mimetype) ? $mimetype : $lastVersion->mimetype, - 'beschreibung' => isset($beschreibung) ? $beschreibung : $lastVersion->beschreibung, - 'cis_suche' => isset($cis_suche) ? $cis_suche : $lastVersion->cis_suche, - 'schlagworte' => isset($schlagworte) ? $schlagworte : $lastVersion->schlagworte, - ); + // update last dms version + $addVersionResult = $this->_ci->DmsVersionModel->update( + array($dms_id, $lastVersion->version), + $newVersion + ); - // update last dms version - $addVersionResult = $this->_ci->DmsVersionModel->update( - array($dms_id, $lastVersion->version), - $newVersion - ); + if (isError($addVersionResult)) return $addVersionResult; - if (isError($addVersionResult)) return $addVersionResult; + // return dms info + $resObj = new stdClass(); + $resObj->version = $lastVersion->version; + $resObj->filename = $filename; - // return dms info - $resObj = new stdClass(); - $resObj->version = $lastVersion->version; - $resObj->filename = $filename; - - return success($resObj); - } - else - return error("file could not be written"); + return success($resObj); } else return error("last version not found"); @@ -441,68 +424,35 @@ class DmsLib // Private methods /** - * Writes file with content of fileHandle using original document name for file extension + * Copies file from sourceFileHandle to destinationFilename in DMS folder + * Returns success or error on fail */ - private function _writeNewFile($originalName, $fileHandle) + private function _copyFile($sourceFileHandle, $destinationFilename) { - // create unique filename, using original document name to detect file extension - $filename = $this->_getUniqueFilename($originalName); + // get file location from file handle + $metaData = stream_get_meta_data($sourceFileHandle); - // write the file - return $this->_writeFile($filename, $fileHandle); - } - - /** - * Writes file with content of fileHandle - * Returns number of bytes written and filename - */ - private function _writeFile($filename, $fileHandle) - { - // file content provided by fileHandle - $fileContent = ''; - - $readBlockResult = success(); - - // While the end of the file is not reached and the read does not fail - while (!feof($fileHandle) && isSuccess($readBlockResult = $this->_ci->DmsFSModel->readBlock($fileHandle))) + if (isset($metaData['uri']) && !isEmptyString($metaData['uri'])) { - // Concatenate the content of the file - $fileContent .= getData($readBlockResult); + // if file location determined, copy file + $source = $metaData['uri']; + + if (copy($source, DMS_PATH.$destinationFilename)) + { + return success(); + } + else + { + // error if copy returned false + return error('error occured while copying file'); + } } - - // If an error occurred while reading then return it - if (isError($readBlockResult)) return $readBlockResult; - - // open file for writing - $openFileResult = $this->_ci->DmsFSModel->openReadWrite($filename); - - if (isError($openFileResult)) return $openFileResult; - - if (!hasData($openFileResult)) return error("File could not be opened"); - - $newFileHandle = getData($openFileResult); - - // write file - $writeFileResult = $this->_ci->DmsFSModel->write($newFileHandle, $fileContent); - - if (isError($writeFileResult)) return $writeFileResult; - - // return number of bytes written and filename - $resObj = new stdClass(); - $resObj->bytesWritten = 0; - $resObj->filename = ''; - - if (hasData($writeFileResult)) + else { - $resObj->bytesWritten = getData($writeFileResult); - $resObj->filename = $filename; + // error when source location could not be determined + return error('error occured while getting source file name'); } - // close handle - $closeResult = $this->_ci->DmsFSModel->close($newFileHandle, $fileContent); - - if (isError($closeResult)) return $closeResult; - return success($resObj); } @@ -527,7 +477,7 @@ class DmsLib // ----------------------------------------------------------------------------------------------------------- // Deprecated methods, not to be used - + /** * Load a DMS Document. * If no version is particularly given, the latest version is loaded. @@ -543,7 +493,7 @@ class DmsLib $this->_ci->DmsModel->addJoin('campus.tbl_dms_version', 'dms_id'); $this->_ci->DmsModel->addOrder('version', 'DESC'); $this->_ci->DmsModel->addLimit(1); - + if (!is_numeric($version)) { return $this->_ci->DmsModel->load($dms_id); @@ -620,7 +570,7 @@ class DmsLib return $result; } - + /** * Uploads a document and saves it to DMS * @param $dms DMS assoc array @@ -659,7 +609,7 @@ class DmsLib // Return result of uploaded data return success($upload_data); } - + /** * Download a document. * @@ -678,7 +628,7 @@ class DmsLib if (hasData($fileInfoResult)) { $fileObj = getData($fileInfoResult); - + // Change filename, if filename is provided if (!isEmptyString($filename)) $fileObj->name = $filename; @@ -694,7 +644,7 @@ class DmsLib // If no data have been found then return an empty success return success(); } - + /** * Get file information. * @@ -706,7 +656,7 @@ class DmsLib { // Checks the dms_id parameter if (!is_numeric($dms_id)) return error('Wrong parameter'); - + // Load DMS from database $result = $this->load($dms_id, $version); if (isError($result)) return error(getError($result)); @@ -951,4 +901,3 @@ class DmsLib $this->_ci->upload->initialize($config); } } - From 259dbe9bdc5f9526ab7dbd08b73fa1752a0b2b2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96sterreicher?= Date: Mon, 5 Sep 2022 18:46:13 +0200 Subject: [PATCH 04/11] Fixed Error on File Download from Student View --- .../lehre/anrechnung/RequestAnrechnung.php | 105 +++++++++--------- 1 file changed, 54 insertions(+), 51 deletions(-) diff --git a/application/controllers/lehre/anrechnung/RequestAnrechnung.php b/application/controllers/lehre/anrechnung/RequestAnrechnung.php index bc8ab562e..2e9726c82 100644 --- a/application/controllers/lehre/anrechnung/RequestAnrechnung.php +++ b/application/controllers/lehre/anrechnung/RequestAnrechnung.php @@ -6,13 +6,13 @@ class requestAnrechnung extends Auth_Controller { const REQUEST_ANRECHNUNG_URI = '/lehre/anrechnung/RequestAnrechnung'; const APPROVE_ANRECHNUNG_URI = '/lehre/anrechnung/ApproveAnrechnungUebersicht'; - + const ANRECHNUNGSTATUS_PROGRESSED_BY_STGL = 'inProgressDP'; const ANRECHNUNGSTATUS_PROGRESSED_BY_KF = 'inProgressKF'; const ANRECHNUNGSTATUS_PROGRESSED_BY_LEKTOR = 'inProgressLektor'; const ANRECHNUNGSTATUS_APPROVED = 'approved'; const ANRECHNUNGSTATUS_REJECTED = 'rejected'; - + public function __construct() { // Set required permissions @@ -23,25 +23,25 @@ class requestAnrechnung extends Auth_Controller 'download' => 'student/anrechnung_beantragen:rw', ) ); - + // Load models $this->load->model('education/Anrechnung_model', 'AnrechnungModel'); $this->load->model('content/DmsVersion_model', 'DmsVersionModel'); - + // Load libraries $this->load->library('WidgetLib'); $this->load->library('PermissionLib'); $this->load->library('AnrechnungLib'); $this->load->library('DmsLib'); - + // Load helpers $this->load->helper('form'); $this->load->helper('url'); $this->load->helper('hlp_sancho_helper'); - + // Load configs $this->load->config('anrechnung'); - + // Load language phrases $this->loadPhrases( array( @@ -52,59 +52,59 @@ class requestAnrechnung extends Auth_Controller 'lehre' ) ); - + $this->_setAuthUID(); - + $this->setControllerId(); } - + public function index() { $studiensemester_kurzbz = $this->input->get('studiensemester'); $lehrveranstaltung_id = $this->input->get('lv_id'); - + if (isEmptyString($lehrveranstaltung_id) || isEmptyString($studiensemester_kurzbz)) { show_error('Missing correct parameter'); } - + // Exit if user is not a student $result = $this->StudentModel->load(array('student_uid' => $this->_uid)); - + if (!hasData($result)) { show_error('Cant load user'); } - + // Get Prestudent ID $prestudent_id = getData($result)[0]->prestudent_id; - + // Check if application deadline is expired $is_expired = self::_isExpired( $this->config->item('submit_application_start'), $this->config->item('submit_application_end'), $studiensemester_kurzbz ); - + // Check if Lehrveranstaltung was already graded with application blocking grades $is_blocked = self::_LVhasBlockingGrades($studiensemester_kurzbz, $lehrveranstaltung_id); - + // Get Anrechung data $anrechnungData = $this->anrechnunglib->getAnrechnungDataByLv($lehrveranstaltung_id, $studiensemester_kurzbz, $prestudent_id); // Get Antrag data $antragData = $this->anrechnunglib->getAntragData($prestudent_id, $studiensemester_kurzbz, $lehrveranstaltung_id); - + $viewData = array( 'antragData' => $antragData, 'anrechnungData' => $anrechnungData, 'is_expired' => $is_expired, 'is_blocked' => $is_blocked ); - + $this->load->view('lehre/anrechnung/requestAnrechnung.php', $viewData); } - + /** * Apply Anrechnungsantrag and send to STGL */ @@ -129,35 +129,35 @@ class requestAnrechnung extends Auth_Controller { return $this->outputJsonError($this->p->t('ui', 'errorFelderFehlen')); } - + if (isEmptyString($bestaetigung)) { return $this->outputJsonError($this->p->t('ui', 'errorBestaetigungFehlt')); } - + // Exit if user is not a student $result = $this->StudentModel->load(array('student_uid' => $this->_uid)); - + if (!hasData($result)) { return $this->outputJsonError('Cant load user'); } - + // Get Prestudent ID $prestudent_id = getData($result)[0]->prestudent_id; - + // Exit if application already exists if (self::_applicationExists($lehrveranstaltung_id, $studiensemester_kurzbz, $prestudent_id)) { return $this->outputJsonError($this->p->t('anrechnung', 'antragBereitsGestellt')); } - + // Exit if application is not for actual studysemester if (!self::_applicationIsForActualSS($studiensemester_kurzbz)) { return $this->outputJsonError($this->p->t('anrechnung', 'antragNurImAktSS')); } - + // Upload document $result = self::_uploadFile(); @@ -165,10 +165,10 @@ class requestAnrechnung extends Auth_Controller { return $this->outputJsonError($result->retval); } - + // Hold just inserted DMS ID $lastInsert_dms_id = $result->retval['dms_id']; - + // Save Anrechnung and Anrechnungstatus $result = $this->AnrechnungModel->createAnrechnungsantrag( $prestudent_id, @@ -178,12 +178,12 @@ class requestAnrechnung extends Auth_Controller $lastInsert_dms_id, $anmerkung ); - + if (isError($result)) { $this->terminateWithJsonError(getError($result)); } - + // Output to AJAX $this->outputJsonSuccess(array( 'antragdatum' => (new DateTime())->format('d.m.Y'), @@ -206,6 +206,9 @@ class requestAnrechnung extends Auth_Controller // Check if user is entitled to read dms doc $this->_checkIfEntitledToReadDMSDoc($dms_id); + + // Set filename to be used on downlaod + $filename = $this->anrechnunglib->setFilenameOnDownload($dms_id); // Get file to be downloaded from DMS $download = $this->dmslib->download($dms_id, $filename); @@ -221,10 +224,10 @@ class requestAnrechnung extends Auth_Controller private function _setAuthUID() { $this->_uid = getAuthUID(); - + if (!$this->_uid) show_error('User authentification failed'); } - + /** * Check if application deadline is expired. * @@ -237,7 +240,7 @@ class requestAnrechnung extends Auth_Controller private function _isExpired($start, $ende, $studiensemester_kurzbz) { $this->load->model('organisation/Studiensemester_model', 'StudiensemesterModel'); - + // If start is not given, set to Semesterstart. if (!isset($start) || isEmptyString($start)) { @@ -245,7 +248,7 @@ class requestAnrechnung extends Auth_Controller $result = $this->StudiensemesterModel->load($studiensemester_kurzbz); $start = getData($result)[0]->start; } - + // If ende is not given, set to Semesterende. if (!isset($ende) || isEmptyString($ende)) { @@ -253,15 +256,15 @@ class requestAnrechnung extends Auth_Controller $result = $this->StudiensemesterModel->load($studiensemester_kurzbz); $ende = getData($result)[0]->ende; } - + $today = new DateTime('today midnight'); $start = new DateTime($start); $ende = new DateTime($ende); - + // True if expired return ($today < $start || $today > $ende); } - + /** * Check if user is entitled to read dms doc. * @@ -273,9 +276,9 @@ class requestAnrechnung extends Auth_Controller { show_error('Failed loading Student'); } - + $result = $this->AnrechnungModel->loadWhere(array('dms_id' => $dms_id)); - + if($result = getData($result)[0]) { if ($result->prestudent_id == $student->prestudent_id) @@ -283,10 +286,10 @@ class requestAnrechnung extends Auth_Controller return; } } - + show_error('You are not entitled to read this document'); } - + /** * Check if application already exists. * @@ -302,15 +305,15 @@ class requestAnrechnung extends Auth_Controller 'studiensemester_kurzbz' => $studiensemester_kurzbz, 'prestudent_id' => $prestudent_id )); - + if (isError($result)) { show_error(getError($result)); } - + return hasData($result); } - + /** * Check if applications' study semester is actual study semester. * @@ -322,10 +325,10 @@ class requestAnrechnung extends Auth_Controller $this->load->model('organisation/Studiensemester_model', 'StudiensemesterModel'); $result = $this->StudiensemesterModel->getNearest(); $actual_ss = getData($result)[0]->studiensemester_kurzbz; - + return $studiensemester_kurzbz == $actual_ss; } - + private function _LVhasBlockingGrades($studiensemester_kurzbz, $lehrveranstaltung_id) { // Get Note of Lehrveranstaltung @@ -336,12 +339,12 @@ class requestAnrechnung extends Auth_Controller 'lehrveranstaltung_id' => $lehrveranstaltung_id ) ); - + // If Lehrveranstaltung has Note if (hasData($result)) { $note = getData($result)[0]->note; - + // Check if Note is a blocking grade if (in_array($note, $this->config->item('grades_blocking_application'))) { @@ -350,7 +353,7 @@ class requestAnrechnung extends Auth_Controller } return false; } - + /** * Upload file via DMS library. * @@ -367,7 +370,7 @@ class requestAnrechnung extends Auth_Controller 'insertamum' => (new DateTime())->format('Y-m-d H:i:s'), 'insertvon' => $this->_uid ); - + // Upload document return $this->dmslib->upload($dms, 'uploadfile', array('pdf')); } From c88061463f3a3eb38faf918821ec8b9f931d2eca Mon Sep 17 00:00:00 2001 From: Cris Date: Tue, 6 Sep 2022 14:21:54 +0200 Subject: [PATCH 05/11] =?UTF-8?q?Hotfix=20Anrechnung=20Student=20View:=20?= =?UTF-8?q?=C3=84nderung=20des=20Download-Dokumentnamens=20zur=C3=BCckgeno?= =?UTF-8?q?mmen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Der Download-Dokumentname ist in der Studierendenansicht nun wieder gleich wie der originale Dokuementname beim Hochladen. --- .../lehre/anrechnung/RequestAnrechnung.php | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/application/controllers/lehre/anrechnung/RequestAnrechnung.php b/application/controllers/lehre/anrechnung/RequestAnrechnung.php index 2e9726c82..964dae246 100644 --- a/application/controllers/lehre/anrechnung/RequestAnrechnung.php +++ b/application/controllers/lehre/anrechnung/RequestAnrechnung.php @@ -206,16 +206,13 @@ class requestAnrechnung extends Auth_Controller // Check if user is entitled to read dms doc $this->_checkIfEntitledToReadDMSDoc($dms_id); - - // Set filename to be used on downlaod - $filename = $this->anrechnunglib->setFilenameOnDownload($dms_id); // Get file to be downloaded from DMS - $download = $this->dmslib->download($dms_id, $filename); - if (isError($download)) return $download; + $download = $this->dmslib->download($dms_id); + if (isError($download)) return $download; - // Download file - $this->outputFile(getData($download)); + // Download file + $this->outputFile(getData($download)); } /** From 522e341d3dcb32d7916178a22f598c950f5d039d Mon Sep 17 00:00:00 2001 From: Cris Date: Tue, 6 Sep 2022 15:29:42 +0200 Subject: [PATCH 06/11] Dashboard Test V1 --- application/controllers/Test.php | 51 +++++ .../api/v1/dashboard/Dashboard.php | 54 +++++ .../controllers/api/v1/dashboard/User.php | 89 ++++++++ .../models/dashboard/Dashboard_model.php | 18 ++ .../dashboard/Dashboardpreset_model.php | 28 +++ .../dashboard/Dashboardwidget_model.php | 29 +++ application/models/dashboard/Widget_model.php | 18 ++ application/views/test/Test.php | 63 ++++++ public/js/apps/Test.js | 15 ++ public/js/components/CoreDashboard.js | 206 ++++++++++++++++++ public/js/components/DBW/KPI.js | 26 +++ public/js/components/Dashboard/DragAndDrop.js | 139 ++++++++++++ public/js/components/Dashboard/Item.js | 52 +++++ 13 files changed, 788 insertions(+) create mode 100644 application/controllers/Test.php create mode 100644 application/controllers/api/v1/dashboard/Dashboard.php create mode 100644 application/controllers/api/v1/dashboard/User.php create mode 100644 application/models/dashboard/Dashboard_model.php create mode 100644 application/models/dashboard/Dashboardpreset_model.php create mode 100644 application/models/dashboard/Dashboardwidget_model.php create mode 100644 application/models/dashboard/Widget_model.php create mode 100644 application/views/test/Test.php create mode 100644 public/js/apps/Test.js create mode 100644 public/js/components/CoreDashboard.js create mode 100644 public/js/components/DBW/KPI.js create mode 100644 public/js/components/Dashboard/DragAndDrop.js create mode 100644 public/js/components/Dashboard/Item.js diff --git a/application/controllers/Test.php b/application/controllers/Test.php new file mode 100644 index 000000000..aa21f6296 --- /dev/null +++ b/application/controllers/Test.php @@ -0,0 +1,51 @@ + 'user:r', + ) + ); + + $this->load->library('AuthLib'); + $this->load->library('WidgetLib'); + + $this->_setAuthUID(); // sets property uid + + $this->setControllerId(); // sets the controller id + } + + // ----------------------------------------------------------------------------------------------------------------- + // Public methods + public function index() + { + $this->load->view('test/Test.php', []); + } + + // ----------------------------------------------------------------------------------------------------------------- + // Private methods + + /** + * Retrieve the UID of the logged user and checks if it is valid + */ + private function _setAuthUID() + { + $this->_uid = getAuthUID(); + + if (!$this->_uid) show_error('User authentification failed'); + } + +} diff --git a/application/controllers/api/v1/dashboard/Dashboard.php b/application/controllers/api/v1/dashboard/Dashboard.php new file mode 100644 index 000000000..28365525b --- /dev/null +++ b/application/controllers/api/v1/dashboard/Dashboard.php @@ -0,0 +1,54 @@ + 'user:r' + ]); + } + + /** + * @return void + */ + public function getWidgets() + { + $this->load->model('dashboard/Dashboard_model', 'DashboardModel'); + $result = $this->DashboardModel->loadWhere(['name'=>$this->get('dashboard')]); + if (isError($result)) + return $this->response($result, REST_Controller::HTTP_INTERNAL_SERVER_ERROR); + if (!hasData($result)) + return $this->response('No Dashboard with the name "' . $this->get('dashboard') . '" found.', REST_Controller::HTTP_INTERNAL_SERVER_ERROR); + $dashboard_id = current(getData($result))->dashboard_id; + + $this->load->model('dashboard/Dashboardwidget_model', 'DashboardwidgetModel'); + $result = $this->DashboardwidgetModel->loadWidgets($dashboard_id); + if (isError($result)) + return $this->response($result, REST_Controller::HTTP_INTERNAL_SERVER_ERROR); + if (!hasData($result)) + return $this->response('No Widgets for Dashboard "' . $this->get('dashboard') . '" found.', REST_Controller::HTTP_INTERNAL_SERVER_ERROR); + + $this->response(getData($result), REST_Controller::HTTP_OK); + } + + protected function _check_whitelist_auth() {} + +} diff --git a/application/controllers/api/v1/dashboard/User.php b/application/controllers/api/v1/dashboard/User.php new file mode 100644 index 000000000..fdc5d7a1e --- /dev/null +++ b/application/controllers/api/v1/dashboard/User.php @@ -0,0 +1,89 @@ + 'user:r', + 'Widget' => 'user:r', + 'Widgets' => 'user:r' + ]); + } + + /** + * @return void + */ + public function getAuthObj() + { + $result = $this->authlib->getAuthObj(); + + $this->response($result, REST_Controller::HTTP_OK); + } + + /** + * @return void + */ + public function getWidget() + { + $this->load->model('dashboard/Widget_model', 'WidgetModel'); + $result = $this->WidgetModel->load($this->get('widget_id')); + if (isError($result)) + return $this->response($result, REST_Controller::HTTP_INTERNAL_SERVER_ERROR); + if (!hasData($result)) + return $this->response('No Widget with the id "' . $this->get('widget_id') . '" found.', REST_Controller::HTTP_INTERNAL_SERVER_ERROR); + $result = current(getData($result)); + + $this->response($result, REST_Controller::HTTP_OK); + } + + /** + * @return void + */ + public function getWidgets() + { + $this->load->model('dashboard/Dashboard_model', 'DashboardModel'); + $result = $this->DashboardModel->loadWhere(['name'=>$this->get('dashboard')]); + if (isError($result)) + return $this->response($result, REST_Controller::HTTP_INTERNAL_SERVER_ERROR); + if (!hasData($result)) + return $this->response('No Dashboard with the name "' . $this->get('dashboard') . '" found.', REST_Controller::HTTP_INTERNAL_SERVER_ERROR); + $dashboard_id = current(getData($result))->dashboard_id; + + $authObj = $this->authlib->getAuthObj(); + + $this->load->model('dashboard/Dashboardpreset_model', 'DashboardpresetModel'); + $result = $this->DashboardpresetModel->loadForUser($dashboard_id, $authObj->username); + if (isError($result)) + return $this->response($result, REST_Controller::HTTP_INTERNAL_SERVER_ERROR); + if (!hasData($result)) + return $this->response('No Dashboard for user "' . $authObj->username . '" found.', REST_Controller::HTTP_INTERNAL_SERVER_ERROR); + + $result = (current(getData($result))->config); + $result = json_decode($result); + if ($result === null) + return $this->response(json_last_error_msg(), REST_Controller::HTTP_INTERNAL_SERVER_ERROR); + + $this->response($result, REST_Controller::HTTP_OK); + } + + protected function _check_whitelist_auth() {} + +} diff --git a/application/models/dashboard/Dashboard_model.php b/application/models/dashboard/Dashboard_model.php new file mode 100644 index 000000000..2aa567282 --- /dev/null +++ b/application/models/dashboard/Dashboard_model.php @@ -0,0 +1,18 @@ +dbTable = "( WITH vals (dashboard_id, name) AS (VALUES + (0,'CIS'), + (1,'PV21') + ) SELECT * FROM vals ) AS tbl_dashboard"; + $this->pk = 'dashboard_id'; + } + +} diff --git a/application/models/dashboard/Dashboardpreset_model.php b/application/models/dashboard/Dashboardpreset_model.php new file mode 100644 index 000000000..070fb77be --- /dev/null +++ b/application/models/dashboard/Dashboardpreset_model.php @@ -0,0 +1,28 @@ +dbTable = "( WITH vals (dashboard_preset_id, config) AS (VALUES + (0,CONCAT('[[0',',','0',',','0',',','0',',','[]]',',','[1',',','2',',','2',',','2',',','{\"display\":2}]]')), + (1,CONCAT('[[0',',','1',',','0',',','1',',','{}]',',','[1',',','0',',','1',',','0',',','{\"display\":1}]]')) + ) SELECT * FROM vals ) AS tbl_dashboard_preset"; + $this->pk = 'dashboard_preset_id'; + } + + public function loadForUser($dashboard_id, $uid) + { + $this->addJoin("( WITH vals (dashboard_preset_user_id, uid, dashboard_id, dashboard_preset_id) AS (VALUES + (0,'ma0168', 0, 0) + ) SELECT * FROM vals ) AS tbl_dashboard_preset_user", 'dashboard_preset_id'); + return $this->loadWhere(['uid' => $uid, 'dashboard_id' => $dashboard_id]); + + return success(); + } + +} diff --git a/application/models/dashboard/Dashboardwidget_model.php b/application/models/dashboard/Dashboardwidget_model.php new file mode 100644 index 000000000..e9349aae4 --- /dev/null +++ b/application/models/dashboard/Dashboardwidget_model.php @@ -0,0 +1,29 @@ +dbTable = "( WITH vals (dashboard_widget_id, dashboard_id, widget_id) AS (VALUES + (0,0,0), + (1,0,1), + (2,1,0) + ) SELECT * FROM vals ) AS tbl_dashboard_widget"; + $this->pk = 'dashboard_widget_id'; + } + + public function loadWidgets($dashboard_id) + { + $this->addJoin("( WITH vals (widget_id, name, component_name, component_path, arguments) AS (VALUES + (0,'KPI Single','DbwKpi','./DBW/KPI.js',CONCAT('{\"data\":[1]',',','\"display\":0}')), + (1,'KPI Multi','DbwKpi','./DBW/KPI.js',CONCAT('{\"data\":[1,2,3]}')) + ) SELECT * FROM vals ) AS tbl_widget", 'widget_id'); + + return $this->loadWhere(['dashboard_id' => $dashboard_id]); + } + +} diff --git a/application/models/dashboard/Widget_model.php b/application/models/dashboard/Widget_model.php new file mode 100644 index 000000000..c5d39e99d --- /dev/null +++ b/application/models/dashboard/Widget_model.php @@ -0,0 +1,18 @@ +dbTable = "( WITH vals (widget_id, name, component_name, component_path, arguments) AS (VALUES + (0,'KPI Single','DbwKpi','./DBW/KPI.js',CONCAT('{\"data\":[1]',',','\"display\":0}')), + (1,'KPI Multi','DbwKpi','./DBW/KPI.js',CONCAT('{\"data\":[1,2,3]}')) + ) SELECT * FROM vals ) AS tbl_widget"; + $this->pk = 'widget_id'; + } + +} diff --git a/application/views/test/Test.php b/application/views/test/Test.php new file mode 100644 index 000000000..84a2a5ece --- /dev/null +++ b/application/views/test/Test.php @@ -0,0 +1,63 @@ +load->view('templates/FHC-Header', + array( + 'title' => 'FH-Complete', + 'bootstrap5' => true, + 'fontawesome6' => true, + 'axios027' => true, + 'restclient' => true, + 'vue3' => true, + 'customJSModules' => ['public/js/apps/Test.js'], + 'navigationcomponent' => true + ) +); +?> + + + +
+ + + +
+
+

Dashboard

+
+ + + +
+
+ +load->view('templates/FHC-Footer'); ?> diff --git a/public/js/apps/Test.js b/public/js/apps/Test.js new file mode 100644 index 000000000..ec6e74a9b --- /dev/null +++ b/public/js/apps/Test.js @@ -0,0 +1,15 @@ +import {CoreNavigationCmpt} from '../components/navigation/Navigation.js'; +import CoreDashboard from '../components/CoreDashboard.js'; + +Vue.createApp({ + data: () => ({ + appSideMenuEntries: {} + }), + components: { + CoreNavigationCmpt, + CoreDashboard/*, + "CoreFilterCmpt": CoreFilterCmpt, + "verticalsplit": verticalsplit, + "searchbar": searchbar*/ + } +}).mount('#main'); diff --git a/public/js/components/CoreDashboard.js b/public/js/components/CoreDashboard.js new file mode 100644 index 000000000..e6d5c77ac --- /dev/null +++ b/public/js/components/CoreDashboard.js @@ -0,0 +1,206 @@ +import CoreDashboardItem from './Dashboard/Item.js'; +import DragAndDrop from './Dashboard/DragAndDrop.js'; + +export default { + components: { + CoreDashboardItem, + DragAndDrop + }, + data: () => ({ + widgetCache: {}, + componentCache: {}, + widgetWizard: null, + allowedWidgets: [], + widgets: [], + name: '', + newMode: false, + editMode: false + }), + computed: { + loaded: function() { + return this.widgets && this.name; + } + }, + props: [ + "dashboard" + ], + methods: { + saveConfig() { + // TODO(chris): SAVE! + console.log('SAVE', this.widgets); + this.editMode = false; + }, + startWidgetWizard() { + // TODO(chris): load widgets! + let self = this; + axios.get('/fhcomplete/index.ci.php/api/v1/dashboard/Dashboard/Widgets', { + headers: { + 'FHC-API-KEY':'itservice@technikum-wien.at' + }, + params: { + dashboard: this.dashboard + } + }).then(function(result) {console.log(result); + self.allowedWidgets = result.data; + }); + this.widgetWizard.show(); + }, + newWidget(widget) { + let self = this; + let newWidget = [widget.widget_id, this.widgets.length, this.widgets.length, this.widgets.length, []]; + // TODO(chris): loadingscreen? + (new Promise(function (resolve, reject) { + if (self.widgetCache[widget.widget_id]) { + resolve(self.widgetCache[widget.widget_id]); + } else { + this.extendWidgetAndCache(widget).then(widget => { + resolve(widget); + }); + } + })).then(widget => { + newWidget[5] = widget; + self.widgets.push(newWidget); + self.widgetWizard.hide(); + }); + }, + removeWidget(id) { + if (confirm('Are you sure you want to delete this widget?')) + this.widgets = this.widgets.filter(widget => widget[0] != id); + }, + getWidget(widget_id) { + let self = this; + return new Promise(function(resolve, reject) { + if (self.widgetCache[widget_id]) + return resolve(self.widgetCache[widget_id]); + axios.get('/fhcomplete/index.ci.php/api/v1/dashboard/User/Widget', { + headers: { + 'FHC-API-KEY':'itservice@technikum-wien.at' + }, + params: { + widget_id: widget_id + } + }) + .then(result => self.extendWidgetAndCache(result.data)) + .then(widget => resolve(widget)); + }); + }, + extendWidgetAndCache(widget) { + let self = this; + return new Promise(function(resolve, reject) { + let name = widget.component_name; + widget.arguments = JSON.parse(widget.arguments); + widget.component_name = widget.component_name.replace(/[A-Z]/g, (m,o) => (o > 0 ? "-" : "") + m.toLowerCase()); + self.getComponent(name, widget.component_path).then(component => { + widget.component = component; + return widget; + }).then(() => { + self.widgetCache[widget.widget_id] = widget; + resolve(self.widgetCache[widget.widget_id]); + }); + }); + }, + getComponent(name, path) { + let self = this; + return new Promise(async function(resolve, reject) { + if (self.componentCache[name]) + return resolve(self.componentCache[name]); + + + self.componentCache[name] = (await import(path)).default; + resolve(self.componentCache[name]); + }); + } + }, + mounted() { + let self = this; + this.widgetWizard = new bootstrap.Modal(this.$refs.widgetWizard); + axios.get('/fhcomplete/index.ci.php/api/v1/dashboard/User/AuthObj', { + headers: { + 'FHC-API-KEY':'itservice@technikum-wien.at' + } + }).then(function(result) { + self.name = result.data.name; + }); + axios.get('/fhcomplete/index.ci.php/api/v1/dashboard/User/Widgets', { + headers: { + 'FHC-API-KEY':'itservice@technikum-wien.at' + }, + params: { + dashboard: this.dashboard + } + }).then(function(result) { + let promises = []; + result.data.forEach(function(item) { + promises.push(new Promise(function(resolve, reject) { + self.getWidget(item[0]).then(function(widget) { + item[5] = widget; + resolve(); + }); + })); + }); + Promise.all(promises).then(function() { + self.widgets = result.data; + }) + }); + }, + template: `
+
+ +
+

+ Hallo {{name}}! + + + + + +

+
Loading...
+
+ +
+
+
+ +
+
+
+
+ +
` +} diff --git a/public/js/components/DBW/KPI.js b/public/js/components/DBW/KPI.js new file mode 100644 index 000000000..3346685f8 --- /dev/null +++ b/public/js/components/DBW/KPI.js @@ -0,0 +1,26 @@ +export default { + props: [ + "configMode", + "config" + ], + methods: { + changeConfig() { + this.config.display = parseInt(this.$refs.display.value); + this.$emit('config', this.config); + } + }, + template: `
+
KPI Widget
+
+ + +
+ +
` +} diff --git a/public/js/components/Dashboard/DragAndDrop.js b/public/js/components/Dashboard/DragAndDrop.js new file mode 100644 index 000000000..cd24c0ef6 --- /dev/null +++ b/public/js/components/Dashboard/DragAndDrop.js @@ -0,0 +1,139 @@ +export default { + data: () => ({ + isMounted: 0, + movedObjects: [], + tmpStyle: { + display: 'none', + background: 'gray', + 'grid-column-start': 0, + 'grid-column-end': 0, + 'grid-row-start': 0, + 'grid-row-end': 0, + } + }), + props: [ + "width", + "height", + "items" + ], + computed: { + gridWidth() { + if(!this.isMounted) + return 0; + return window.getComputedStyle(this.$refs.container).getPropertyValue('grid-template-columns').split(" ").length; + }, + gridHeight() { + if (!this.gridWidth) + return 0; + let minH = 0; + this.items.forEach(item => { + // TODO(chris): item change is not detected? + minH = Math.max(minH, item.y + item.h - 1); + }); + return Math.max(1, minH); + }, + gridOccupiers() { + let occupiers = []; + let gridWidth = this.gridWidth; + this.items.forEach(item => { + for (var i = 0; i < item.w; i++) + for (var j = 0; j < item.h; j++) + occupiers[(item.y+j) * gridWidth + (item.x+i)] = item.id; + }); + return occupiers; + } + }, + methods: { + startDrag(evt, item) { + evt.dataTransfer.dropEffect = 'move'; + evt.dataTransfer.effectAllowed = 'move'; + evt.dataTransfer.setData('itemId', item.id) + evt.dataTransfer.setData('itemW', item.w) + evt.dataTransfer.setData('itemH', item.h) + console.log(evt.target.style.display); + }, + moveItem(item) { + // TODO(chris): IMPLEMENT + if (!item._x) + item._x = item.x; + item.x++; + }, + moveItemBack(item) { + item.x = item._x; + }, + onDragOver(evt) { + this.tmpStyle.display = 'block'; + + let x = Math.floor(this.gridWidth * (evt.layerX / this.$refs.container.clientWidth)) + 1; + let y = Math.floor(this.gridHeight * (evt.layerY / this.$refs.container.clientHeight)) + 1; + let w = parseInt(evt.dataTransfer.getData('itemW')); + let h = parseInt(evt.dataTransfer.getData('itemH')); + + while (x + w > this.gridWidth + 1) + x--; + + // TODO(chris): start + let id = 0; + while (id = this.movedObjects.pop()) + /*this.items[id].c = this.items[id]._c;*/ + this.moveItemBack(this.items[id]); + for (var i = 0; i < w; i++) { + for (var j = 0; j < h; j++) { + let id = (y+j) * this.gridWidth + (x+i); + if (this.gridOccupiers[id] && this.gridOccupiers[id] != evt.dataTransfer.getData('itemID')) { + + /*if (!this.items[this.gridOccupiers[id]]._c) + this.items[this.gridOccupiers[id]]._c = this.items[this.gridOccupiers[id]].c; + this.items[this.gridOccupiers[id]].c = 'grey';*/ + this.moveItem(this.items[this.gridOccupiers[id]]); + + this.movedObjects.push(this.gridOccupiers[id]); + } + } + } + // TODO(chris): end + + this.tmpStyle['grid-column-start'] = x; + this.tmpStyle['grid-column-end'] = x + w; + this.tmpStyle['grid-row-start'] = y; + this.tmpStyle['grid-row-end'] = y + h; + }, + onDrop(evt, list) { + this.tmpStyle.display = 'none'; + + let id = evt.dataTransfer.getData('itemId'); + let x = Math.floor(this.gridWidth * (evt.layerX / this.$refs.container.clientWidth)) + 1; + let y = Math.floor(this.gridHeight * (evt.layerY / this.$refs.container.clientHeight)) + 1; + let w = parseInt(evt.dataTransfer.getData('itemW')); + + while (x + w > this.gridWidth + 1) + x--; + + this.items.forEach(item => { + if (id == item.id) { + item.x = x; + item.y = y; + console.log(item, id); + } + }); + // TODO(chris): find better way to trigger change for gridHeight + this.isMounted++ + } + }, + watchers: { + items() { + console.log(this.items); + } + }, + mounted() { + this.isMounted = 1; + window.addEventListener('resize', e => { this.isMounted ? this.isMounted++ : 0 }) + }, + template: `
+
+
+
{{gridWidth2}} +
+
+
` +} diff --git a/public/js/components/Dashboard/Item.js b/public/js/components/Dashboard/Item.js new file mode 100644 index 000000000..9a956a3ce --- /dev/null +++ b/public/js/components/Dashboard/Item.js @@ -0,0 +1,52 @@ +export default { + components: {}, + data: () => ({ + configMode: false, + name: '', + component: '', + arguments: null + }), + props: [ + "widget", + "config", + "editMode" + ], + computed: { + ready() { + return this.name && this.component && this.arguments !== null; + } + }, + methods: { + changeConfig(v) { + this.arguments = v; + this.configMode = false; + // TODO(chris): diff arguments widget.arguments + this.$emit('change', v); + } + }, + mounted() { + let self = this; + + if (!this.isPlaceholder) { + this.$options.components[this.widget.component_name] = this.widget.component; + this.name = this.widget.name; + this.component = this.widget.component_name; + this.arguments = {...this.widget.arguments, ...this.config}; + } + }, + template: `
+
+
+
+ + {{name}} + + +
+
+ +
+
+
+
` +} From 00f1eb38d178d1d5a750e123d5bf5e85dea41038 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96sterreicher?= Date: Wed, 7 Sep 2022 08:27:31 +0200 Subject: [PATCH 07/11] Added missing index files --- cis/private/coodle/index.html | 0 cis/private/index.html | 0 cis/private/info/index.html | 0 cis/private/tools/index.html | 0 4 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 cis/private/coodle/index.html create mode 100644 cis/private/index.html create mode 100644 cis/private/info/index.html create mode 100644 cis/private/tools/index.html diff --git a/cis/private/coodle/index.html b/cis/private/coodle/index.html new file mode 100644 index 000000000..e69de29bb diff --git a/cis/private/index.html b/cis/private/index.html new file mode 100644 index 000000000..e69de29bb diff --git a/cis/private/info/index.html b/cis/private/info/index.html new file mode 100644 index 000000000..e69de29bb diff --git a/cis/private/tools/index.html b/cis/private/tools/index.html new file mode 100644 index 000000000..e69de29bb From 393eaea91dc377df132f4681e1ced4072ca13621 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96sterreicher?= Date: Wed, 7 Sep 2022 09:00:00 +0200 Subject: [PATCH 08/11] Removed Dashboard Testfiles --- application/controllers/Test.php | 51 ----- .../api/v1/dashboard/Dashboard.php | 54 ----- .../controllers/api/v1/dashboard/User.php | 89 -------- .../models/dashboard/Dashboard_model.php | 18 -- .../dashboard/Dashboardpreset_model.php | 28 --- .../dashboard/Dashboardwidget_model.php | 29 --- application/models/dashboard/Widget_model.php | 18 -- application/views/test/Test.php | 63 ------ public/js/apps/Test.js | 15 -- public/js/components/CoreDashboard.js | 206 ------------------ public/js/components/DBW/KPI.js | 26 --- public/js/components/Dashboard/DragAndDrop.js | 139 ------------ public/js/components/Dashboard/Item.js | 52 ----- 13 files changed, 788 deletions(-) delete mode 100644 application/controllers/Test.php delete mode 100644 application/controllers/api/v1/dashboard/Dashboard.php delete mode 100644 application/controllers/api/v1/dashboard/User.php delete mode 100644 application/models/dashboard/Dashboard_model.php delete mode 100644 application/models/dashboard/Dashboardpreset_model.php delete mode 100644 application/models/dashboard/Dashboardwidget_model.php delete mode 100644 application/models/dashboard/Widget_model.php delete mode 100644 application/views/test/Test.php delete mode 100644 public/js/apps/Test.js delete mode 100644 public/js/components/CoreDashboard.js delete mode 100644 public/js/components/DBW/KPI.js delete mode 100644 public/js/components/Dashboard/DragAndDrop.js delete mode 100644 public/js/components/Dashboard/Item.js diff --git a/application/controllers/Test.php b/application/controllers/Test.php deleted file mode 100644 index aa21f6296..000000000 --- a/application/controllers/Test.php +++ /dev/null @@ -1,51 +0,0 @@ - 'user:r', - ) - ); - - $this->load->library('AuthLib'); - $this->load->library('WidgetLib'); - - $this->_setAuthUID(); // sets property uid - - $this->setControllerId(); // sets the controller id - } - - // ----------------------------------------------------------------------------------------------------------------- - // Public methods - public function index() - { - $this->load->view('test/Test.php', []); - } - - // ----------------------------------------------------------------------------------------------------------------- - // Private methods - - /** - * Retrieve the UID of the logged user and checks if it is valid - */ - private function _setAuthUID() - { - $this->_uid = getAuthUID(); - - if (!$this->_uid) show_error('User authentification failed'); - } - -} diff --git a/application/controllers/api/v1/dashboard/Dashboard.php b/application/controllers/api/v1/dashboard/Dashboard.php deleted file mode 100644 index 28365525b..000000000 --- a/application/controllers/api/v1/dashboard/Dashboard.php +++ /dev/null @@ -1,54 +0,0 @@ - 'user:r' - ]); - } - - /** - * @return void - */ - public function getWidgets() - { - $this->load->model('dashboard/Dashboard_model', 'DashboardModel'); - $result = $this->DashboardModel->loadWhere(['name'=>$this->get('dashboard')]); - if (isError($result)) - return $this->response($result, REST_Controller::HTTP_INTERNAL_SERVER_ERROR); - if (!hasData($result)) - return $this->response('No Dashboard with the name "' . $this->get('dashboard') . '" found.', REST_Controller::HTTP_INTERNAL_SERVER_ERROR); - $dashboard_id = current(getData($result))->dashboard_id; - - $this->load->model('dashboard/Dashboardwidget_model', 'DashboardwidgetModel'); - $result = $this->DashboardwidgetModel->loadWidgets($dashboard_id); - if (isError($result)) - return $this->response($result, REST_Controller::HTTP_INTERNAL_SERVER_ERROR); - if (!hasData($result)) - return $this->response('No Widgets for Dashboard "' . $this->get('dashboard') . '" found.', REST_Controller::HTTP_INTERNAL_SERVER_ERROR); - - $this->response(getData($result), REST_Controller::HTTP_OK); - } - - protected function _check_whitelist_auth() {} - -} diff --git a/application/controllers/api/v1/dashboard/User.php b/application/controllers/api/v1/dashboard/User.php deleted file mode 100644 index fdc5d7a1e..000000000 --- a/application/controllers/api/v1/dashboard/User.php +++ /dev/null @@ -1,89 +0,0 @@ - 'user:r', - 'Widget' => 'user:r', - 'Widgets' => 'user:r' - ]); - } - - /** - * @return void - */ - public function getAuthObj() - { - $result = $this->authlib->getAuthObj(); - - $this->response($result, REST_Controller::HTTP_OK); - } - - /** - * @return void - */ - public function getWidget() - { - $this->load->model('dashboard/Widget_model', 'WidgetModel'); - $result = $this->WidgetModel->load($this->get('widget_id')); - if (isError($result)) - return $this->response($result, REST_Controller::HTTP_INTERNAL_SERVER_ERROR); - if (!hasData($result)) - return $this->response('No Widget with the id "' . $this->get('widget_id') . '" found.', REST_Controller::HTTP_INTERNAL_SERVER_ERROR); - $result = current(getData($result)); - - $this->response($result, REST_Controller::HTTP_OK); - } - - /** - * @return void - */ - public function getWidgets() - { - $this->load->model('dashboard/Dashboard_model', 'DashboardModel'); - $result = $this->DashboardModel->loadWhere(['name'=>$this->get('dashboard')]); - if (isError($result)) - return $this->response($result, REST_Controller::HTTP_INTERNAL_SERVER_ERROR); - if (!hasData($result)) - return $this->response('No Dashboard with the name "' . $this->get('dashboard') . '" found.', REST_Controller::HTTP_INTERNAL_SERVER_ERROR); - $dashboard_id = current(getData($result))->dashboard_id; - - $authObj = $this->authlib->getAuthObj(); - - $this->load->model('dashboard/Dashboardpreset_model', 'DashboardpresetModel'); - $result = $this->DashboardpresetModel->loadForUser($dashboard_id, $authObj->username); - if (isError($result)) - return $this->response($result, REST_Controller::HTTP_INTERNAL_SERVER_ERROR); - if (!hasData($result)) - return $this->response('No Dashboard for user "' . $authObj->username . '" found.', REST_Controller::HTTP_INTERNAL_SERVER_ERROR); - - $result = (current(getData($result))->config); - $result = json_decode($result); - if ($result === null) - return $this->response(json_last_error_msg(), REST_Controller::HTTP_INTERNAL_SERVER_ERROR); - - $this->response($result, REST_Controller::HTTP_OK); - } - - protected function _check_whitelist_auth() {} - -} diff --git a/application/models/dashboard/Dashboard_model.php b/application/models/dashboard/Dashboard_model.php deleted file mode 100644 index 2aa567282..000000000 --- a/application/models/dashboard/Dashboard_model.php +++ /dev/null @@ -1,18 +0,0 @@ -dbTable = "( WITH vals (dashboard_id, name) AS (VALUES - (0,'CIS'), - (1,'PV21') - ) SELECT * FROM vals ) AS tbl_dashboard"; - $this->pk = 'dashboard_id'; - } - -} diff --git a/application/models/dashboard/Dashboardpreset_model.php b/application/models/dashboard/Dashboardpreset_model.php deleted file mode 100644 index 070fb77be..000000000 --- a/application/models/dashboard/Dashboardpreset_model.php +++ /dev/null @@ -1,28 +0,0 @@ -dbTable = "( WITH vals (dashboard_preset_id, config) AS (VALUES - (0,CONCAT('[[0',',','0',',','0',',','0',',','[]]',',','[1',',','2',',','2',',','2',',','{\"display\":2}]]')), - (1,CONCAT('[[0',',','1',',','0',',','1',',','{}]',',','[1',',','0',',','1',',','0',',','{\"display\":1}]]')) - ) SELECT * FROM vals ) AS tbl_dashboard_preset"; - $this->pk = 'dashboard_preset_id'; - } - - public function loadForUser($dashboard_id, $uid) - { - $this->addJoin("( WITH vals (dashboard_preset_user_id, uid, dashboard_id, dashboard_preset_id) AS (VALUES - (0,'ma0168', 0, 0) - ) SELECT * FROM vals ) AS tbl_dashboard_preset_user", 'dashboard_preset_id'); - return $this->loadWhere(['uid' => $uid, 'dashboard_id' => $dashboard_id]); - - return success(); - } - -} diff --git a/application/models/dashboard/Dashboardwidget_model.php b/application/models/dashboard/Dashboardwidget_model.php deleted file mode 100644 index e9349aae4..000000000 --- a/application/models/dashboard/Dashboardwidget_model.php +++ /dev/null @@ -1,29 +0,0 @@ -dbTable = "( WITH vals (dashboard_widget_id, dashboard_id, widget_id) AS (VALUES - (0,0,0), - (1,0,1), - (2,1,0) - ) SELECT * FROM vals ) AS tbl_dashboard_widget"; - $this->pk = 'dashboard_widget_id'; - } - - public function loadWidgets($dashboard_id) - { - $this->addJoin("( WITH vals (widget_id, name, component_name, component_path, arguments) AS (VALUES - (0,'KPI Single','DbwKpi','./DBW/KPI.js',CONCAT('{\"data\":[1]',',','\"display\":0}')), - (1,'KPI Multi','DbwKpi','./DBW/KPI.js',CONCAT('{\"data\":[1,2,3]}')) - ) SELECT * FROM vals ) AS tbl_widget", 'widget_id'); - - return $this->loadWhere(['dashboard_id' => $dashboard_id]); - } - -} diff --git a/application/models/dashboard/Widget_model.php b/application/models/dashboard/Widget_model.php deleted file mode 100644 index c5d39e99d..000000000 --- a/application/models/dashboard/Widget_model.php +++ /dev/null @@ -1,18 +0,0 @@ -dbTable = "( WITH vals (widget_id, name, component_name, component_path, arguments) AS (VALUES - (0,'KPI Single','DbwKpi','./DBW/KPI.js',CONCAT('{\"data\":[1]',',','\"display\":0}')), - (1,'KPI Multi','DbwKpi','./DBW/KPI.js',CONCAT('{\"data\":[1,2,3]}')) - ) SELECT * FROM vals ) AS tbl_widget"; - $this->pk = 'widget_id'; - } - -} diff --git a/application/views/test/Test.php b/application/views/test/Test.php deleted file mode 100644 index 84a2a5ece..000000000 --- a/application/views/test/Test.php +++ /dev/null @@ -1,63 +0,0 @@ -load->view('templates/FHC-Header', - array( - 'title' => 'FH-Complete', - 'bootstrap5' => true, - 'fontawesome6' => true, - 'axios027' => true, - 'restclient' => true, - 'vue3' => true, - 'customJSModules' => ['public/js/apps/Test.js'], - 'navigationcomponent' => true - ) -); -?> - - - -
- - - -
-
-

Dashboard

-
- - - -
-
- -load->view('templates/FHC-Footer'); ?> diff --git a/public/js/apps/Test.js b/public/js/apps/Test.js deleted file mode 100644 index ec6e74a9b..000000000 --- a/public/js/apps/Test.js +++ /dev/null @@ -1,15 +0,0 @@ -import {CoreNavigationCmpt} from '../components/navigation/Navigation.js'; -import CoreDashboard from '../components/CoreDashboard.js'; - -Vue.createApp({ - data: () => ({ - appSideMenuEntries: {} - }), - components: { - CoreNavigationCmpt, - CoreDashboard/*, - "CoreFilterCmpt": CoreFilterCmpt, - "verticalsplit": verticalsplit, - "searchbar": searchbar*/ - } -}).mount('#main'); diff --git a/public/js/components/CoreDashboard.js b/public/js/components/CoreDashboard.js deleted file mode 100644 index e6d5c77ac..000000000 --- a/public/js/components/CoreDashboard.js +++ /dev/null @@ -1,206 +0,0 @@ -import CoreDashboardItem from './Dashboard/Item.js'; -import DragAndDrop from './Dashboard/DragAndDrop.js'; - -export default { - components: { - CoreDashboardItem, - DragAndDrop - }, - data: () => ({ - widgetCache: {}, - componentCache: {}, - widgetWizard: null, - allowedWidgets: [], - widgets: [], - name: '', - newMode: false, - editMode: false - }), - computed: { - loaded: function() { - return this.widgets && this.name; - } - }, - props: [ - "dashboard" - ], - methods: { - saveConfig() { - // TODO(chris): SAVE! - console.log('SAVE', this.widgets); - this.editMode = false; - }, - startWidgetWizard() { - // TODO(chris): load widgets! - let self = this; - axios.get('/fhcomplete/index.ci.php/api/v1/dashboard/Dashboard/Widgets', { - headers: { - 'FHC-API-KEY':'itservice@technikum-wien.at' - }, - params: { - dashboard: this.dashboard - } - }).then(function(result) {console.log(result); - self.allowedWidgets = result.data; - }); - this.widgetWizard.show(); - }, - newWidget(widget) { - let self = this; - let newWidget = [widget.widget_id, this.widgets.length, this.widgets.length, this.widgets.length, []]; - // TODO(chris): loadingscreen? - (new Promise(function (resolve, reject) { - if (self.widgetCache[widget.widget_id]) { - resolve(self.widgetCache[widget.widget_id]); - } else { - this.extendWidgetAndCache(widget).then(widget => { - resolve(widget); - }); - } - })).then(widget => { - newWidget[5] = widget; - self.widgets.push(newWidget); - self.widgetWizard.hide(); - }); - }, - removeWidget(id) { - if (confirm('Are you sure you want to delete this widget?')) - this.widgets = this.widgets.filter(widget => widget[0] != id); - }, - getWidget(widget_id) { - let self = this; - return new Promise(function(resolve, reject) { - if (self.widgetCache[widget_id]) - return resolve(self.widgetCache[widget_id]); - axios.get('/fhcomplete/index.ci.php/api/v1/dashboard/User/Widget', { - headers: { - 'FHC-API-KEY':'itservice@technikum-wien.at' - }, - params: { - widget_id: widget_id - } - }) - .then(result => self.extendWidgetAndCache(result.data)) - .then(widget => resolve(widget)); - }); - }, - extendWidgetAndCache(widget) { - let self = this; - return new Promise(function(resolve, reject) { - let name = widget.component_name; - widget.arguments = JSON.parse(widget.arguments); - widget.component_name = widget.component_name.replace(/[A-Z]/g, (m,o) => (o > 0 ? "-" : "") + m.toLowerCase()); - self.getComponent(name, widget.component_path).then(component => { - widget.component = component; - return widget; - }).then(() => { - self.widgetCache[widget.widget_id] = widget; - resolve(self.widgetCache[widget.widget_id]); - }); - }); - }, - getComponent(name, path) { - let self = this; - return new Promise(async function(resolve, reject) { - if (self.componentCache[name]) - return resolve(self.componentCache[name]); - - - self.componentCache[name] = (await import(path)).default; - resolve(self.componentCache[name]); - }); - } - }, - mounted() { - let self = this; - this.widgetWizard = new bootstrap.Modal(this.$refs.widgetWizard); - axios.get('/fhcomplete/index.ci.php/api/v1/dashboard/User/AuthObj', { - headers: { - 'FHC-API-KEY':'itservice@technikum-wien.at' - } - }).then(function(result) { - self.name = result.data.name; - }); - axios.get('/fhcomplete/index.ci.php/api/v1/dashboard/User/Widgets', { - headers: { - 'FHC-API-KEY':'itservice@technikum-wien.at' - }, - params: { - dashboard: this.dashboard - } - }).then(function(result) { - let promises = []; - result.data.forEach(function(item) { - promises.push(new Promise(function(resolve, reject) { - self.getWidget(item[0]).then(function(widget) { - item[5] = widget; - resolve(); - }); - })); - }); - Promise.all(promises).then(function() { - self.widgets = result.data; - }) - }); - }, - template: `
-
- -
-

- Hallo {{name}}! - - - - - -

-
Loading...
-
- -
-
-
- -
-
-
-
- -
` -} diff --git a/public/js/components/DBW/KPI.js b/public/js/components/DBW/KPI.js deleted file mode 100644 index 3346685f8..000000000 --- a/public/js/components/DBW/KPI.js +++ /dev/null @@ -1,26 +0,0 @@ -export default { - props: [ - "configMode", - "config" - ], - methods: { - changeConfig() { - this.config.display = parseInt(this.$refs.display.value); - this.$emit('config', this.config); - } - }, - template: `
-
KPI Widget
-
- - -
- -
` -} diff --git a/public/js/components/Dashboard/DragAndDrop.js b/public/js/components/Dashboard/DragAndDrop.js deleted file mode 100644 index cd24c0ef6..000000000 --- a/public/js/components/Dashboard/DragAndDrop.js +++ /dev/null @@ -1,139 +0,0 @@ -export default { - data: () => ({ - isMounted: 0, - movedObjects: [], - tmpStyle: { - display: 'none', - background: 'gray', - 'grid-column-start': 0, - 'grid-column-end': 0, - 'grid-row-start': 0, - 'grid-row-end': 0, - } - }), - props: [ - "width", - "height", - "items" - ], - computed: { - gridWidth() { - if(!this.isMounted) - return 0; - return window.getComputedStyle(this.$refs.container).getPropertyValue('grid-template-columns').split(" ").length; - }, - gridHeight() { - if (!this.gridWidth) - return 0; - let minH = 0; - this.items.forEach(item => { - // TODO(chris): item change is not detected? - minH = Math.max(minH, item.y + item.h - 1); - }); - return Math.max(1, minH); - }, - gridOccupiers() { - let occupiers = []; - let gridWidth = this.gridWidth; - this.items.forEach(item => { - for (var i = 0; i < item.w; i++) - for (var j = 0; j < item.h; j++) - occupiers[(item.y+j) * gridWidth + (item.x+i)] = item.id; - }); - return occupiers; - } - }, - methods: { - startDrag(evt, item) { - evt.dataTransfer.dropEffect = 'move'; - evt.dataTransfer.effectAllowed = 'move'; - evt.dataTransfer.setData('itemId', item.id) - evt.dataTransfer.setData('itemW', item.w) - evt.dataTransfer.setData('itemH', item.h) - console.log(evt.target.style.display); - }, - moveItem(item) { - // TODO(chris): IMPLEMENT - if (!item._x) - item._x = item.x; - item.x++; - }, - moveItemBack(item) { - item.x = item._x; - }, - onDragOver(evt) { - this.tmpStyle.display = 'block'; - - let x = Math.floor(this.gridWidth * (evt.layerX / this.$refs.container.clientWidth)) + 1; - let y = Math.floor(this.gridHeight * (evt.layerY / this.$refs.container.clientHeight)) + 1; - let w = parseInt(evt.dataTransfer.getData('itemW')); - let h = parseInt(evt.dataTransfer.getData('itemH')); - - while (x + w > this.gridWidth + 1) - x--; - - // TODO(chris): start - let id = 0; - while (id = this.movedObjects.pop()) - /*this.items[id].c = this.items[id]._c;*/ - this.moveItemBack(this.items[id]); - for (var i = 0; i < w; i++) { - for (var j = 0; j < h; j++) { - let id = (y+j) * this.gridWidth + (x+i); - if (this.gridOccupiers[id] && this.gridOccupiers[id] != evt.dataTransfer.getData('itemID')) { - - /*if (!this.items[this.gridOccupiers[id]]._c) - this.items[this.gridOccupiers[id]]._c = this.items[this.gridOccupiers[id]].c; - this.items[this.gridOccupiers[id]].c = 'grey';*/ - this.moveItem(this.items[this.gridOccupiers[id]]); - - this.movedObjects.push(this.gridOccupiers[id]); - } - } - } - // TODO(chris): end - - this.tmpStyle['grid-column-start'] = x; - this.tmpStyle['grid-column-end'] = x + w; - this.tmpStyle['grid-row-start'] = y; - this.tmpStyle['grid-row-end'] = y + h; - }, - onDrop(evt, list) { - this.tmpStyle.display = 'none'; - - let id = evt.dataTransfer.getData('itemId'); - let x = Math.floor(this.gridWidth * (evt.layerX / this.$refs.container.clientWidth)) + 1; - let y = Math.floor(this.gridHeight * (evt.layerY / this.$refs.container.clientHeight)) + 1; - let w = parseInt(evt.dataTransfer.getData('itemW')); - - while (x + w > this.gridWidth + 1) - x--; - - this.items.forEach(item => { - if (id == item.id) { - item.x = x; - item.y = y; - console.log(item, id); - } - }); - // TODO(chris): find better way to trigger change for gridHeight - this.isMounted++ - } - }, - watchers: { - items() { - console.log(this.items); - } - }, - mounted() { - this.isMounted = 1; - window.addEventListener('resize', e => { this.isMounted ? this.isMounted++ : 0 }) - }, - template: `
-
-
-
{{gridWidth2}} -
-
-
` -} diff --git a/public/js/components/Dashboard/Item.js b/public/js/components/Dashboard/Item.js deleted file mode 100644 index 9a956a3ce..000000000 --- a/public/js/components/Dashboard/Item.js +++ /dev/null @@ -1,52 +0,0 @@ -export default { - components: {}, - data: () => ({ - configMode: false, - name: '', - component: '', - arguments: null - }), - props: [ - "widget", - "config", - "editMode" - ], - computed: { - ready() { - return this.name && this.component && this.arguments !== null; - } - }, - methods: { - changeConfig(v) { - this.arguments = v; - this.configMode = false; - // TODO(chris): diff arguments widget.arguments - this.$emit('change', v); - } - }, - mounted() { - let self = this; - - if (!this.isPlaceholder) { - this.$options.components[this.widget.component_name] = this.widget.component; - this.name = this.widget.name; - this.component = this.widget.component_name; - this.arguments = {...this.widget.arguments, ...this.config}; - } - }, - template: `
-
-
-
- - {{name}} - - -
-
- -
-
-
-
` -} From d13cc789ad834c6dcad27e5ee2ad00b9a1968cd4 Mon Sep 17 00:00:00 2001 From: Cris Date: Thu, 8 Sep 2022 12:53:44 +0200 Subject: [PATCH 09/11] =?UTF-8?q?Fix=20Anrechnung=20Student=20View:=20?= =?UTF-8?q?=C3=84nderung=20des=20Download-Dokumentnamens=20zur=C3=BCckgeno?= =?UTF-8?q?mmen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Der Download-Dokumentname ist in der Studierendenansicht nun wieder gleich wie der originale Dokuementname beim Hochladen. --- application/controllers/lehre/anrechnung/RequestAnrechnung.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/controllers/lehre/anrechnung/RequestAnrechnung.php b/application/controllers/lehre/anrechnung/RequestAnrechnung.php index bc8ab562e..ce694e3d2 100644 --- a/application/controllers/lehre/anrechnung/RequestAnrechnung.php +++ b/application/controllers/lehre/anrechnung/RequestAnrechnung.php @@ -208,7 +208,7 @@ class requestAnrechnung extends Auth_Controller $this->_checkIfEntitledToReadDMSDoc($dms_id); // Get file to be downloaded from DMS - $download = $this->dmslib->download($dms_id, $filename); + $download = $this->dmslib->download($dms_id); if (isError($download)) return $download; // Download file From 15121ced6d1381a03649637d33b2ba2f595be081 Mon Sep 17 00:00:00 2001 From: Cris Date: Thu, 8 Sep 2022 14:08:46 +0200 Subject: [PATCH 10/11] Fixed missing disabled formular and wrong status-test when student emits Anrechnung with Begruendung Hochschule --- .../js/lehre/anrechnung/requestAnrechnung.js | 93 ++++++++++--------- 1 file changed, 49 insertions(+), 44 deletions(-) diff --git a/public/js/lehre/anrechnung/requestAnrechnung.js b/public/js/lehre/anrechnung/requestAnrechnung.js index dd93394d4..5edb4e162 100644 --- a/public/js/lehre/anrechnung/requestAnrechnung.js +++ b/public/js/lehre/anrechnung/requestAnrechnung.js @@ -7,49 +7,6 @@ const COLOR_DANGER = '#f2dede'; $(function(){ const uploadMaxFilesize = $('#requestAnrechnung-uploadfile').data('maxsize') ; // in byte - let status_kurzbz = $('#requestAnrechnung-status_kurzbz').data('status_kurzbz'); - if (status_kurzbz != ' ' && status_kurzbz != ANRECHNUNGSTATUS_APPROVED) - { - var ectsLv = parseFloat($('#ects').text()); - var sumEctsSchulisch = parseFloat($('#sumEctsSchulisch').text()); - var sumEctsBeruflich = parseFloat($('#sumEctsBeruflich').text()); - var begruendung_id = $('#requestAnrechnung-form :input[name="begruendung"]:checked').val(); - - // If Begründung is 'Hochschulzeugnis', return. They are accepted without limit. - if (begruendung_id == 5) - { - exit; - } - - // If max ECTS is ecceeded - if (begruendung_id == 4) - { - if ((sumEctsSchulisch + sumEctsBeruflich + ectsLv) > 90 || - (sumEctsBeruflich + ectsLv) > 60 - ) - { - // Get ECTS Überschreitungs-message, depending on schulische or berufliche Qualifikation - var msgBeiEctsUeberschreitung = requestAnrechnung.getMsgBeiEctsUeberschreitung(begruendung_id, ectsLv, sumEctsSchulisch, sumEctsBeruflich); - - // Add to Checkbox text - $('#requestAnrechnung-form :input[name="begruendung"]:checked').closest('label').append(msgBeiEctsUeberschreitung); - } - } - else - { - if ((sumEctsSchulisch + sumEctsBeruflich + ectsLv) > 90 || - (sumEctsSchulisch + ectsLv) > 60 - ) - { - // Get ECTS Überschreitungs-message, depending on schulische or berufliche Qualifikation - var msgBeiEctsUeberschreitung = requestAnrechnung.getMsgBeiEctsUeberschreitung(begruendung_id, ectsLv, sumEctsSchulisch, sumEctsBeruflich); - - // Add to Checkbox text - $('#requestAnrechnung-form :input[name="begruendung"]:checked').closest('label').append(msgBeiEctsUeberschreitung); - } - } - } - // Set status alert color requestAnrechnung.setStatusAlertColor(); @@ -62,9 +19,12 @@ $(function(){ // Init tooltips requestAnrechnung.initTooltips(); - // // Alert message, if maximum ECTS exceeded + // Alert message, if maximum ECTS exceeded requestAnrechnung.alertIfMaxEctsExceeded(); + // Alert message inside Begruendungsbox, if maximum ECTS exceeded + requestAnrechnung.alertIfMaxEctsExceededInsideBegruendungsbox(); + // Set chars counter for textarea 'Herkunft der Kenntnisse' requestAnrechnung.setCharsCounter(); @@ -318,6 +278,51 @@ var requestAnrechnung = { }); } }, + alertIfMaxEctsExceededInsideBegruendungsbox: function(){ + let status_kurzbz = $('#requestAnrechnung-status_kurzbz').data('status_kurzbz'); + + if (status_kurzbz != ' ' && status_kurzbz != ANRECHNUNGSTATUS_APPROVED) + { + var ectsLv = parseFloat($('#ects').text()); + var sumEctsSchulisch = parseFloat($('#sumEctsSchulisch').text()); + var sumEctsBeruflich = parseFloat($('#sumEctsBeruflich').text()); + var begruendung_id = $('#requestAnrechnung-form :input[name="begruendung"]:checked').val(); + + // If Begründung is 'Hochschulzeugnis', return. They are accepted without limit. + if (begruendung_id == 5) + { + return; + } + + // If max ECTS is ecceeded + if (begruendung_id == 4) + { + if ((sumEctsSchulisch + sumEctsBeruflich + ectsLv) > 90 || + (sumEctsBeruflich + ectsLv) > 60 + ) + { + // Get ECTS Überschreitungs-message, depending on schulische or berufliche Qualifikation + var msgBeiEctsUeberschreitung = requestAnrechnung.getMsgBeiEctsUeberschreitung(begruendung_id, ectsLv, sumEctsSchulisch, sumEctsBeruflich); + + // Add to Checkbox text + $('#requestAnrechnung-form :input[name="begruendung"]:checked').closest('label').append(msgBeiEctsUeberschreitung); + } + } + else + { + if ((sumEctsSchulisch + sumEctsBeruflich + ectsLv) > 90 || + (sumEctsSchulisch + ectsLv) > 60 + ) + { + // Get ECTS Überschreitungs-message, depending on schulische or berufliche Qualifikation + var msgBeiEctsUeberschreitung = requestAnrechnung.getMsgBeiEctsUeberschreitung(begruendung_id, ectsLv, sumEctsSchulisch, sumEctsBeruflich); + + // Add to Checkbox text + $('#requestAnrechnung-form :input[name="begruendung"]:checked').closest('label').append(msgBeiEctsUeberschreitung); + } + } + } + }, getMsgBeiEctsUeberschreitung: function(begruendung_id, ects, sumEctsSchulisch, sumEctsBeruflich){ return $('') From 617dcc0646eeef5a5ea895807021a504c15630cb Mon Sep 17 00:00:00 2001 From: Cris Date: Thu, 8 Sep 2022 14:09:37 +0200 Subject: [PATCH 11/11] Changed application dates for testing reason --- application/config/anrechnung.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application/config/anrechnung.php b/application/config/anrechnung.php index d1f4f0958..c2e38385c 100644 --- a/application/config/anrechnung.php +++ b/application/config/anrechnung.php @@ -7,8 +7,8 @@ if (! defined('BASEPATH')) exit('No direct script access allowed'); $config['interval_blocking_application'] = 'P1M'; // Application submission period given by start- and enddate. -$config['submit_application_start'] = '01.02.2021'; -$config['submit_application_end'] = '22.02.2021'; +$config['submit_application_start'] = '05.09.2022'; +$config['submit_application_end'] = '22.09.2022'; // Lehrveranstaltungen with these grades will be blocked for application $config['grades_blocking_application'] = array(