R49049 - in /branches/14.1: addressbook/inc/ egroupware/ mail/inc/ phpgwapi/inc/ phpgwapi/js/jsapi/

Author: ralfbecker
New Revision: 49049

URL: http://svn.stylite.de/viewvc/egroupware?rev=49049&view=rev
Log:
fix redirects in a popup and new egw_exception_redirect to be used in hooks/callbacks like for addressbook.edit to redirect to a different location
r49022: resize import popup to regular compose size

Modified:
branches/14.1/addressbook/inc/class.addressbook_ui.inc.php
branches/14.1/egroupware/json.php
branches/14.1/mail/inc/class.mail_ui.inc.php
branches/14.1/phpgwapi/inc/class.egw_exception.inc.php
branches/14.1/phpgwapi/inc/common_functions.inc.php
branches/14.1/phpgwapi/js/jsapi/egw_json.js

Modified: branches/14.1/addressbook/inc/class.addressbook_ui.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/branches/14.1/addressbook/inc/class.addressbook_ui.inc.php?rev=49049&r1=49048&r2=49049&view=diff

— branches/14.1/addressbook/inc/class.addressbook_ui.inc.php (original)
+++ branches/14.1/addressbook/inc/class.addressbook_ui.inc.php Fri Oct 17 14:51:02 2014
@@ -1786,6 +1786,10 @@
$content[‘msg’] .= ', '.$success_msg;
}
}

  •   					catch(egw_exception_redirect $r)
    
  •   					{
    
  •   						// catch it to continue execution and rethrow it later
    
  •   					}
      					catch (Exception $ex) {
      						$content['msg'] .= ', '.$ex->getMessage();
      						$button = 'apply';	// do not close dialog
    

@@ -1832,6 +1836,12 @@
}
egw_framework::refresh_opener($content[‘msg’], ‘addressbook’, $content[‘id’], $content[‘id’] ? ‘update’ : ‘add’,
null, null, null, $this->error ? ‘error’ : ‘success’);
+

  •   			// re-throw redirect exception, if there's no error
    
  •   			if (!$this->error && isset($r))
    
  •   			{
    
  •   				throw $r;
    
  •   			}
      			if ($button == 'save')
      			{
      				egw_framework::window_close();
    

Modified: branches/14.1/egroupware/json.php
URL: http://svn.stylite.de/viewvc/egroupware/branches/14.1/egroupware/json.php?rev=49049&r1=49048&r2=49049&view=diff

— branches/14.1/egroupware/json.php (original)
+++ branches/14.1/egroupware/json.php Fri Oct 17 14:51:02 2014
@@ -35,6 +35,11 @@
*/
function ajax_exception_handler(Exception $e)
{

  • // handle redirects without logging
  • if (is_a($e, ‘egw_exception_redirect’))
  • {
  •   egw::redirect($e->url, $e->app);
    
  • }
    // logging all exceptions to the error_log
    $message = null;
    if (function_exists(’_egw_log_exception’))

Modified: branches/14.1/mail/inc/class.mail_ui.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/branches/14.1/mail/inc/class.mail_ui.inc.php?rev=49049&r1=49048&r2=49049&view=diff

— branches/14.1/mail/inc/class.mail_ui.inc.php (original)
+++ branches/14.1/mail/inc/class.mail_ui.inc.php Fri Oct 17 14:51:02 2014
@@ -3112,8 +3112,10 @@
}
if (!$importFailed)
{

  •   		list($width, $height) = explode('x', egw_link::get_registry('mail', 'add_popup'));
    
  •   		if ($width > 0 && $height > 0) egw_json_response::get()->call('resizeTo', $width, $height);
      		ExecMethod2('mail.mail_ui.displayMessage',$linkData);
    
  •   		exit;
    
  •   		return;
      	}
      }
      if (!is_array($content)) $content = array();
    

Modified: branches/14.1/phpgwapi/inc/class.egw_exception.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/branches/14.1/phpgwapi/inc/class.egw_exception.inc.php?rev=49049&r1=49048&r2=49049&view=diff

