Index: /trunk/phpgwapi/js/tools/xlink.js
===================================================================
--- /trunk/phpgwapi/js/tools/xlink.js	(revision 2439)
+++ /trunk/phpgwapi/js/tools/xlink.js	(revision 2459)
@@ -11,4 +11,5 @@
 		*/
 		var a = ( action.indexOf( 'admin/' ) > 0 || action.indexOf( '=admin.' ) > 0 );
+		a = ( a || action.indexOf( '=expressoAdmin1_2.' ) > 0 );
 		a = ( a || action.indexOf( 'calendar/' ) > 0 || action.indexOf( '=calendar.' ) > 0 );
 		a = ! ( a && ! ( action.indexOf( '#' ) === 0 || action.indexOf( window.location + '#' ) === 0 || action.indexOf( 'javascript:' ) === 0 ) );
Index: /trunk/expressoAdmin1_2/inc/class.uiaccounts.inc.php
===================================================================
--- /trunk/expressoAdmin1_2/inc/class.uiaccounts.inc.php	(revision 2419)
+++ /trunk/expressoAdmin1_2/inc/class.uiaccounts.inc.php	(revision 2459)
@@ -724,5 +724,8 @@
 				$t->set_var('display_samba_suport', 'none');
 			
+			echo "<script>var expressoAdmin_controller = '{$GLOBALS[ 'phpgw' ] -> link( '/expressoAdmin1_2/controller.php' )}?action=';</script>" . $GLOBALS[ 'phpgw' ] -> common -> get_java_script( );
+			echo "<style>{$this -> css( )}</style>";
 			$t->pfp('out','body');			
+			echo '<script>get_available_groups(document.forms[0].context.value);get_available_maillists(document.forms[0].context.value);use_samba_attrs("'.$user_info['sambaUser'].'");</script>';
 		}
 		
Index: /trunk/expressoAdmin1_2/inc/class.db_functions.inc.php
===================================================================
--- /trunk/expressoAdmin1_2/inc/class.db_functions.inc.php	(revision 2364)
+++ /trunk/expressoAdmin1_2/inc/class.db_functions.inc.php	(revision 2459)
@@ -11,5 +11,5 @@
         \**************************************************************************/
 define('PHPGW_INCLUDE_ROOT','./');	
-define('PHPGW_API_INC','phpgwapi/inc');
+define( 'PHPGW_API_INC', dirname( __FILE__ ) . '/../../phpgwapi/inc' );
 include_once(PHPGW_API_INC.'/class.db.inc.php');
 
Index: /trunk/expressoAdmin1_2/inc/class.uimanagers.inc.php
===================================================================
--- /trunk/expressoAdmin1_2/inc/class.uimanagers.inc.php	(revision 2419)
+++ /trunk/expressoAdmin1_2/inc/class.uimanagers.inc.php	(revision 2459)
@@ -124,5 +124,5 @@
 
 			$p->set_var($var);
-			echo $GLOBALS['phpgw']->js->get_script_links();
+			echo "<script>var expressoAdmin_controller = '{$GLOBALS[ 'phpgw' ] -> link( '/controller.php' )}?action=';</script>" . $GLOBALS['phpgw']->js->get_script_links( );
 			$p->pfp('out','body');
 		}
@@ -345,4 +345,5 @@
 			}
 			
+			echo "<script>var expressoAdmin_controller = '{$GLOBALS[ 'phpgw' ] -> link( '/expressoAdmin1_2/controller.php' )}?action=';</script>" . $GLOBALS['phpgw']->js->get_script_links( );
 			echo $p->fp('out','form');
 		}
Index: /trunk/expressoAdmin1_2/inc/class.uimaillists.inc.php
===================================================================
--- /trunk/expressoAdmin1_2/inc/class.uimaillists.inc.php	(revision 2419)
+++ /trunk/expressoAdmin1_2/inc/class.uimaillists.inc.php	(revision 2459)
@@ -85,5 +85,6 @@
 				'add_action'				=> $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uimaillists.add_maillists'),
 				'add_email_lists_disabled'	=> $this->functions->check_acl($manager_lid,'add_maillists') ? '' : 'disabled',
