Index: trunk/admin/relation_select.php
===================================================================
diff -u -r4309 -r6647
--- trunk/admin/relation_select.php	(.../relation_select.php)	(revision 4309)
+++ trunk/admin/relation_select.php	(.../relation_select.php)	(revision 6647)
@@ -16,25 +16,27 @@
 
 //KERNEL4 STARTUP - FOR ACTIONS HANDLING
 
-function k4getmicrotime() 
-{ 
-    list($usec, $sec) = explode(" ", microtime()); 
-    return ((float)$usec + (float)$sec); 
-} 
+function k4getmicrotime()
+{
+    list($usec, $sec) = explode(" ", microtime());
+    return ((float)$usec + (float)$sec);
+}
 
 $start = k4getmicrotime();
 
 define('ADMIN', 1);
 define('FULL_PATH', realpath(dirname(__FILE__).'/..'));
-define('APPLICATION_CLASS', 'MyApplication');
-include_once(FULL_PATH."/kernel/kernel4/startup.php");
+include_once(FULL_PATH."/core/kernel/startup.php");
 
 $application =& kApplication::Instance();
 $application->Init();
 $application->ProcessRequest();
 
-$main_processor =& $application->recallTagProcessor('m');
-$main_processor->StoreMainPrefix(Array());
+// save K4 redirection from popup stuff: begin
+$application->LinkVar('main_prefix');		// window prefix, that opened selector
+$application->LinkVar('dst_field');		// field to set value choosed in selector
+$application->LinkVar('return_template');	// template to go, when something was coosen from popup (from finalizePopup)
+// save K4 redirection from popup stuff: end
 
 if( $application->GetVar('CatId') ) $application->SetVar('m_cat_id', $application->GetVar('CatId') );
 //KERNEL4 END
@@ -128,7 +130,7 @@
 <script language="JavaScript1.2">
 	var enableContextMenus= true;
 	var doubleClickAction = 'select';
-	
+
 	function toggleTabB(tabId, atm)
 	{
     	var hl = document.getElementById("hidden_line");
@@ -148,17 +150,17 @@
 			toolbar.setTab(null);
 			showTab();
    		}
-   		else 
-   		{   
+   		else
+   		{
       		if (activeTab)
-      			toggleTab(tabId, true) 
-      		else 
+      			toggleTab(tabId, true)
+      		else
       			toggleTab(tabId, atm)
       		if (hl) hl.style.display = "none";
    		}
    		tab_hdr = document.getElementById('tab_headers');
-   		if (!tab_hdr) return; 
-		
+   		if (!tab_hdr) return;
+
 		// process all module tabs
 	   	var active_str = '';
    		for(var i = 0; i < tabIDs.length; i++)
@@ -176,15 +178,15 @@
       			var tab = document.getElementById(tabIDs[i]);
       			if (!tab) continue;
 				active_str = (tab.active) ? "tab_active" : "tab_inactive";
-				
+
       			if (TDs[j].getAttribute("tabHeaderOf") == tabId) {
 	      			// module tab is selected
 	      			SetBackground('l_' + tabId, "$imagesURL/itemtabs/" + active_str + "_l.gif");
 	        		SetBackground('m_' + tabId, "$imagesURL/itemtabs/" + active_str + ".gif");
 	      			SetBackground('m1_' + tabId, "$imagesURL/itemtabs/" + active_str + ".gif");
 	        		SetBackground('r_' + tabId, "$imagesURL/itemtabs/" + active_str + "_r.gif");
 	      		}
-	      		else 
+	      		else
 	      		{
 	      			// module tab is not selected
 	      			SetBackground('l_' +tabIDs[i], "$imagesURL/itemtabs/" + active_str + "_l.gif");
@@ -205,13 +207,13 @@
 		var categories = document.getElementById('categories');
 		if (!categories) return;
 		toggleCategories(instant);
-		
+
 		var active_str = '$imagesURL'+'/itemtabs/' + (categories.active ? 'tab_active' : 'tab_inactive');
 		SetBackground('l_cat', active_str + '_l.gif');
 		SetBackground('m_cat', active_str + '.gif');
 		SetBackground('m1_cat', active_str + '.gif');
 		SetBackground('r_cat', active_str + '_r.gif');
-	
+
 	   	var images = tabHeader.getElementsByTagName("IMG");
 	   	if (images.length < 1) return;
 			images[0].src = '$imagesURL'+'/itemtabs/' + ((categories.active) ? "divider_up" : "divider_dn") + ".gif";
@@ -235,7 +237,7 @@
 		    <tb:separator ImagePath="<?php echo $imagesURL."/toolbar/";?>">
       		<tb:button action="upcat" title="<?php echo admin_language("la_ToolTip_Up"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
 		    <tb:button action="homecat" title="<?php echo admin_language("la_ToolTip_Home"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
-		    <tb:separator ImagePath="<?php echo $imagesURL."/toolbar/";?>">  	   
+		    <tb:separator ImagePath="<?php echo $imagesURL."/toolbar/";?>">
             <tb:button action="view" title="<?php echo admin_language("la_ToolTip_View"); ?>" ImagePath="<?php echo $imagesURL."/toolbar/";?>">
 	    </div>
  	</td>
@@ -280,7 +282,7 @@
           			onmouseover="this.src='<?php echo $imagesURL."/toolbar/";?>/arrow16_f2.gif'"
           			onmouseout="this.src='<?php echo $imagesURL."/toolbar/";?>/arrow16.gif'"
           			style="cursor:hand">-->
-          	
+
           	<img
           			action="search_c"
           			src="<?php echo $imagesURL."/toolbar/";?>/icon16_search_reset.gif"
@@ -306,7 +308,7 @@
  <!-- CATEGORY DIVIDER -->
 <?php
     $objCatList->Clear();
-    $OrderBy = $objCatList->QueryOrderByClause(TRUE,TRUE,TRUE); 
+    $OrderBy = $objCatList->QueryOrderByClause(TRUE,TRUE,TRUE);
     if($SearchType=="categories" || $SearchType="all")
     {
       $list = $objSession->GetVariable('SearchWord');
@@ -389,17 +391,17 @@
 <?php
   if( GetVar('Selector') == 'radio' )
     echo "  var single_select = true;";
-?>   
+?>
    InitPage();
   cats_on = theMainScript.GetCookie('cats_tab_on');
    if (cats_on == 0) {
    	 toggleCategoriesB(document.getElementById('cats_tab'), true);
    }
-   
+
    tabs_on = theMainScript.GetCookie('tabs_on');
    if (tabs_on == '1' || tabs_on == null) {
 	   if(default_tab.length == 0 || default_tab == 'categories' )
-	   { 
+	   {
 	   		cookie_start = theMainScript.GetCookie('active_tab');
 	   		if (cookie_start != null) start_tab = cookie_start;
 	     if(start_tab!=null) {
@@ -413,7 +415,7 @@
 	       toggleTabB(default_tab,true);
 	   }
 	 }
-      
+
    //toggleTabB(start_tab, true);
 </script>
 <?php int_footer(); ?>