Commit be17bdfa authored by Dainis Abols's avatar Dainis Abols
Browse files

Bug fixes

parent 5ca72a8d
<?php
namespace Lu\LuNotices\Hooks\Backend;
use Lu\LuNotices\Controller\NoticesController;
use TYPO3\CMS\Core\Database\Query\QueryBuilder;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* Restrict notices records to topics assigned to user in backend list module
*
* @package Lu\LuNotices\Hooks\Backend
*/
class RecordListQueryHook
{
public function modifyQuery(
array &$parameters,
string $table,
int $pageId,
array $additionalConstraints,
array $fieldList,
QueryBuilder $queryBuilder
) {
global $BE_USER;
$noticesController = GeneralUtility::makeInstance(NoticesController::class);
$allowedTopics = $noticesController->getBeUserCatMounts($pageId);
if (empty($allowedTopics)) {
$allowedTopics = [0];
}
if ($table == 'tx_lunotices_domain_model_notices' && !$BE_USER->user['admin']) {
$queryBuilder->andWhere('topic_id IN ('.implode(',', $allowedTopics).')');
}
}
}
......@@ -4,7 +4,6 @@ defined('TYPO3_MODE') || die();
/**
* Include TypoScript
*/
// @extensionScannerIgnoreLine seems to be a false positive
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile(
'lu_notices',
'Configuration/TypoScript',
......
......@@ -12,9 +12,9 @@ plugin.lu_notices {
settings {
# cat=plugin.lu_notices/file; type=string; label=Path to CSS file
cssFile =
cssFile = EXT:lu_notices/Resources/Public/Css/styles.css
# cat=plugin.lu_notices/file; type=string; label=Path to JS file
jsFile =
}
}
\ No newline at end of file
}
LI.topic_info{
list-style:none;
padding-bottom:1em;
}
LI.notice_info{
margin-bottom: 1em;
}
UL.topic_list.all_topics LI.topic_info{
display:block;
width:450px;
height:550px;
overflow:hidden;
float:left;
border:1px solid #0F508D;
margin: 10px;
-webkit-border-radius: 11px;
-moz-border-radius: 11px;
border-radius: 11px;
position:relative;
}
UL.topic_list.all_topics LI.topic_info DIV.topic_title{
padding: 0;
margin:0;
color: white;
background-color: #0F508D;
border-radius: 10px 10px 0 0;
box-shadow: 2px 0 10px #AAAAAA;
}
UL.topic_list.all_topics LI.topic_info DIV.topic_title H2{
padding: 5px 15px;
margin:0;
}
UL.topic_list.all_topics LI.topic_info DIV.topic_title H2 A{
color: white !important;
}
UL.topic_list.all_topics LI.topic_info DIV.read_more{
position:absolute;
bottom: 10px;
right:10px;
clear:both;
margin: 10px;
color:#0F508D;
}
UL.topic_list.all_topics LI.topic_info DIV.read_more A{
color:#0F508D;
}
UL.topic_list.single_topic LI.topic_info DIV.read_more{
display:none;
}
LI.notice_info{
margin-bottom: 1em;
}
DIV.single_notice{
clear:both;
float:left;
width:100%;
}
DIV.single_notice DIV.notice_title h2, DIV.notice_navi {
clear: both;
float: left;
width: 100%;
text-align: center;
}
DIV.single_notice DIV.notice_date{
clear:both;
float:right;
}
DIV.single_notice DIV.notice_body,
DIV.single_notice DIV.notice_files{
clear:both;
/*float:left;*/
}
DIV.single_notice.notice_files,
DIV.notice_summary{
margin: 1em 0;
padding-left: 5px;
}
DIV.notice_navi{
font-weight: bold;
margin: 2em 0;
}
DIV.notice_navi SPAN{
padding: 0 1em;
}
DIV.notice_navi ul li{
list-style: none;
display: inline-block;
padding: 1px 4px;
}
DIV.notice_navi ul li.current{
border: 1px solid #ddd;
}
{
"name": "luitd/lu-notices",
"version": "4.1.4",
"version": "4.1.6",
"description": "General notice publisher for internal portal",
"type": "typo3-cms-extension",
"keywords": [
......
......@@ -9,7 +9,7 @@ $EM_CONF[$_EXTKEY] = [
'author_company' => 'University of Latvia',
'state' => 'stable',
'clearCacheOnLoad' => true,
'version' => '4.1.4',
'version' => '4.1.6',
'constraints' => [
'depends' => [
'typo3' => '9.5.0-9.9.99',
......
......@@ -21,3 +21,7 @@ defined('TYPO3_MODE') || die('Access denied.');
// Add elements for dev views
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig('<INCLUDE_TYPOSCRIPT: source="FILE:EXT:lu_notices/Configuration/TSConfig/mod.newElements.ts">');
// Register hooks
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][\TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList::class]['modifyQuery'][]
= \Lu\LuNotices\Hooks\Backend\RecordListQueryHook::class;
# Notices
Plugin is used to add notices for users.
> Plugin is used to add notices for users.
## Version
4.1.4
4.1.6
## Dependencies
* TYPO3 v9+
* TYPO3 v8+, v9+
## Author
- Dainis Abols <dainis.abols@lu.lv>
- Lauris Karklis <lauris.karklis@lu.lv>
Maija Zviedre <maija.zviedre@lu.lv>
Dainis Abols <dainis.abols@lu.lv>
Lauris Karklis <lauris.karklis@lu.lv>
## Template override constants
plugin.lu_notices
```
{
view.templateRootPath = EXT:lu_nabamusic/Resources/Private/Templates/
view.partialRootPath = EXT:lu_nabamusic/Resources/Private/Partials/
view.layoutRootPath = EXT:lu_nabamusic/Resources/Private/Layouts/
settings.cssFile =
settings.jsFile =
}
```
force_enable_all_action_buttons
```
mod.web_list.enableDisplayBigControlPanel=activated
```
``` plugin.lu_notices
{
view.templateRootPath = EXT:lu_nabamusic/Resources/Private/Templates/
view.partialRootPath = EXT:lu_nabamusic/Resources/Private/Partials/
view.layoutRootPath = EXT:lu_nabamusic/Resources/Private/Layouts/
settings.cssFile =
settings.jsFile =
}
```
``` force_enable_all_action_buttons
mod.web_list.enableDisplayBigControlPanel=activated
```
<?php
$config = require '/home/portal/typo3/typo3conf/LocalConfiguration.php';
$dsn = 'mysql:host='.$config['DB']['Connections']['Default']['host'].';dbname='.$config['DB']['Connections']['Default']['dbname'];
$db = new PDO($dsn, $config['DB']['Connections']['Default']['user'], $config['DB']['Connections']['Default']['password']);
$table = "tx_lunotices_domain_model_notices";
$sql = "UPDATE ".$table." SET sorting=? WHERE starttime=?";
$statement = $db->prepare($sql);
$sorting = 1;
foreach ($db->query("SELECT * FROM ".$table." ORDER BY starttime DESC") as $row) {
$statement->execute([$sorting, $row['starttime']]);
$sorting++;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment