From fcadb3bc76486a217d32ec11e47b897943b28951 Mon Sep 17 00:00:00 2001 From: Uwe Trotzek Date: Fri, 17 Oct 2014 10:42:28 +0200 Subject: [PATCH 1/2] [FEATURE] new button "ignoreAccessTime" added in the admin panel. If activated, the start and endtime are ignored in the frontend. --- .../Classes/ContentObject/ContentObjectRenderer.php | 4 ++++ .../Classes/Controller/TypoScriptFrontendController.php | 12 ++++++++++++ typo3/sysext/frontend/Classes/Page/PageRepository.php | 14 ++++++++++++-- typo3/sysext/frontend/Classes/View/AdminPanelView.php | 1 + typo3/sysext/lang/locallang_tsfe.xlf | 3 +++ 5 files changed, 32 insertions(+), 2 deletions(-) diff --git a/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php b/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php index a889079..9d4a136 100644 --- a/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php +++ b/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php @@ -7273,6 +7273,10 @@ class ContentObjectRenderer { */ public function enableFields($table, $show_hidden = FALSE, array $ignore_array = array()) { $show_hidden = $show_hidden ?: ($table === 'pages' ? $GLOBALS['TSFE']->showHiddenPage : $GLOBALS['TSFE']->showHiddenRecords); + if ($GLOBALS['TSFE']->ignoreAccessTime){ + $ignore_array['starttime'] = 1; + $ignore_array['endtime'] = 1; + } return $GLOBALS['TSFE']->sys_page->enableFields($table, $show_hidden, $ignore_array); } diff --git a/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php b/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php index 58b39b0..766526f 100644 --- a/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php +++ b/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php @@ -252,6 +252,16 @@ class TypoScriptFrontendController { public $showHiddenRecords = FALSE; /** + * Flag indicating that start and entime of records should be ignored. This includes + * sys_template, pages_language_overlay and even fe_groups in addition to all + * other regular content. + * @var bool + * @todo Define visibility + */ + public $ignoreAccessTime = FALSE; + + + /** * Value that contains the simulated usergroup if any * @var int * @todo Define visibility @@ -1218,6 +1228,7 @@ class TypoScriptFrontendController { public function clear_preview() { $this->showHiddenPage = FALSE; $this->showHiddenRecords = FALSE; + $this->ignoreAccessTime = FALSE; $GLOBALS['SIM_EXEC_TIME'] = $GLOBALS['EXEC_TIME']; $GLOBALS['SIM_ACCESS_TIME'] = $GLOBALS['ACCESS_TIME']; $this->fePreview = 0; @@ -1320,6 +1331,7 @@ class TypoScriptFrontendController { } $this->showHiddenPage = (bool)$GLOBALS['BE_USER']->adminPanel->extGetFeAdminValue('preview', 'showHiddenPages'); $this->showHiddenRecords = (bool)$GLOBALS['BE_USER']->adminPanel->extGetFeAdminValue('preview', 'showHiddenRecords'); + $this->ignoreAccessTime = (bool)$GLOBALS['BE_USER']->adminPanel->extGetFeAdminValue('preview', 'ignoreAccessTime'); // Simulate date $simTime = $GLOBALS['BE_USER']->adminPanel->extGetFeAdminValue('preview', 'simulateDate'); if ($simTime) { diff --git a/typo3/sysext/frontend/Classes/Page/PageRepository.php b/typo3/sysext/frontend/Classes/Page/PageRepository.php index f40d480..dd6b69a 100644 --- a/typo3/sysext/frontend/Classes/Page/PageRepository.php +++ b/typo3/sysext/frontend/Classes/Page/PageRepository.php @@ -175,7 +175,11 @@ class PageRepository { if (!$show_hidden) { $this->where_hid_del .= 'AND pages.hidden=0 '; } - $this->where_hid_del .= 'AND pages.starttime<=' . $GLOBALS['SIM_ACCESS_TIME'] . ' AND (pages.endtime=0 OR pages.endtime>' . $GLOBALS['SIM_ACCESS_TIME'] . ') '; + + if (!$GLOBALS['TSFE']->ignoreAccessTime){ + $this->where_hid_del .= 'AND pages.starttime<=' . $GLOBALS['SIM_ACCESS_TIME'] . ' AND (pages.endtime=0 OR pages.endtime>' . $GLOBALS['SIM_ACCESS_TIME'] . ') '; + } + // Filter out new/deleted place-holder pages in case we are NOT in a // versioning preview (that means we are online!) if (!$this->versioningPreview) { @@ -1282,7 +1286,13 @@ class PageRepository { if ($table == 'pages') { $enFields = $this->versioningPreview_where_hid_del; } else { - $enFields = $this->enableFields($table, -1, array(), TRUE); + $ignore_array = array(); + if ($GLOBALS['TSFE']->ignoreAccessTime){ + $ignore_array['starttime'] = 1; + $ignore_array['endtime'] = 1; + } + + $enFields = $this->enableFields($table, -1, $ignore_array, TRUE); } // Select workspace version of record, only testing for deleted. $newrow = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow($fields, $table, 'pid=-1 AND diff --git a/typo3/sysext/frontend/Classes/View/AdminPanelView.php b/typo3/sysext/frontend/Classes/View/AdminPanelView.php index 3a618e7..ff90db8 100644 --- a/typo3/sysext/frontend/Classes/View/AdminPanelView.php +++ b/typo3/sysext/frontend/Classes/View/AdminPanelView.php @@ -345,6 +345,7 @@ class AdminPanelView { $this->extNeedUpdate = TRUE; $out .= $this->extGetItem('preview_showHiddenPages', '', 'uc['TSFE_adminConfig']['preview_showHiddenPages'] ? ' checked="checked"' : '') . ' />'); $out .= $this->extGetItem('preview_showHiddenRecords', '', 'uc['TSFE_adminConfig']['preview_showHiddenRecords'] ? ' checked="checked"' : '') . ' />'); + $out .= $this->extGetItem('preview_ignoreAccessTime', '', 'uc['TSFE_adminConfig']['preview_ignoreAccessTime'] ? ' checked="checked"' : '') . ' />'); // Simulate date $out .= $this->extGetItem('preview_simulateDate', ''); $this->extJSCODE .= 'TSFEtypo3FormFieldSet("TSFE_ADMIN_PANEL[preview_simulateDate]", "datetime", "", 0, 0);'; diff --git a/typo3/sysext/lang/locallang_tsfe.xlf b/typo3/sysext/lang/locallang_tsfe.xlf index fe65d7f..765d13c 100644 --- a/typo3/sysext/lang/locallang_tsfe.xlf +++ b/typo3/sysext/lang/locallang_tsfe.xlf @@ -18,6 +18,9 @@ Show hidden records + + Ignore access time + Simulate time -- 1.8.0.msysgit.0 From 8aca72fd926184b670e99eb60e04ac65076431c6 Mon Sep 17 00:00:00 2001 From: Uwe Trotzek Date: Fri, 17 Oct 2014 11:20:21 +0200 Subject: [PATCH 2/2] [FEATURE][WIP] clear cache after each admin panel refresh. This is necessary because the cache is not cleared for ignoreAccessTime value changes. Any other change clears the cache. I don't know why yet. --- typo3/sysext/frontend/Classes/View/AdminPanelView.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/typo3/sysext/frontend/Classes/View/AdminPanelView.php b/typo3/sysext/frontend/Classes/View/AdminPanelView.php index ff90db8..d969d08 100644 --- a/typo3/sysext/frontend/Classes/View/AdminPanelView.php +++ b/typo3/sysext/frontend/Classes/View/AdminPanelView.php @@ -136,7 +136,7 @@ class AdminPanelView { // Candidate for GeneralUtility::array_merge() if integer-keys will some day make trouble... unset($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['action']); // Actions: - if ($input['action']['clearCache'] && $this->isAdminModuleEnabled('cache')) { + if ($this->isAdminModuleEnabled('cache')) { $GLOBALS['BE_USER']->extPageInTreeInfo = array(); $theStartId = (int)$input['cache_clearCacheId']; $GLOBALS['TSFE']->clearPageCacheContent_pidList($GLOBALS['BE_USER']->extGetTreeList($theStartId, $this->extGetFeAdminValue('cache', 'clearCacheLevels'), 0, $GLOBALS['BE_USER']->getPagePermsClause(1)) . $theStartId); -- 1.8.0.msysgit.0