This commit is contained in:
Holger Trampe 2021-09-06 22:27:33 +02:00
parent a366afe8f7
commit 644b914528
11 changed files with 84 additions and 23 deletions

View File

@ -1,2 +1,5 @@
<?php
\OCP\Util::addScript('da_agency', 'tm');

View File

@ -13,11 +13,11 @@
<nextcloud min-version="16"/>
</dependencies>
<navigations>
<navigation>
<!--<navigation>
<name>Uhr</name>
<route>da_agency.page.index</route>
<route>da_agency.page.startWorkDay</route>
<icon>app.svg</icon>
</navigation>
</navigation>-->
</navigations>
<types>
<filesystem/>

View File

@ -9,6 +9,9 @@ return [
],
'routes' => [
['name' => 'page#index', 'url' => '/', 'verb' => 'GET'],
# TIME MANAGEMENT
['name' => 'page#startWorkDay', 'url' => '/startday', 'verb' => 'GET'],
['name' => 'page#loadTime', 'url' => '/loadtime', 'verb' => 'GET'],
# AGENCY
['name' => 'agency#show', 'url' => '/getagencydata', 'verb' => 'GET'],
['name' => 'agency#updateagencydata', 'url' => '/updateagencydata', 'verb' => 'PUT'],

View File

@ -35,8 +35,6 @@ class Application extends App {
# Event before a File is deletet
$dispatcher->addServiceListener(BeforeNodeDeletedEvent::class, DeleteNCFileDjango::class);
#Util::addScript($this->appName, 'da_agency-timemanagement');
}
}

View File

@ -149,7 +149,7 @@ class AgencyController extends Controller {
* @CORS
*/
public function getlogdata(){
refickdichscheissnextclouidturn "NIX!";
}

View File

@ -5,19 +5,25 @@ namespace OCA\Agency\Controller;
use OCP\IRequest;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\AppFramework\Http\RedirectResponse;
use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\Controller;
use OCP\Util;
use OCP\IUserSession;
use OCA\Agency\Service\AgencyService;
class PageController extends Controller {
protected $appName;
protected $userSession;
private $service;
private $nclink = 'http://host.docker.internal:8000';
public function __construct($appName, IRequest $request, AgencyService $service) {
public function __construct($appName, IRequest $request, AgencyService $service, IUserSession $userSession) {
parent::__construct($appName, $request);
$this->appName = $appName;
$this->userSession = $userSession;
$this->service = $service;
}
@ -34,4 +40,55 @@ class PageController extends Controller {
$response = new TemplateResponse('da_agency', 'main');
return $response;
}
/**
* @NoCSRFRequired
*
* Gibt das Zeiterfassungsfenster als blankes Template zurück
*/
public function startWorkDay() {
$opts = [
"http" => array(
"method" => "GET",
"header" => ""
),
"ssl"=> array(
"verify_peer"=>false,
"verify_peer_name"=>false,
),
];
$context = stream_context_create($opts);
$file = file_get_contents($this->nclink.'/api/tm/startday/'.$this->userSession->getUser()->getUId().'/87zuhjk87GHJ546tzgvhas76aaskbdhr45edfVHAKia87s6gbAVGFGSR3451627gBHAKJBN', false, $context);
#$response = new TemplateResponse('da_agency', 'realtimeclock', ['userId' => $this->userSession->getUser()->getUID(), 'data' => "none"]);
if($file == "1"){
return new DataResponse("OK");
}
else {
return new DataResponse("FAIL");
}
}
/**
* @NoCSRFRequired
*
* Gibt das Zeiterfassungsfenster als blankes Template zurück
*/
public function loadTime() {
$opts = [
"http" => array(
"method" => "GET",
"header" => ""
),
"ssl"=> array(
"verify_peer"=>false,
"verify_peer_name"=>false,
),
];
$context = stream_context_create($opts);
$file = file_get_contents($this->nclink.'/api/tm/gettime/'.$this->userSession->getUser()->getUId().'/87zuhjk87GHJ546tzgvhas76aaskbdhr45edfVHAKia87s6gbAVGFGSR3451627gBHAKJBN', false, $context);
#$response = new TemplateResponse('da_agency', 'realtimeclock', ['userId' => $this->userSession->getUser()->getUID(), 'data' => "none"]);
return new DataResponse($file);
}
}

View File

@ -56,4 +56,6 @@ class PublicController extends OCSController {
$this->groupManager->get($id)->setDisplayName($name);
return new DataResponse(array("data" => $name." ".$id));
}
}

View File

@ -1,15 +1,18 @@
<template>
<Content app-name="App">
<h2>Single-column main content</h2>
<Content app-name="app">
<AppContent>
<div>This is the content</div>
</AppContent>
</Content>
</template>
<script>
import Content from '@nextcloud/vue/dist/Components/Content'
import AppContent from '@nextcloud/vue/dist/Components/AppContent'
export default {
name: 'App',
components: {
Content,
AppContent,
},
}
</script>

View File

@ -1,22 +1,22 @@
import Vue from 'vue'
import App from './App'
import VueRouter from 'vue-router'
import Routes from './router/routes'
// import VueRouter from 'vue-router'
// import Routes from './router/routes'
import VueFormulate from '@braid/vue-formulate'
import { de } from '@braid/vue-formulate-i18n'
Vue.use(VueRouter)
// Vue.use(VueRouter)
Vue.use(VueFormulate, {
plugins: [de],
locale: 'de',
})
Vue.prototype.$hostname = 'http://localhost:8080'
const router = new VueRouter({
routes: Routes,
})
// const router = new VueRouter({
// routes: Routes,
// })
export default new Vue({
el: '#content',
router,
// router,
render: h => h(App),
})

View File

@ -1,4 +0,0 @@
(function($) {
"use strict";
console.log("HI!");
}(jQuery));

View File

@ -1,2 +1 @@
<div id="vue-content"></div>
<div id="vue-content"></div>