Merge remote-tracking branch 'origin/feature-25999/C4_cleanup' into feature-25999/C4_cleanup

This commit is contained in:
Johann Hoffmann
2025-02-05 16:05:04 +01:00
7 changed files with 93 additions and 11 deletions
@@ -0,0 +1,52 @@
<?php
/**
* Copyright (C) 2024 fhcomplete.org
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
if (!defined('BASEPATH')) exit('No direct script access allowed');
class AuthInfo extends FHCAPI_Controller
{
/**
* Object initialization
*/
public function __construct()
{
parent::__construct([
'getAuthUID' => self::PERM_LOGGED,
]);
$this->uid = getAuthUID();
$this->pid = getAuthPersonID();
}
//------------------------------------------------------------------------------------------------------------------
// Public methods
/**
* returns the uid of the currently logged in user
* @access public
*
*/
public function getAuthUID()
{
$this->terminateWithSuccess(['uid'=>$this->uid]);
}
}
@@ -181,7 +181,7 @@ class Studiensemester_model extends DB_Model
$query = "
SELECT studiensemester_kurzbz, start, ende
FROM public.tbl_studiensemester
WHERE ( ende >= ?::date AND start <= ?::date ) OR ( ende >= ?::date + '45 days'::interval AND start <= ?::date + '45 days'::interval )
WHERE ( ende >= ?::date AND start <= ?::date ) OR ( ende >= ?::date + '-45 days'::interval AND start <= ?::date + '-45 days'::interval )
ORDER BY start DESC
LIMIT 1";
+1 -1
View File
@@ -10,7 +10,7 @@ $this->load->view(
);
?>
<iframe style="width:100%; height:100%;" id="Infoterminal" src="<?php echo base_url() . 'cis/infoterminal/'; ?>" name="Infoterminal" frameborder="0" >
<iframe style="width:100%; height:100%;" id="Infoterminal" src="<?php echo base_url() . 'cis/infoterminal/?forcelogin=true'; ?>" name="Infoterminal" frameborder="0" >
No iFrames
</iframe>
<?php $this->load->view('templates/CISVUE-Footer', $includesArray); ?>
+8
View File
@@ -38,6 +38,14 @@ require_once('../../include/authentication.class.php');
require_once('../../include/addon.class.php');
require_once('../../include/'.EXT_FKT_PATH.'/serviceterminal.inc.php');
// 2025-02-05 ma0080 add query parameter to force login e.g. when used in iframe in CIS4.0 begin
if( isset($_GET['forcelogin']) && !isset($_SERVER['PHP_AUTH_USER']) ) {
header('WWW-Authenticate: Basic Realm="' . AUTH_NAME . '"');
http_response_code(401);
die();
}
// 2025-02-05 ma0080 add query parameter to force login e.g. when used in iframe in CIS4.0 end
if (!$db = new basis_db())
$db=false;
+10
View File
@@ -0,0 +1,10 @@
export default {
getAuthUID() {
return this.$fhcApi.get(
'/api/frontend/v1/AuthInfo/getAuthUID',
{ }
);
},
};
+3 -1
View File
@@ -35,7 +35,8 @@ import lehre from "./lehre.js";
import addons from "./addons.js";
import studiengang from "./studiengang.js";
import menu from "./menu.js";
import dashboard from "./dashboard";
import dashboard from "./dashboard.js";
import authinfo from "./authinfo.js";
export default {
search,
@@ -59,4 +60,5 @@ export default {
addons,
studiengang,
menu,
authinfo,
};
@@ -17,8 +17,12 @@ export const Stundenplan = {
studiensemester_kurzbz:null,
studiensemester_start:null,
studiensemester_ende:null,
uid:null,
}
},
props: [
"viewData",
],
watch: {
weekFirstDay: {
handler: async function (newValue) {
@@ -31,22 +35,19 @@ export const Stundenplan = {
immediate: true,
}
},
props: [
"viewData",
],
components: {
FhcCalendar, LvModal, LvMenu, LvInfo
},
computed:{
downloadLinks: function(){
if(!this.studiensemester_start || !this.studiensemester_ende)return;
if(!this.studiensemester_start || !this.studiensemester_ende || !this.uid )return;
let start = new Date(this.studiensemester_start);
start = Math.floor(start.getTime()/1000);
let ende = new Date(this.studiensemester_ende);
ende = Math.floor(ende.getTime() / 1000);
let download_link = (format, version = "", target = "") => `${FHC_JS_DATA_STORAGE_OBJECT.app_root}cis/private/lvplan/stpl_kalender.php?type=student&pers_uid=${this.viewData.uid}&begin=${start}&ende=${ende}&format=${format}${version ? '&version=' + version : ''}${target ? '&target=' + target : ''}`;
return [{ title: "excel", link: download_link('excel') }, { title: "csv", link: download_link('csv') }, { title: "ical1", link: download_link('ical', '1', 'ical') }, { title: "ical2", link: download_link('ical', '2', 'ical') }];
let download_link = (format, version = "", target = "") => `${FHC_JS_DATA_STORAGE_OBJECT.app_root}cis/private/lvplan/stpl_kalender.php?type=student&pers_uid=${this.uid}&begin=${start}&ende=${ende}&format=${format}${version ? '&version=' + version : ''}${target ? '&target=' + target : ''}`;
return [{ title: "excel", icon: 'fa-solid fa-file-excel', link: download_link('excel') }, { title: "csv", icon: 'fa-solid fa-file-csv', link: download_link('csv') }, { title: "ical1", icon: 'fa-regular fa-calendar', link: download_link('ical', '1', 'ical') }, { title: "ical2", icon: 'fa-regular fa-calendar', link: download_link('ical', '2', 'ical') }];
},
lv_id() { // computed so we can theoretically change path/lva selection and reload without page refresh
const pathParts = window.location.pathname.split('/').filter(Boolean);
@@ -149,6 +150,10 @@ export const Stundenplan = {
},
created()
{
this.$fhcApi.factory.authinfo.getAuthUID().then((res) => res.data)
.then(data=>{
this.uid = data.uid;
})
this.loadEvents();
},
beforeUnmount() {
@@ -160,8 +165,13 @@ export const Stundenplan = {
<lv-modal v-if="currentlySelectedEvent" :event="currentlySelectedEvent" ref="lvmodal" />
<fhc-calendar @selectedEvent="setSelectedEvent" :initial-date="currentDay" @change:range="updateRange" :events="events" initial-mode="week" show-weeks @select:day="selectDay" v-model:minimized="minimized">
<template #calendarDownloads>
<div v-for="{title,link} in downloadLinks">
<a :href="link" class="m-1 btn btn-outline-secondary">{{title}}</a>
<div v-for="{title,icon,link} in downloadLinks">
<a :href="link" :title="title" class="py-1 px-2 m-1 btn btn-outline-secondary">
<div class="d-flex flex-column">
<i :class="icon"></i>
<span class="small">{{title}}</span>
</div>
</a>
</div>
</template>
<template #monthPage="{event,day}">