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 <?php
\OCP\Util::addScript('da_agency', 'tm'); \OCP\Util::addScript('da_agency', 'tm');

View File

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

View File

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

View File

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

View File

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

View File

@ -5,19 +5,25 @@ namespace OCA\Agency\Controller;
use OCP\IRequest; use OCP\IRequest;
use OCP\AppFramework\Http\TemplateResponse; use OCP\AppFramework\Http\TemplateResponse;
use OCP\AppFramework\Http\RedirectResponse;
use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\Controller; use OCP\AppFramework\Controller;
use OCP\Util; use OCP\Util;
use OCP\IUserSession;
use OCA\Agency\Service\AgencyService; use OCA\Agency\Service\AgencyService;
class PageController extends Controller { class PageController extends Controller {
protected $appName; protected $appName;
protected $userSession;
private $service; 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); parent::__construct($appName, $request);
$this->appName = $appName; $this->appName = $appName;
$this->userSession = $userSession;
$this->service = $service; $this->service = $service;
} }
@ -34,4 +40,55 @@ class PageController extends Controller {
$response = new TemplateResponse('da_agency', 'main'); $response = new TemplateResponse('da_agency', 'main');
return $response; 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); $this->groupManager->get($id)->setDisplayName($name);
return new DataResponse(array("data" => $name." ".$id)); return new DataResponse(array("data" => $name." ".$id));
} }
} }

View File

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

View File

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