-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Midhun Devasia
committed
Dec 12, 2016
0 parents
commit ee176cf
Showing
11 changed files
with
961 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<?php | ||
namespace Tutorboy\ServerClock\Hook; | ||
|
||
/* | ||
* This file is part of the ServerClock project. | ||
* Copyright (C) 2016 Midhun Devasia <[email protected]> | ||
* | ||
* It is free software; you can redistribute it and/or modify it under | ||
* the terms of the GNU General Public License, either version 3 | ||
* of the License, or any later version. | ||
* | ||
* For the full copyright and license information, please read the | ||
* LICENSE.txt file that was distributed with this source code. | ||
* | ||
* ServerClock - Show server clock | ||
*/ | ||
|
||
use TYPO3\CMS\Backend\Controller\BackendController; | ||
use MT\Hotelsystem\Utility\OurUtility; | ||
use TYPO3\CMS\Core\Page\PageRenderer; | ||
use TYPO3\CMS\Core\Utility\GeneralUtility; | ||
|
||
/** | ||
* Hook for backend controller | ||
* | ||
* @package ServerClock | ||
* @subpackage Hook | ||
* @copyright (c) 2016 Midhun Devasia, Tutorboy.org | ||
* @author Midhun Devasia <[email protected]> | ||
*/ | ||
class BackendControllerHook { | ||
|
||
/** | ||
* Insert clock widget content | ||
* @param array $configuration Configuration | ||
* @param BackendController $backendController Backend controller | ||
* @return void | ||
*/ | ||
public function insertClockWidget(array $configuration, BackendController $backendController) { | ||
$this->objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager::class); | ||
/** @var \TYPO3\CMS\Extensionmanager\Utility\ConfigurationUtility $configurationUtility */ | ||
$configurationUtility = $this->objectManager->get('TYPO3\CMS\Extensionmanager\Utility\ConfigurationUtility'); | ||
$extensionConfiguration = $configurationUtility->getCurrentConfiguration('server_clock'); | ||
if (version_compare(TYPO3_branch, '8.0', '>=')) { | ||
$queryElement = '.scaffold-toolbar.t3js-scaffold-toolbar .toolbar.t3js-topbar-toolbar ul'; | ||
} | ||
if (version_compare(TYPO3_branch, '7.0', '>=') && version_compare(TYPO3_branch, '8.0', '<')) { | ||
$queryElement = '#typo3-topbar-navigation .typo3-topbar-navigation-items'; | ||
} | ||
$this->getPageRenderer()->addJsInlineCode('ServerClock', ' | ||
var ClockWidget = ClockWidget || {}; | ||
ClockWidget.serverClockTimeZone = "' . date_default_timezone_get() . '"; | ||
ClockWidget.serverClockStartTime = "' . date('Y-m-d H:i:s') . '"; | ||
ClockWidget.serverClockDateTimeFormat = "' . $extensionConfiguration['datetimeFormat']['value'] . '"; | ||
ClockWidget.queryElement = "' . $queryElement . '"; | ||
'); | ||
$this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/ServerClock/ClockWidget'); | ||
|
||
$this->getPageRenderer()->addCssInlineBlock('ServerClockCss', ' | ||
#tutorboy-serverclock { | ||
display: inline; | ||
padding: 4px 10px; | ||
height: 45px; | ||
float: left; | ||
text-align:right; | ||
color: #aaa; | ||
border-right: 1px solid #111111; | ||
} | ||
'); | ||
} | ||
|
||
/** | ||
* PageRenderer object | ||
* @return PageRenderer | ||
*/ | ||
protected function getPageRenderer() { | ||
return GeneralUtility::makeInstance(PageRenderer::class); | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# ServerClock -Server Clock: Server Time and Timezone | ||
|
||
A Clock which shows server time and timezone in backend. The extension is available on [TER](https://typo3.org/extensions/repository/view/server_clock), you can install it from TYPO3 ExtensionManager or via composer. | ||
|
||
[![Latest Stable Version](https://img.shields.io/packagist/v/midhundevasia/typo3-serverclock.svg?style=flat-square)](https://packagist.org/packages/midhundevasia/typo3-serverclock) | ||
[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%205.5-8892BF.svg?style=flat-square)](https://php.net/) | ||
[![Build Status](https://travis-ci.org/midhundevasia/typo3-serverclock.svg?branch=master)](https://travis-ci.org/midhundevasia/typo3-serverclock) | ||
|
||
|
||
## Installation | ||
##### via ExtensionManager | ||
You can find the latest version in the TER(TYPO3 Extension Repository). | ||
Goto `Extensions` -> Choose `Get Extensions` from the dropdown -> Search `Server Clock` -> Install | ||
|
||
##### via Manual Setup | ||
Download the latest file from the GitHub or TER and copy folder to the `typo3conf/ext/` | ||
Then install it from the Extensions Module. | ||
|
||
##### via Composer | ||
composer require "typo3-ter/serverclock" | ||
|
||
##### via Composer for developers | ||
composer require "midhundevasia/typo3-serverclock" --no-scripts | ||
|
||
## Usage | ||
For better understanding read the [Documentation](https://github.com/midhundevasia/typo3-serverclock/wiki) | ||
|
||
## Contributing | ||
If you have a best practice code or feature, bugfix or translation just `Fork` and Send a `Pull Request`. | ||
|
||
|
||
## Help | ||
* If you find any security flaw just mail me (hello [at] midhundevasia.com) | ||
* You can report bugs [here](https://github.com/midhundevasia/typo3-serverclock/issues) | ||
|
||
## Donate | ||
I would like to spend my time here, if this extension realy helps, you are welcome to | ||
give some support | ||
|
||
[![paypal](https://www.paypalobjects.com/webstatic/en_US/i/btn/png/blue-rect-paypal-26px.png)](https://www.paypal.me/midhundevasia/) | ||
|
||
## TODO List | ||
[wiki/To-Do-list](https://github.com/midhundevasia/typo3-serverclock/wiki/To-Do-list) | ||
|
||
## ChangeLog | ||
[wiki/ChangeLog](https://github.com/midhundevasia/typo3-serverclock/wiki/ChangeLog) | ||
|
||
## License | ||
ServerClock is licensed under GNU General Public License (GPLv3) - see the `LICENSE` file for details. | ||
|
||
|
||
## Screenshot | ||
![](https://raw.githubusercontent.com/midhundevasia/typo3-serverclock/master/Documentation/Images/Version7.png) | ||
![](https://raw.githubusercontent.com/midhundevasia/typo3-serverclock/master/Documentation/Images/Version8.png) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<xliff version="1.0" xmlns:t3="http://typo3.org/schemas/xliff"> | ||
<file source-language="en" datatype="plaintext" original="messages" date="2016-12-12T11:16:11Z" product-name="server_clock"> | ||
<header/> | ||
<body> | ||
<trans-unit id="config.dateFormat"> | ||
<source>DateTime Format</source> | ||
</trans-unit> | ||
</body> | ||
</file> | ||
</xliff> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* This file is part of the ServerClock project. | ||
* Copyright (C) 2016 Midhun Devasia <[email protected]> | ||
* | ||
* It is free software; you can redistribute it and/or modify it under | ||
* the terms of the GNU General Public License, either version 3 | ||
* of the License, or any later version. | ||
* | ||
* For the full copyright and license information, please read the | ||
* LICENSE.txt file that was distributed with this source code. | ||
* | ||
* ServerClock - Show server clock | ||
*/ | ||
|
||
/** | ||
* Module: TYPO3/CMS/ServerClock/ClockWidget | ||
* Show server clock widget | ||
*/ | ||
define(['jquery'], function($) { | ||
ClockWidget = ClockWidget || {}; | ||
var sec = 0; | ||
ClockWidget.drawClock = function() { | ||
(sec == 60 ) ? sec = 1 : sec++; | ||
ClockWidget.date.setSeconds(sec); | ||
$("#serverclock-clock").html(ClockWidget.date.format(ClockWidget.serverClockDateTimeFormat)); | ||
}; | ||
ClockWidget.checkTime = function(i) { | ||
if (i < 10) {i = "0" + i}; | ||
return i; | ||
}; | ||
$(function() { | ||
setInterval(ClockWidget.drawClock, 1000); | ||
ClockWidget.date = new Date(ClockWidget.serverClockStartTime); | ||
sec = ClockWidget.date.getSeconds(); | ||
$(ClockWidget.queryElement).prepend("<li id='tutorboy-serverclock'><div id='serverclock-clock'></div><div id='serverclock-timezone'></div></li>"); | ||
$("#serverclock-clock").html(ClockWidget.date.format(ClockWidget.serverClockDateTimeFormat)); | ||
$("#serverclock-timezone").html(ClockWidget.serverClockTimeZone); | ||
}); | ||
return ClockWidget; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
{ | ||
"name": "midhundevasia/typo3-serverclock", | ||
"type": "typo3-cms-extension", | ||
"description": "Show server time in backend view", | ||
"homepage": "https://github.com/midhundevasia/typo3-serverclock", | ||
"support": { | ||
"issues": "https://github.com/midhundevasia/typo3-serverclock/issues" | ||
}, | ||
"version" : "1.0.0", | ||
"license": ["GPL-3.0+"], | ||
"authors": [ | ||
{ | ||
"name": "Midhun Devasia", | ||
"email": "[email protected]", | ||
"homepage": "http://midhundevasia.com/" | ||
} | ||
], | ||
"keywords": [ | ||
"TYPO3", "backend", "server", "time", "clock", "timezone" | ||
], | ||
"require": { | ||
"php" : ">=5.5", | ||
"typo3/cms": "^7.6 || ^8.4" | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "~4.8.0", | ||
"mikey179/vfsStream": "1.6.0", | ||
"typo3-ci/typo3cms": "6.2.4" | ||
}, | ||
"replace": { | ||
"server_clock": "self.version", | ||
"typo3-ter/server_clock": "self.version" | ||
}, | ||
"config": { | ||
"vendor-dir": "Build/vendor", | ||
"bin-dir": "Build/bin", | ||
"preferred-install" : { | ||
"typo3/cms": "source" | ||
} | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Tutorboy\\ServerClock\\": "Classes/" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"Tutorboy\\ServerClock\\Tests\\": "Tests/" | ||
} | ||
}, | ||
"scripts" : { | ||
"post-update-cmd" : "sh ./Build/setup.sh", | ||
"post-autoload-dump": [ | ||
"mkdir -p ./Build/Web/typo3conf/ext/", | ||
"[ -L ./Build/Web/typo3conf/ext/server_clock ] || ln -snvf ../../../../. ./Build/Web/typo3conf/ext/server_clock" | ||
] | ||
}, | ||
"extra": { | ||
"typo3/cms": { | ||
"cms-package-dir": "{$vendor-dir}/typo3/cms", | ||
"web-dir": "./Build/Web" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# cat=settings; type=string; label=LLL:EXT:server_clock/Resources/Private/Language/locallang.xlf:config.dateFormat | ||
datetimeFormat = jS F Y g:i:s A |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
/* | ||
* This file is part of the ServerClock project. | ||
* Copyright (C) 2016 Midhun Devasia <[email protected]> | ||
* | ||
* It is free software; you can redistribute it and/or modify it under | ||
* the terms of the GNU General Public License, either version 3 | ||
* of the License, or any later version. | ||
* | ||
* For the full copyright and license information, please read the | ||
* LICENSE.txt file that was distributed with this source code. | ||
* | ||
* ServerClock - Shows server clock | ||
*/ | ||
$EM_CONF[$_EXTKEY] = [ | ||
'title' => 'Server Clock: Server Time and Timezone', | ||
'description' => 'A Clock which shows server time and timezone in backend', | ||
'category' => 'services', | ||
'author' => 'Midhun Devasia', | ||
'author_email' => '[email protected]', | ||
'state' => 'stable', | ||
'internal' => '', | ||
'uploadfolder' => 0, | ||
'createDirs' => '', | ||
'clearCacheOnLoad' => 0, | ||
'version' => '1.0.0', | ||
'constraints' => [ | ||
'depends' => [ | ||
'typo3' => '7.6.0-8.9.99', | ||
], | ||
'conflicts' => [], | ||
'suggests' => [], | ||
], | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<?php | ||
defined('TYPO3_MODE') or die(); | ||
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/backend.php']['constructPostProcess'][] = 'Tutorboy\\ServerClock\\Hook\\BackendControllerHook->insertClockWidget'; |