This commit is contained in:
Roly Rudy Gutierrez Pinto
2016-02-25 17:52:40 -04:00
parent abdc846944
commit 92e3d2ebca
6 changed files with 80 additions and 1 deletions

File diff suppressed because one or more lines are too long

View File

@@ -557,3 +557,42 @@ function getBrowserTimeZoneOffset()
return -1 * ((new Date()).getTimezoneOffset() * 60);
}
/**
* This is the global state manager. By default all components that are
* "state aware" check this class for state information if you don't pass them a
* custom state provider. In order for this class to be useful, it must be
* initialized with a provider when your application initializes.
*
* @param {string} cache
* @param {string} additionalPrefix
* @returns {undefined}
*/
function setExtStateManagerSetProvider(cache, additionalPrefix) {
var workspace = 'ws-undefined';
var pathname = location.pathname.split('/');
var cookieProvider = new Ext.state.CookieProvider();
var i;
if (additionalPrefix === undefined) {
additionalPrefix = '';
}
if (pathname.length > 1) {
workspace = pathname[1].replace('sys', '');
}
workspace = workspace + additionalPrefix;
cookieProvider.on('statechange', function (provider, key, value) {
if (value !== null && JSON.stringify(Ext.state.Manager.get(workspace + cache)) !== JSON.stringify(value)) {
Ext.state.Manager.set(workspace + cache, value);
}
});
Ext.state.Manager.setProvider(cookieProvider);
Ext.state.Manager.clear(cache);
try {
if (window.extJsViewState !== undefined) {
for (i in extJsViewState) {
Ext.state.Manager.clear(i);
}
Ext.state.Manager.set(cache, Ext.state.Manager.getProvider().decodeValue(extJsViewState[workspace + cache]));
}
} catch (e) {
}
}

View File

@@ -737,5 +737,39 @@ class headPublisher
{
$this->disableHeaderScripts = true;
}
/**
* Gets an array that contains the status of the view.
*
* @return array $views
*/
public function getExtJsViewState()
{
$views = array();
$keyState = "extJsViewState";
$prefixExtJs = "ys-";
$oServerConf = &serverConf::getSingleton();
$deleteCache = true;
$sjson = $oServerConf->getProperty($keyState);
if ($sjson !== "") {
$json = G::json_decode($sjson);
foreach ($json as $key => $value) {
$views[$key] = $value;
}
}
$httpCookies = explode("; ", $_SERVER['HTTP_COOKIE']);
foreach ($httpCookies as $cookie) {
$value = explode("=", $cookie);
if (count($value) > 1 && substr($value[0], 0, 3) === $prefixExtJs) {
$deleteCache = false;
$key = substr($value[0], 3);
$views[$key] = $value[1];
}
}
$oServerConf->setProperty($keyState, G::json_encode($views));
return $views;
}
}

View File

@@ -222,6 +222,7 @@ $oHeadPublisher->addExtJsScript( 'app/main', true );
$oHeadPublisher->addExtJsScript( 'cases/casesList', false ); //adding a javascript file .js
$oHeadPublisher->addContent( 'cases/casesListExtJs' ); //adding a html file .html.
$oHeadPublisher->assign( 'FORMATS', $c->getFormats() );
$oHeadPublisher->assign('extJsViewState', $oHeadPublisher->getExtJsViewState());
$ieVersion = null;
if(preg_match("/^.*\(.*MSIE (\d+)\..+\).*$/", $_SERVER["HTTP_USER_AGENT"], $arrayMatch) || preg_match("/^.*\(.*rv.(\d+)\..+\).*$/", $_SERVER["HTTP_USER_AGENT"], $arrayMatch)){
$ieVersion = intval($arrayMatch[1]);

View File

@@ -78,6 +78,7 @@ $oHeadPublisher->assign("arrayFlagImportFileExtension", $arrayFlagImportFileExte
$oHeadPublisher->assign("arrayFlagMenuNewOption", $arrayFlagMenuNewOption);
$oHeadPublisher->assign("arrayMenuNewOptionPlugin", $arrayMenuNewOptionPlugin);
$oHeadPublisher->assign("arrayContextMenuOptionPlugin", $arrayContextMenuOptionPlugin);
$oHeadPublisher->assign('extJsViewState', $oHeadPublisher->getExtJsViewState());
$oPluginRegistry = & PMPluginRegistry::getSingleton();
$callBackFile = $oPluginRegistry->getImportProcessCallback();

View File

@@ -44,7 +44,7 @@ Ext.apply(Ext.form.VTypes, {
});
Ext.onReady(function(){
Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
setExtStateManagerSetProvider('gridProcessMain');
Ext.QuickTips.init();
store = new Ext.data.GroupingStore( {