Index: sandbox/2.4.1-3/phpgwapi/templates/default/login_default.php
===================================================================
--- sandbox/2.4.1-3/phpgwapi/templates/default/login_default.php	(revision 5281)
+++ sandbox/2.4.1-3/phpgwapi/templates/default/login_default.php	(revision 6352)
@@ -177,4 +177,46 @@
 			else
 				$_POST['login'] = $_POST['user'];
+
+			/**
+			 * LOGIN OAUTH POR CURL
+			 */
+			$ch = curl_init();
+
+			$param  = 'grant_type=password';
+			$param .= '&client_id=' . $GLOBALS['oauth']['client_id'];
+			$param .= '&client_secret=' . $GLOBALS['oauth']['client_secret'];
+			$param .= '&username=' . $_POST['user'];
+			$param .= '&password=' . $_POST['passwd'];
+
+			// set URL and other appropriate options
+			curl_setopt($ch, CURLOPT_URL, $GLOBALS['oauth']['url_token']);
+			curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: */*'));
+			curl_setopt($ch, CURLOPT_POST, TRUE);
+			curl_setopt($ch, CURLOPT_POSTFIELDS, $param);
+			curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);  //configura para nao imprimir a saida na tela
+			curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 2);//Passe um nï¿œmero long como parï¿œmetro que contï¿œm o limite de tempo, em segundos, que vocï¿œ permite as funï¿œï¿œes CURL levar. 
+
+			// grab URL and pass it to the browser
+			$res = curl_exec($ch);
+			
+			// close cURL resource, and free up system resources
+			curl_close($ch);
+			$a = json_decode($res);
+	
+			if ( isset($a->access_token) ) {
+				$_SESSION['oauth']['access_token'] = $a->access_token;
+				$_SESSION['oauth']['expires_in'] = $a->expires_in;
+				$_SESSION['oauth']['token_type'] = $a->token_type;
+				$_SESSION['oauth']['scope'] = $a->scope;
+				$_SESSION['oauth']['refresh_token'] = $a->refresh_token;
+				
+				
+			}
+			else {
+			}
+			/**
+			 * ####################
+			 */
+
 		}
 		if(getenv('REQUEST_METHOD') != 'POST' && $_SERVER['REQUEST_METHOD'] != 'POST' &&
@@ -598,5 +640,5 @@
 	if(isset($ultima_revisao)) $tmpl->set_var('ultima_rev','<br>' . $ultima_revisao);
 
-	// Adiciona código personalizado de outro template
+	// Adiciona cï¿œdigo personalizado de outro template
 	// que esteja utilizando o login_default.php
 	if(is_file('.'.$template_dir.'/login.inc.php')) {
Index: sandbox/2.4.1-3/.htaccess
===================================================================
--- sandbox/2.4.1-3/.htaccess	(revision 6098)
+++ sandbox/2.4.1-3/.htaccess	(revision 6352)
@@ -126,4 +126,6 @@
 RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK|OPTIONS|HEAD)$ [NC]
 RewriteRule ^.*$ - [F] 
+RewriteRule ^rest(.*)$ prototype/rest/$1 [QSA,L]
+
 
 #
Index: sandbox/2.4.1-3/home.php
===================================================================
--- sandbox/2.4.1-3/home.php	(revision 5042)
+++ sandbox/2.4.1-3/home.php	(revision 6352)
@@ -98,88 +98,129 @@
 		echo parse_navbar();
 	}
