N°3617 collapsible components state saving : use user pref instead of localStorage

No migration from existing localStorage keys (introduced in 2.5.0 with N°1030) as the console UI has dramatically change in 3.0.0 : will be useful to show all the collapsible sections content once again !

Note that an iTop instance identifier was used in the localStorage key, it is no longer needed as we're getting the user pref directly from the current instance.

Thanks @Molkobain for the help !
This commit is contained in:
Pierre Goiffon
2021-01-12 18:14:25 +01:00
parent 09da54ee56
commit 790a675d90
7 changed files with 49 additions and 41 deletions

View File

@@ -461,28 +461,14 @@ JS
// TODO 3.0.0: To preserve
$this->add_ready_script(InlineImage::FixImagesWidth());
/*
* Not used since the sorting of the tables is always performed server-side
AttributeDateTime::InitTableSorter($this, 'custom_date_time');
AttributeDate::InitTableSorter($this, 'custom_date');
*/
// user pref for client side
// see GetUserPreference() in utils.js
$sUserPrefs = appUserPreferences::GetAsJSON();
$this->add_script("var oUserPreferences = $sUserPrefs;");
// TODO 3.0.0: What is this for?
$sUserPrefs = appUserPreferences::GetAsJSON();
$this->add_script(
<<<JS
// // for JQuery history
// function history_callback(hash)
// {
// // do stuff that loads page content based on hash variable
// var aMatches = /^tab_(.*)$/.exec(hash);
// if (aMatches != null)
// {
// var tab = $('#'+hash);
// tab.parents('div[id^=tabbedContent]:first').tabs('select', aMatches[1]);
// }
// }
function goBack()
{
window.history.back();
@@ -518,10 +504,6 @@ JS
$('#rawOutput').dialog( {autoOpen: true, modal:false, width: '80%'});
}
}
var oUserPreferences = $sUserPrefs;
JS
);