-				'context_display'			=> $context_display
+				'context_display'			=> $context_display,
+				'accounts_url'				=> $GLOBALS[ 'phpgw' ] -> link( '/', 'menuaction=expressoAdmin1_2.uimaillists.list_maillists' )
 			);
 			$p->set_var($var);
Index: /trunk/expressoAdmin1_2/inc/class.institutional_accounts.inc.php
===================================================================
--- /trunk/expressoAdmin1_2/inc/class.institutional_accounts.inc.php	(revision 2419)
+++ /trunk/expressoAdmin1_2/inc/class.institutional_accounts.inc.php	(revision 2459)
@@ -9,6 +9,4 @@
 	*  option) any later version.														*
 	\***********************************************************************************/
-
-	define('PHPGW_API_INC','../phpgwapi/inc');
 
 	class institutional_accounts
@@ -72,4 +70,5 @@
 			$p->set_var($this->functions->make_dinamic_lang($p, 'institutional_accounts_modal'));
 
+			$p->set_var( 'url', $this -> url );
 
 			/* Begin: set modal */
@@ -100,4 +99,5 @@
 			$p->set_var($var);
 			$p->pfp('out','body');
+			echo "<script>var expressoAdmin_url = '{$GLOBALS[ 'phpgw' ] -> link( '/expressoAdmin1_2/' )}';var expressoAdmin_controller = '{$GLOBALS[ 'phpgw' ] -> link( '/expressoAdmin1_2/controller.php' )}?action=';</script>" . $GLOBALS[ 'phpgw' ] -> common -> get_java_script( );
 		}
 
Index: /trunk/expressoAdmin1_2/inc/class.uigroups.inc.php
===================================================================
--- /trunk/expressoAdmin1_2/inc/class.uigroups.inc.php	(revision 2419)
+++ /trunk/expressoAdmin1_2/inc/class.uigroups.inc.php	(revision 2459)
@@ -89,5 +89,6 @@
 				'add_action'			=> $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uigroups.add_groups'),
 				'add_group_disabled'	=> $this->functions->check_acl($account_lid,'add_groups') ? '' : 'disabled',
-				'context_display'		=> $context_display
+				'context_display'		=> $context_display,
+				'accounts_url'			=> $GLOBALS[ 'phpgw' ] -> link( '/', 'menuaction=expressoAdmin1_2.uigroups.list_groups' )
 			);
 			$p->set_var($var);
Index: /trunk/expressoAdmin1_2/inc/class.ldap_functions.inc.php
===================================================================
--- /trunk/expressoAdmin1_2/inc/class.ldap_functions.inc.php	(revision 2364)
+++ /trunk/expressoAdmin1_2/inc/class.ldap_functions.inc.php	(revision 2459)
@@ -10,7 +10,7 @@
         *  option) any later version.                                              *
         \**************************************************************************/
-define('PHPGW_INCLUDE_ROOT','./');
-define('PHPGW_API_INC','./phpgwapi/inc');	
-include_once(PHPGW_API_INC.'/class.common.inc.php');
+
+$GLOBALS['phpgw_info']['flags']['currentapp'] = 'expressoAdmin1_2';
+include_once dirname( __FILE__ ) . '/../../header.inc.php';
 include_once('class.functions.inc.php');
 
@@ -54,4 +54,14 @@
 		$manager_acl = $this->functions->read_acl($_SESSION['phpgw_info']['expresso']['user']['account_lid']);
 		$this->manager_contexts = $manager_acl['contexts'];
+
+		$webserver_url = $GLOBALS['phpgw_info']['server']['webserver_url'];
+		$webserver_url = ( !empty($webserver_url) ) ? $webserver_url : '/';
+
+		if(strrpos($webserver_url,'/') === false || strrpos($webserver_url,'/') != (strlen($webserver_url)-1))
+			$webserver_url .= '/';
+
+		$webserver_url = "{$webserver_url}expressoAdmin1_2/";
+
+		$this -> url = $webserver_url;
 	}
 