-	// Default Applications (Home Page) 
-	$default_apps = Array(			
-			'workflow',			
-			'expressoMail1_2',
-			'calendar',
-			'news_admin'
-		);
-	$sorted_apps = array();
-	$user_apps = $GLOBALS['phpgw_info']['user']['apps']; 
-	@reset($user_apps);	
-	for($i = 0; $i < count($default_apps);$i++) {
-		if(array_key_exists($default_apps[$i], $user_apps)){
-			$sorted_apps[] = $default_apps[$i];
-		}		
-	}
-	
-	foreach($GLOBALS['phpgw_info']['user']['apps'] as $i => $p) {
-		$sorted_apps[] = $p['name'];
-	}
-	
+
+/*
+//ESSE TRECHO DE CÃDIGO DEVE SER INSERIDO NOVAMENTE POSTERIORMENTE !!!!!!!!!!!
+
+        // Default Applications (Home Page) 
+        $default_apps = Array(                  
+                        'workflow',                     
+                        'expressoMail1_2',
+                        'calendar',
+                        'news_admin'
+                );
+        $sorted_apps = array();
+        $user_apps = $GLOBALS['phpgw_info']['user']['apps']; 
+        @reset($user_apps);     
+        for($i = 0; $i < count($default_apps);$i++) {
+                if(array_key_exists($default_apps[$i], $user_apps)){
+                        $sorted_apps[] = $default_apps[$i];
+                }               
+        }
+        
+        foreach($GLOBALS['phpgw_info']['user']['apps'] as $i => $p) {
+                $sorted_apps[] = $p['name'];
+        }
+
 	$portal_oldvarnames = array('mainscreen_showevents', 'homeShowEvents','homeShowLatest','mainscreen_showmail','mainscreen_showbirthdays','mainscreen_show_new_updated');
-	$done = array();
-	// Display elements, within appropriate table cells	
-	@reset($sorted_apps);
-	$idx = 1;
-	echo "<table width='100%' cellpadding=5>";
-	foreach($sorted_apps as $appname)
-	{
-		if((int)$done[$appname] == 1 || empty($appname)){
-			continue;
-		}		
-		$varnames = $portal_oldvarnames;
-		$varnames[] = 'homepage_display';
-		$thisd = 0;
-		$tmp = '';
-		
-		foreach($varnames as $varcheck)
-		{
-									
-			/*if($appname == 'expressoMail1_2') {
-				$tmp = $appname;
-				$appname = 'expressoMail';
-			}*/				
-
-			if(array_search($appname, $default_apps) !== False){
-				$thisd = 1;
-				break;
-			}
-			if($GLOBALS['phpgw_info']['user']['preferences'][$appname][$varcheck]=='True') {
-				$thisd = 1;
-				break;
-			}
-			else  {
-				$_thisd = (int)$GLOBALS['phpgw_info']['user']['preferences'][$appname][$varcheck];
-				if($_thisd > 0) {
-					$thisd = $_thisd;
-					break;
-				}
-			}
-		}
-
-		if($thisd > 0)
-		{
-			if($tmp) {
-               	$appname = $tmp;
-				$tmp = '';
-			}
-			if($idx == 0) {				
-				print '<tr>';
-			}
-			print '<td style="vertical-align:top;" width="45%">';
-			$GLOBALS['phpgw']->hooks->single('home',$appname);			
-			print '</td>';
-			
-			if($idx == 2){
-				$idx = 0;
-				print '</tr>';
-			}			
-			$idx++;
-			$neworder[] = $appname;
-		}
-		$done[$appname] = 1;
-	}
-	print '</table>';
+        $done = array();
+        // Display elements, within appropriate table cells     
+        @reset($sorted_apps);
+        $idx = 1;
+        echo "<table width='100%' cellpadding=5>";
+        foreach($sorted_apps as $appname)
+        {
+                if((int)$done[$appname] == 1 || empty($appname)){
+                        continue;
+                }
+                $varnames = $portal_oldvarnames;
+                $varnames[] = 'homepage_display';
+                $thisd = 0;
+                $tmp = '';
+
+                foreach($varnames as $varcheck)
+                {
+
+                        /*if($appname == 'expressoMail1_2') {
+                                $tmp = $appname;
+                                $appname = 'expressoMail';
+                        }*/
+/*
+                        if(array_search($appname, $default_apps) !== False){
+                                $thisd = 1;
+                                break;
+                        }
+                        if($GLOBALS['phpgw_info']['user']['preferences'][$appname][$varcheck]=='True') {
+                                $thisd = 1;
+                                break;
+                        }
+                        else  {
+                                $_thisd = (int)$GLOBALS['phpgw_info']['user']['preferences'][$appname][$varcheck];
+                                if($_thisd > 0) {
+                                        $thisd = $_thisd;
+                                        break;
+                                }
+                        }
+                }
+
+               if($thisd > 0)
+                {
+                        if($tmp) {
+                $appname = $tmp;
+                                $tmp = '';
+                        }
+                        if($idx == 0) {
+                                print '<tr>';
+                        }
+                        print '<td style="vertical-align:top;" width="45%">';
+                        $GLOBALS['phpgw']->hooks->single('home',$appname);
+                        print '</td>';
+
+                        if($idx == 2){
+                                $idx = 0;
+                                print '</tr>';
+                        }
+                        $idx++;
+                        $neworder[] = $appname;
+                }
+                $done[$appname] = 1;
+        }
+        print '</table>';
+*/
+
+
+
+//Inicio	
+	echo '
+            <link rel="Stylesheet" type="text/css" href="prototype/plugins/jquery/jquery-ui.css" />					
+    
+            <script type="text/javascript" src="prototype/plugins/jquery/jquery.min.js"></script>
+        
+            <script type="text/javascript" src="prototype/plugins/jquery/jquery-ui.min.js"></script>
+            <script type="text/javascript" src="prototype/plugins/jquery/jquery-ui.custom.min.js"></script>
+            <script src="prototype/plugins/json2/json2.js" language="javascript"></script>
+            <script src="prototype/plugins/ejs/ejs.js" language="javascript"></script>
+            <script src="prototype/plugins/store/jquery.store.js" language="javascript"></script>
+            
+            <script src="prototype/api/datalayer.js" language="javascript"></script>	
+           
+            <script type="text/javascript" src="prototype/plugins/datejs/date-pt-BR.js"></script>
+            <script type="text/javascript" src="prototype/plugins/datejs/sugarpak.js"></script>
+            <script type="text/javascript" src="prototype/plugins/datejs/parser.js"></script>
+
+	    <script type="text/javascript" src="prototype/plugins/countdown/jquery.countdown.min.js"></script>
+	    <script type="text/javascript" src="prototype/plugins/countdown/jquery.countdown-pt-BR.js"></script>
+
+	    <script type="text/javascript" src="prototype/modules/home/js/home.js"></script>
+	    <link rel="Stylesheet" type="text/css" href="prototype/modules/home/css/home.css" />	
+        ';
+
+	echo'
+	    <tr>
+		<td>
+		    <div class="portlets" style="width: 100%;"></div>
+		<td>
+	    </tr>';
+
+//Fim	
 	$GLOBALS['phpgw']->common->phpgw_footer();
 ?>