— branches/14.1/phpgwapi/inc/class.egw_exception.inc.php (original)
+++ branches/14.1/phpgwapi/inc/class.egw_exception.inc.php Fri Oct 17 14:51:02 2014
@@ -27,6 +27,10 @@
class egw_exception extends Exception
{
// nothing fancy yet

  • function __construct($msg=null,$code=100,Exception $previous=null)
  • {
  •   return parent::__construct($msg, $code, $previous);
    
  • }
    }

/**
@@ -38,8 +42,8 @@
/**
* Constructor
*

    • @param string $msg=null message, default “Permission denied!”
    • @param int $code=100 numerical code, default 100
    • @param string $msg =null message, default “Permission denied!”
    • @param int $code =100 numerical code, default 100
      /
      function __construct($msg=null,$code=100)
      {
      @@ -106,8 +110,8 @@
      /
      *
    • Constructor
    • @param string $msg=null message, default “Entry not found!”
    • @param int $code=99 numerical code, default 2
    • @param string $msg =null message, default “Entry not found!”
    • @param int $code =99 numerical code, default 2
      /
      function __construct($msg=null,$code=2)
      {
      @@ -145,8 +149,8 @@
      /
      *
    • Constructor
    • @param string $msg=null message, default “Database error!”
    • @param int $code=100
    • @param string $msg =null message, default “Database error!”
    • @param int $code =100
      /
      function __construct($msg=null,$code=100)
      {
      @@ -179,4 +183,31 @@
      /
      *
  • EGroupware not (fully) installed, visit setup
    */
    -class egw_exception_db_setup extends egw_exception_db { }
    +class egw_exception_db_setup extends egw_exception_db { }

+/**

    • Allow callbacks to request a redirect
    • Can be caught be applications and is otherwise handled by global exception handler.
  • */
    +class egw_exception_redirect extends egw_exception
    +{
  • public $url;
  • public $app;
  • /**
    • Constructor
    • @param string $url
    • @param string $app
    • @param string $msg
    • @param int $code
  • */
  • function __construct($url,$app=null,$msg=null,$code=301)
  • {
  •   $this->url = $url;
    
  •   $this->app = $app;
    
  •   parent::__construct($msg, $code);
    
  • }
    +}

Modified: branches/14.1/phpgwapi/inc/common_functions.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/branches/14.1/phpgwapi/inc/common_functions.inc.php?rev=49049&r1=49048&r2=49049&view=diff

— branches/14.1/phpgwapi/inc/common_functions.inc.php (original)
+++ branches/14.1/phpgwapi/inc/common_functions.inc.php Fri Oct 17 14:51:02 2014
@@ -1709,6 +1709,11 @@
*/
function egw_exception_handler(Exception $e)
{

  • // handle redirects without logging
  • if (is_a($e, ‘egw_exception_redirect’))
  • {
  •   egw::redirect($e->url, $e->app);
    
  • }
    // logging all exceptions to the error_log (if not cli) and get headline
    $headline = null;
    _egw_log_exception($e,$headline);

Modified: branches/14.1/phpgwapi/js/jsapi/egw_json.js
URL: http://svn.stylite.de/viewvc/egroupware/branches/14.1/phpgwapi/js/jsapi/egw_json.js?rev=49049&r1=49048&r2=49049&view=diff

— branches/14.1/phpgwapi/js/jsapi/egw_json.js (original)
+++ branches/14.1/phpgwapi/js/jsapi/egw_json.js Fri Oct 17 14:51:02 2014
@@ -406,6 +406,12 @@
{
egw_topWindow().location.href = res.data.url;
}

  •   	// json request was originating from a different window --> redirect that one
    
  •   	else if(this.DOMContainer && this.DOMContainer.ownerDocument.defaultView != window)
    
  •   	{
    
  •   		this.DOMContainer.ownerDocument.location.href = res.data.url;
    
  •   	}
    
  •   	// main window, open url in respective tab
      	else
      	{
      		egw_appWindowOpen(res.data.app, res.data.url);
    

Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho


eGroupWare-cvs mailing list
eGroupWare-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/egroupware-cvs