@@ -2265,5 +2275,5 @@
 			for ($i=0; $i<$entries['count']; $i++)
 			{
-				$tr = "<tr class='normal' onMouseOver=this.className='selected' onMouseOut=this.className='normal'><td onClick=edit_institutional_account('".$entries[$i]['uid'][0]."')>" . $entries[$i]['cn'][0] . "</td><td onClick=edit_institutional_account('".$entries[$i]['uid'][0]."')>" . $entries[$i]['mail'][0] . "</td><td align='center' onClick=delete_institutional_accounts('".$entries[$i]['uid'][0]."')><img HEIGHT='16' WIDTH='16' src=./expressoAdmin1_2/templates/default/images/delete.png></td></tr>";
+				$tr = "<tr class='normal' onMouseOver=this.className='selected' onMouseOut=this.className='normal'><td onClick=edit_institutional_account('".$entries[$i]['uid'][0]."')>" . $entries[$i]['cn'][0] . "</td><td onClick=edit_institutional_account('".$entries[$i]['uid'][0]."')>" . $entries[$i]['mail'][0] . "</td><td align='center' onClick=delete_institutional_accounts('".$entries[$i]['uid'][0]."')><img HEIGHT='16' WIDTH='16' src={$this -> url}templates/default/images/delete.png></td></tr>";
 				$trs[$tr] = $entries[$i]['cn'][0];
 			}
@@ -2359,5 +2369,5 @@
 			for ($i=0; $i<$entries['count']; $i++)
 			{
-				$tr = "<tr class='normal' onMouseOver=this.className='selected' onMouseOut=this.className='normal'><td onClick=edit_shared_account('".$entries[$i]['uid'][0]."')>" . $entries[$i]['cn'][0] . "</td><td onClick=edit_shared_account('".$entries[$i]['uid'][0]."')>" . $entries[$i]['mail'][0] . "</td><td align='center' onClick=delete_shared_accounts('".$entries[$i]['uid'][0]."')><img HEIGHT='16' WIDTH='16' src=./expressoAdmin1_2/templates/default/images/delete.png></td></tr>";
+				$tr = "<tr class='normal' onMouseOver=this.className='selected' onMouseOut=this.className='normal'><td onClick=edit_shared_account('".$entries[$i]['uid'][0]."')>" . $entries[$i]['cn'][0] . "</td><td onClick=edit_shared_account('".$entries[$i]['uid'][0]."')>" . $entries[$i]['mail'][0] . "</td><td align='center' onClick=delete_shared_accounts('".$entries[$i]['uid'][0]."')><img HEIGHT='16' WIDTH='16' src={$this -> url}templates/default/images/delete.png></td></tr>";
 				$trs[$tr] = $entries[$i]['cn'][0];
 			}
