Index: trunk/core/kernel/application.php =================================================================== diff -u -N -r4845 -r4850 --- trunk/core/kernel/application.php (.../application.php) (revision 4845) +++ trunk/core/kernel/application.php (.../application.php) (revision 4850) @@ -623,6 +623,7 @@ $this->LinkVar('main_prefix'); // window prefix, that opened selector $this->LinkVar('dst_field'); // field to set value choosed in selector $this->LinkVar('return_template'); // template to go, when something was coosen from popup (from finalizePopup) + $this->LinkVar('return_m'); // main env part to restore after popup will be closed (from finalizePopup) } } Index: trunk/kernel/admin_templates/incs/script.js =================================================================== diff -u -N -r4724 -r4850 --- trunk/kernel/admin_templates/incs/script.js (.../script.js) (revision 4724) +++ trunk/kernel/admin_templates/incs/script.js (.../script.js) (revision 4850) @@ -356,15 +356,18 @@ function openSelector($prefix, $url, $dst_field, $window_size, $event) { var $kf = document.getElementById($form_name); - var $regex = new RegExp('(.*)\?env=' + document.getElementById('sid').value + '-(.*?):(.*)'); - var $t = $regex.exec($url)[2]; + var $regex = new RegExp('(.*)\?env=' + document.getElementById('sid').value + '-(.*?):(m[^:]+)'); + $regex = $regex.exec($url); + + var $t = $regex[2]; var $window_name = 'select_'+$t.replace(/(\/|-)/g, '_'); + set_hidden_field('return_m', $regex[3]); if (!isset($window_size)) $window_size = '750x400'; $window_size = $window_size.split('x'); - if(!isset($event)) $event=''; + if (!isset($event)) $event = ''; processHooks('openSelector', hBEFORE); var $prev_action = $kf.action; @@ -375,7 +378,7 @@ set_hidden_field('dst_field', $dst_field); set_hidden_field('return_template', $kf.elements['t'].value); // where should return after popup is done - openwin('',$window_name,$window_size[0],$window_size[1]); + openwin('', $window_name, $window_size[0], $window_size[1]); $kf.action = $url; $kf.target = $window_name; Index: trunk/core/kernel/utility/http_query.php =================================================================== diff -u -N -r4758 -r4850 --- trunk/core/kernel/utility/http_query.php (.../http_query.php) (revision 4758) +++ trunk/core/kernel/utility/http_query.php (.../http_query.php) (revision 4850) @@ -360,51 +360,18 @@ // env=SID:TEMPLATE:m-1-1-1-1:l0-0-0:n-0-0-0:bb-0-0-1-1-1-0 $env_var = $this->Get(ENV_VAR_NAME); - if($env_var) - { + if ($env_var) { + // replace escaped ":" symbol not to explode by it $env_var = str_replace('\:','_&+$$+&_', $env_var); // replace escaped "=" with spec-chars :) $parts = explode(':', $env_var); - if( !$this->Application->RewriteURLs() || ($this->Application->RewriteURLs() && $this->Get('rewrite') != 'on') ) - { + if (!$this->Application->RewriteURLs() || ($this->Application->RewriteURLs() && $this->Get('rewrite') != 'on')) { $this->extractSIDAndTemplate($parts); } - if($parts) - { - $query_maps = Array(); - $event_manger =& $this->Application->recallObject('EventManager'); - - $passed = Array(); - - foreach($parts as $mixed_part) - { - //In-portal old style env conversion - adds '-' between prefix and first var - $mixed_part = str_replace('_&+$$+&_',':',$mixed_part); - $mixed_part = preg_replace("/^([a-zA-Z]+)([0-9]+)-(.*)/", "$1-$2-$3", $mixed_part); - - $escaped_part = str_replace('\-', '_&+$$+&_', $mixed_part); - $escaped_part = explode('-', $escaped_part); - - $mixed_part = array(); - foreach ($escaped_part as $escaped_val) { - $mixed_part[] = str_replace('_&+$$+&_', '-', $escaped_val); - } - - $prefix_special = array_shift($mixed_part); // l.pick, l - $query_map = $event_manger->setQueryMap($prefix_special); - $this->Set('passed', implode(',', array_keys($event_manger->queryMaps))); - - // if config is not defined for prefix in QueryString, then don't process it - if ($query_map) { - foreach($query_map as $index => $var_name) - { - // l_id, l_page, l_bla-bla-bla - $val = $mixed_part[$index - 1]; - if ($val == '') $val = false; - $this->Set($prefix_special.'_'.$var_name, $val); - } - } + if ($parts) { + foreach ($parts as $mixed_part) { + $this->parseEnvPart($mixed_part); } } } @@ -414,7 +381,38 @@ $this->Set('t', $t); } } + + function parseEnvPart($mixed_part) + { + // In-portal old style env conversion - adds '-' between prefix and first var + $mixed_part = str_replace('_&+$$+&_', ':', $mixed_part); + $mixed_part = preg_replace("/^([a-zA-Z]+)([0-9]+)-(.*)/", "$1-$2-$3", $mixed_part); + // replace escaped "-" symbol not to explode by it + $escaped_part = str_replace('\-', '_&+$$+&_', $mixed_part); + $escaped_part = explode('-', $escaped_part); + + $mixed_part = Array(); + foreach ($escaped_part as $escaped_val) { + $mixed_part[] = str_replace('_&+$$+&_', '-', $escaped_val); + } + + $prefix_special = array_shift($mixed_part); // l.pick, l + $query_map = $this->Application->EventManager->setQueryMap($prefix_special); + $this->Set('passed', implode(',', array_keys($this->Application->EventManager->queryMaps))); + + // if config is not defined for prefix in QueryString, then don't process it + if ($query_map) { + foreach($query_map as $index => $var_name) + { + // l_id, l_page, l_bla-bla-bla + $val = $mixed_part[$index - 1]; + if ($val == '') $val = false; + $this->Set($prefix_special.'_'.$var_name, $val); + } + } + } + /** * Decides what template name to * use from $_GET or from $_POST Index: trunk/core/kernel/db/db_event_handler.php =================================================================== diff -u -N -r4785 -r4850 --- trunk/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 4785) +++ trunk/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 4850) @@ -1388,7 +1388,7 @@ * @param kEvent $event * @access public */ - function finalizePopup(&$event, $main_prefix = null, $t = null) + function finalizePopup(&$event) { $event->redirect = 'incs/close_popup'; @@ -1397,11 +1397,14 @@ $opener_stack = $opener_stack ? unserialize($opener_stack) : Array(); //array_pop($opener_stack); - if (!isset($t)) { - $t = $this->Application->RecallVar('return_template'); - $this->Application->RemoveVar('return_template'); - } - + $t = $this->Application->RecallVar('return_template'); + $this->Application->RemoveVar('return_template'); + + // restore original "m" prefix all params, that have values before opening selector + $return_m = $this->Application->RecallVar('return_m'); + $this->Application->RemoveVar('return_m'); + $this->Application->HttpQuery->parseEnvPart($return_m); + $pass_events = $event->getEventParam('pass_events'); $redirect_params = array_merge_recursive2($event->redirect_params, Array('m_opener' => 'u', '__URLENCODE__' => 1));