diff --git a/Documentation/Installation.rst b/Documentation/Installation.rst index ccbda94b4e35ee674aa335c0bc67b38eabd494ff..4a0196abccd1899a2eda9ec2e8b90a967b19f9a9 100644 --- a/Documentation/Installation.rst +++ b/Documentation/Installation.rst @@ -246,12 +246,10 @@ Setup CSS & JS file05 = typo3conf/ext/qfq/Resources/Public/Css/qfq-bs.css file06 = typo3conf/ext/qfq/Resources/Public/Css/tablesorter-bootstrap.css file07 = typo3conf/ext/qfq/Resources/Public/Css/font-awesome.min.css + file08 = typo3conf/ext/qfq/Resources/Public/Css/bootstrap-datetimepicker.min.css # Only needed in case FullCalendar is used - file08 = typo3conf/ext/qfq/Resources/Public/Css/fullcalendar.min.css - - # Only needed in case FormElement 'datetime'/'date' is used - file09 = typo3conf/ext/qfq/Resources/Public/Css/bootstrap-datetimepicker.min.css + file09 = typo3conf/ext/qfq/Resources/Public/Css/fullcalendar.min.css } page.includeJS { @@ -268,17 +266,16 @@ Setup CSS & JS file11 = typo3conf/ext/qfq/Resources/Public/JavaScript/jquery.tablesorter.pager.min.js file12 = typo3conf/ext/qfq/Resources/Public/JavaScript/widget-columnSelector.min.js file13 = typo3conf/ext/qfq/Resources/Public/JavaScript/widget-output.min.js + file14 = typo3conf/ext/qfq/Resources/Public/JavaScript/bootstrap-datetimepicker.min.js # Only needed in case FormElement 'annotate' is used. - file14 = typo3conf/ext/qfq/Resources/Public/JavaScript/fabric.min.js - file15 = typo3conf/ext/qfq/Resources/Public/JavaScript/qfq.fabric.min.js + file15 = typo3conf/ext/qfq/Resources/Public/JavaScript/fabric.min.js + file16 = typo3conf/ext/qfq/Resources/Public/JavaScript/qfq.fabric.min.js - # Only needed in case FullCalendar is used - file16 = typo3conf/ext/qfq/Resources/Public/JavaScript/moment.min.js - file17 = typo3conf/ext/qfq/Resources/Public/JavaScript/fullcalendar.min.js + # Only needed in case FullCalendar is used. + file17 = typo3conf/ext/qfq/Resources/Public/JavaScript/moment.min.js + file18 = typo3conf/ext/qfq/Resources/Public/JavaScript/fullcalendar.min.js - # Only needed in case FormElement 'datetime'/'date' is used - file18 = typo3conf/ext/qfq/Resources/Public/JavaScript/bootstrap-datetimepicker.min.js } diff --git a/extension/Classes/Core/AbstractBuildForm.php b/extension/Classes/Core/AbstractBuildForm.php index 5d98a84b7f9a67c225ad20db1194dd6353ad21dd..08fc872de2391bdfeaf301a4940deaf02f6db0a4 100644 --- a/extension/Classes/Core/AbstractBuildForm.php +++ b/extension/Classes/Core/AbstractBuildForm.php @@ -858,8 +858,12 @@ abstract class AbstractBuildForm { } } + // Typehead might deliver an array, which is unwanted: fix this + if (is_array($value) && isset($value[0][API_TYPEAHEAD_VALUE])) { + $value = $value[0][API_TYPEAHEAD_VALUE]; + } + if ($formElement[FE_ENCODE] === FE_ENCODE_SPECIALCHAR) { -// $value = htmlspecialchars_decode($value, ENT_QUOTES); $value = Support::htmlEntityEncodeDecode(MODE_DECODE, $value); } elseif ($formElement[FE_ENCODE] === FE_ENCODE_SINGLE_TICK) { $value = OnString::escapeSingleTickInHtml($value); @@ -3139,7 +3143,7 @@ abstract class AbstractBuildForm { } // if FE type datetime and showSeconds is set, corrected format is needed - if($formElement[FE_TYPE] === FE_TYPE_DATETIME && $formElement[FE_SHOW_SECONDS] == 1 && $defaultDateFormat === 'DD.MM.YYYY HH:mm') { + if ($formElement[FE_TYPE] === FE_TYPE_DATETIME && $formElement[FE_SHOW_SECONDS] == 1 && $defaultDateFormat === 'DD.MM.YYYY HH:mm') { $defaultDateFormat .= ':ss'; } @@ -3148,10 +3152,10 @@ abstract class AbstractBuildForm { if ($formElement[FE_DATE_FORMAT] === 'hh:mm' || $formElement[FE_DATE_FORMAT] === 'hh:mm:ss' || $formElement[FE_SHOW_SECONDS] == 1) { if ($formElement[FE_DATE_FORMAT] === 'HH:mm:ss' || $formElement[FE_SHOW_SECONDS] == 1) { $defaultDateFormat = 'HH:mm:ss'; - }else { + } else { $defaultDateFormat = 'hh:mm'; } - }else{ + } else { $defaultDateFormat = 'HH:mm'; } } diff --git a/javascript/src/BSTabs.js b/javascript/src/BSTabs.js index 4ba1df972c5e308073d02146b646429c45e7bf60..fdb1955510add0f7fd32e8130a5d08f4141715b7 100644 --- a/javascript/src/BSTabs.js +++ b/javascript/src/BSTabs.js @@ -35,6 +35,8 @@ var QfqNS = QfqNS || {}; this.tabs = {}; this.currentTab = this.getActiveTabFromDOM(); this.eventEmitter = new EventEmitter(); + this.currentFormName = $('#' + this.tabId + ' .active a[data-toggle="tab"]')[0].hash.slice(1).split("_")[0]; + this.currentRecordId = $('#' + this.tabId + ' a[data-toggle="tab"]')[0].id.split("-")[2]; // Fill this.tabs this.fillTabInformation(); diff --git a/javascript/src/QfqPage.js b/javascript/src/QfqPage.js index 6914b6efb69a1da33e550204e7b0bd2d4542dd6b..ec3f21b5382ecdc97fff0a2f09a204a171d7badb 100644 --- a/javascript/src/QfqPage.js +++ b/javascript/src/QfqPage.js @@ -45,7 +45,36 @@ var QfqNS = QfqNS || {}; try { this.bsTabs = new n.BSTabs(this.settings.tabsId); + var storedFormInfos = []; + + // get current state from session storage + if(sessionStorage.getItem("formInfos") !== null) { + storedFormInfos = JSON.parse(sessionStorage.getItem("formInfos")); + } + + var currentForm = this.bsTabs.currentFormName; + var currentRecordId = this.bsTabs.currentRecordId; + + var actualIndex = -1; + var indexNr = 0; + if(storedFormInfos.length !== 0){ + if(storedFormInfos[0] !== ''){ + storedFormInfos.forEach(function callback(element){ + if(element === currentForm && storedFormInfos[indexNr+2] === currentRecordId){ + actualIndex = indexNr; + } + indexNr++; + }); + } + } + var currentState = this.settings.pageState.getPageState(); + + // load from sessionStorage or from path given hash if not empty + if(actualIndex !== -1 && location.hash === "") { + currentState = storedFormInfos[actualIndex+1]; + } + if (currentState !== "") { this.bsTabs.activateTab(currentState); n.PageTitle.setSubTitle(this.bsTabs.getTabName(currentState)); @@ -151,6 +180,53 @@ var QfqNS = QfqNS || {}; } var currentTabId = obj.target.getCurrentTab(); n.Log.debug('Saving state: ' + currentTabId); + + // Implementation save current state in session storage + var storedFormInfos = []; + + if(sessionStorage.getItem("formInfos") !== null){ + storedFormInfos = JSON.parse(sessionStorage.getItem("formInfos")); + } + + var currentForm = obj.target.currentFormName; + var currentRecordId = obj.target.currentRecordId; + + var actualIndex = -1; + var indexNr = 0; + if(storedFormInfos.length !== 0) { + if(storedFormInfos[0] !== ''){ + storedFormInfos.forEach(function callback(element){ + if(element === currentForm && storedFormInfos[indexNr + 2] === currentRecordId){ + actualIndex = indexNr; + } + indexNr++; + }); + } + } + + // fill sessionStorage, there are 3 ways for filling the sessionStorage: 1.If empty - first time filling, 2.If there is anything - add it to them, 3 + // 1.If array from storage is empty - fill it first time + if(storedFormInfos.length === 0){ + storedFormInfos[0] = currentForm; + storedFormInfos[1] = currentTabId; + storedFormInfos[2] = currentRecordId; + + // 2.If there is anything in storage but not the actual opened forms - add this new information to the existing array + }else if(actualIndex === -1) { + storedFormInfos[indexNr] = currentForm; + storedFormInfos[indexNr + 1] = currentTabId; + storedFormInfos[indexNr + 2] = currentRecordId; + + // 3.If actual openend form is included in sessionStorage - only change the array values of the existing informations + }else{ + storedFormInfos[actualIndex] = currentForm; + storedFormInfos[actualIndex + 1] = currentTabId; + storedFormInfos[actualIndex + 2] = currentRecordId; + } + + // Set sessionStorage with customized array + sessionStorage.setItem("formInfos" , JSON.stringify(storedFormInfos)); + n.PageTitle.setSubTitle(obj.target.getTabName(currentTabId)); this.settings.pageState.setPageState(currentTabId, n.PageTitle.get()); };