Index: /trunk/expressoAdmin1_2/inc/class.manager.inc.php
===================================================================
--- /trunk/expressoAdmin1_2/inc/class.manager.inc.php	(revision 1913)
+++ /trunk/expressoAdmin1_2/inc/class.manager.inc.php	(revision 2459)
@@ -1,3 +1,3 @@
-<?
+<?php
 	/***********************************************************************************\
 	* Expresso Administração                 										   *
Index: /trunk/expressoAdmin1_2/js/jscode/connector.js
===================================================================
--- /trunk/expressoAdmin1_2/js/jscode/connector.js	(revision 317)
+++ /trunk/expressoAdmin1_2/js/jscode/connector.js	(revision 2459)
@@ -467,5 +467,5 @@
 //------------------------------------  END: Functions for Progress Bar  -------------------------------------------------//
 	// Default Controller File
-	var DEFAULT_URL = 'expressoAdmin1_2/controller.php?action=';
+	var DEFAULT_URL = expressoAdmin_controller;
 	// connector object
 	var connector = new cConnector();
Index: /trunk/expressoAdmin1_2/js/jscode/expressoadmin.js
===================================================================
--- /trunk/expressoAdmin1_2/js/jscode/expressoadmin.js	(revision 1991)
+++ /trunk/expressoAdmin1_2/js/jscode/expressoadmin.js	(revision 2459)
Index: /trunk/expressoAdmin1_2/js/modal/modal.js
===================================================================
--- /trunk/expressoAdmin1_2/js/modal/modal.js	(revision 1975)
+++ /trunk/expressoAdmin1_2/js/modal/modal.js	(revision 2459)
@@ -186,7 +186,7 @@
 	cssNode.rel = 'stylesheet';
 	if (navigator.userAgent.toLowerCase().indexOf("msie") != -1)
-		cssNode.href = "./expressoAdmin1_2/js/modal/css/modal_ie.css";
+		cssNode.href = expressoAdmin_url + "js/modal/css/modal_ie.css";
 	else
-		cssNode.href = "./expressoAdmin1_2/js/modal/css/modal_fx.css";
+		cssNode.href = expressoAdmin_url + "js/modal/css/modal_fx.css";
 	
 	cssNode.media = 'screen';
Index: /trunk/expressoAdmin1_2/templates/default/sectors_form.tpl
===================================================================
--- /trunk/expressoAdmin1_2/templates/default/sectors_form.tpl	(revision 1991)
+++ /trunk/expressoAdmin1_2/templates/default/sectors_form.tpl	(revision 2459)
@@ -9,6 +9,6 @@
  </table>
  
-  <table border="0" align="center">
-  	<form method="POST" action="{action}">
+  <form method="POST" action="{action}">
+    <table border="0" align="center">
 		<tr bgcolor={row_off}>
 			<td>{lang_organizations}:</td>
@@ -68,6 +68,6 @@
    			</td>
  		</tr>
- 	</form>
-  </table>
+    </table>
+  </form>
  {error_messages}
 <!-- END list -->
Index: /trunk/expressoAdmin1_2/templates/default/institutional_accounts.tpl
===================================================================
--- /trunk/expressoAdmin1_2/templates/default/institutional_accounts.tpl	(revision 1458)
+++ /trunk/expressoAdmin1_2/templates/default/institutional_accounts.tpl	(revision 2459)
@@ -1,4 +1,4 @@
 <!-- BEGIN body -->
-	<link rel="stylesheet" type="text/css" href="./expressoAdmin1_2/templates/default/institutional_accounts.css">
+	<link rel="stylesheet" type="text/css" href="{url}templates/default/institutional_accounts.css">
 	<div style="display:none" id="{modal_id}">{institutional_accounts_modal}</div>
 
Index: /trunk/expressoAdmin1_2/templates/default/institutional_accounts_modal.tpl
===================================================================
--- /trunk/expressoAdmin1_2/templates/default/institutional_accounts_modal.tpl	(revision 1991)
+++ /trunk/expressoAdmin1_2/templates/default/institutional_accounts_modal.tpl	(revision 2459)
@@ -38,7 +38,7 @@
 						
 		<td width="10%" valign="middle" align="center" bgcolor="#DDDDDD">
-			<button type="button" onClick="javascript:add_user();"><img src="expressoAdmin1_2/templates/default/images/add.png" style="vertical-align: middle;">&nbsp;{lang_add_owner}</button>
+			<button type="button" onClick="javascript:add_user();"><img src="{url}templates/default/images/add.png" style="vertical-align: middle;">&nbsp;{lang_add_owner}</button>
 			<br><br>
-			<button type="button" onClick="javascript:remove_user();"><img src="expressoAdmin1_2/templates/default/images/rem.png" style="vertical-align: middle;">&nbsp;{lang_remove_owner}</button>
+			<button type="button" onClick="javascript:remove_user();"><img src="{url}templates/default/images/rem.png" style="vertical-align: middle;">&nbsp;{lang_remove_owner}</button>
 		</td>
 						
Index: /trunk/controller.php
===================================================================
--- /trunk/controller.php	(revision 2426)
+++ /trunk/controller.php	(revision 2459)
@@ -61,5 +61,9 @@
 		if( strpos($app, '$this/') === 0 )
 		{
-			$filename = str_replace('$this/','',$app) . '.php';
+			$_app = '';
+			$url = parse_url( $_SERVER[ 'HTTP_REFERER' ] );
+			if ( ( $pos = strpos( $url[ 'query' ], 'menuaction' ) ) !== false )
+				$_app = strstr( substr( $url[ 'query' ], $pos + 11 ), '.', true ) . '/';
+			$filename = str_replace( '$this/', $_app, $app ) . '.php';
 			include_once($filename);
 			exit;
