mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-11 08:28:43 +01:00
new egw_framework::message($msg, $msg_type="success") method and fixing nextmatch filter-change to return app-header
This commit is contained in:
parent
b1aca92a9e
commit
1590d02816
@ -115,7 +115,6 @@ class etemplate_new extends etemplate_widget_template
|
|||||||
self::$request->preserv = $preserv ? $preserv : array();
|
self::$request->preserv = $preserv ? $preserv : array();
|
||||||
self::$request->method = $method;
|
self::$request->method = $method;
|
||||||
self::$request->ignore_validation = $ignore_validation;
|
self::$request->ignore_validation = $ignore_validation;
|
||||||
self::$request->app_header = $GLOBALS['egw_info']['flags']['app_header'];
|
|
||||||
if (self::$request->output_mode == -1) self::$request->output_mode = 0;
|
if (self::$request->output_mode == -1) self::$request->output_mode = 0;
|
||||||
self::$request->template = $this->as_array();
|
self::$request->template = $this->as_array();
|
||||||
|
|
||||||
@ -125,6 +124,9 @@ class etemplate_new extends etemplate_widget_template
|
|||||||
$template = etemplate_widget_template::instance($this->name, $this->template_set, $this->version, $this->laod_via);
|
$template = etemplate_widget_template::instance($this->name, $this->template_set, $this->version, $this->laod_via);
|
||||||
$template->run('beforeSendToClient', array('', array('cont'=>$content)));
|
$template->run('beforeSendToClient', array('', array('cont'=>$content)));
|
||||||
|
|
||||||
|
// some apps (eg. InfoLog) set app_header only in get_rows depending on filter settings
|
||||||
|
self::$request->app_header = $GLOBALS['egw_info']['flags']['app_header'];
|
||||||
|
|
||||||
$data = array(
|
$data = array(
|
||||||
'etemplate_exec_id' => self::$request->id(),
|
'etemplate_exec_id' => self::$request->id(),
|
||||||
'app_header' => self::$request->app_header,
|
'app_header' => self::$request->app_header,
|
||||||
@ -249,6 +251,7 @@ class etemplate_new extends etemplate_widget_template
|
|||||||
//error_log(__METHOD__."(,".array2string($content).')');
|
//error_log(__METHOD__."(,".array2string($content).')');
|
||||||
//error_log(' validated='.array2string($validated));
|
//error_log(' validated='.array2string($validated));
|
||||||
$content = ExecMethod(self::$request->method, self::complete_array_merge(self::$request->preserv, $validated));
|
$content = ExecMethod(self::$request->method, self::complete_array_merge(self::$request->preserv, $validated));
|
||||||
|
|
||||||
if (isset($GLOBALS['egw_info']['flags']['java_script']))
|
if (isset($GLOBALS['egw_info']['flags']['java_script']))
|
||||||
{
|
{
|
||||||
// Strip out any script tags
|
// Strip out any script tags
|
||||||
|
@ -299,6 +299,14 @@ class etemplate_widget_nextmatch extends etemplate_widget
|
|||||||
$value['col_filter']['parent_id'] = $queriedRange['parent_id'];
|
$value['col_filter']['parent_id'] = $queriedRange['parent_id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set current app for get_rows
|
||||||
|
list($app) = explode('.',self::$request->method);
|
||||||
|
if(!$app) list($app) = explode('::',self::$request->method);
|
||||||
|
if($app)
|
||||||
|
{
|
||||||
|
$GLOBALS['egw_info']['flags']['currentapp'] = $app;
|
||||||
|
translation::add_app($app);
|
||||||
|
}
|
||||||
// If specific data requested, just do that
|
// If specific data requested, just do that
|
||||||
if (($row_id = $value['row_id']) && $queriedRange['refresh'])
|
if (($row_id = $value['row_id']) && $queriedRange['refresh'])
|
||||||
{
|
{
|
||||||
@ -309,6 +317,12 @@ class etemplate_widget_nextmatch extends etemplate_widget
|
|||||||
$result['total'] = self::call_get_rows($value, $rows, $result['readonlys']);
|
$result['total'] = self::call_get_rows($value, $rows, $result['readonlys']);
|
||||||
$result['lastModification'] = egw_time::to('now', 'ts')-1;
|
$result['lastModification'] = egw_time::to('now', 'ts')-1;
|
||||||
|
|
||||||
|
if (isset($GLOBALS['egw_info']['flags']['app_header']) && self::$request->app_header != $GLOBALS['egw_info']['flags']['app_header'])
|
||||||
|
{
|
||||||
|
self::$request->app_header = $GLOBALS['egw_info']['flags']['app_header'];
|
||||||
|
egw_json_response::get()->apply('egw_app_header', array($GLOBALS['egw_info']['flags']['app_header']));
|
||||||
|
}
|
||||||
|
|
||||||
$row_id = isset($value['row_id']) ? $value['row_id'] : 'id';
|
$row_id = isset($value['row_id']) ? $value['row_id'] : 'id';
|
||||||
$row_modified = $value['row_modified'];
|
$row_modified = $value['row_modified'];
|
||||||
$is_parent = $value['is_parent'];
|
$is_parent = $value['is_parent'];
|
||||||
@ -389,6 +403,7 @@ class etemplate_widget_nextmatch extends etemplate_widget
|
|||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
//foreach($result as $name => $value) if ($name != 'readonlys') error_log(__METHOD__."() result['$name']=".array2string($name == 'data' ? array_keys($value) : $value));
|
//foreach($result as $name => $value) if ($name != 'readonlys') error_log(__METHOD__."() result['$name']=".array2string($name == 'data' ? array_keys($value) : $value));
|
||||||
egw_json_response::get()->data($result);
|
egw_json_response::get()->data($result);
|
||||||
}
|
}
|
||||||
|
@ -226,13 +226,8 @@ etemplate2.prototype.load = function(_name, _url, _data, _callback)
|
|||||||
// store the id to submit it back to server
|
// store the id to submit it back to server
|
||||||
if(_data) {
|
if(_data) {
|
||||||
this.etemplate_exec_id = _data.etemplate_exec_id;
|
this.etemplate_exec_id = _data.etemplate_exec_id;
|
||||||
}
|
// set app_header
|
||||||
|
window.egw_app_header(_data.app_header);
|
||||||
// set app_header
|
|
||||||
if (window.opener && _data) { // popup
|
|
||||||
document.title = _data.app_header;
|
|
||||||
} else {
|
|
||||||
// todo for idots or jdots framework
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var _load = function() {
|
var _load = function() {
|
||||||
|
@ -173,7 +173,7 @@ abstract class egw_framework
|
|||||||
/**
|
/**
|
||||||
* Refresh given application $targetapp display of entry $app $id, incl. outputting $msg
|
* Refresh given application $targetapp display of entry $app $id, incl. outputting $msg
|
||||||
*
|
*
|
||||||
* Calling egw_refresh on opener in a content security save way
|
* Calling egw_refresh and egw_message on opener in a content security save way
|
||||||
*
|
*
|
||||||
* @param string $msg message (already translated) to show, eg. 'Entry deleted'
|
* @param string $msg message (already translated) to show, eg. 'Entry deleted'
|
||||||
* @param string $app application name
|
* @param string $app application name
|
||||||
@ -182,13 +182,27 @@ abstract class egw_framework
|
|||||||
* @param string $targetapp=null which app's window should be refreshed, default current
|
* @param string $targetapp=null which app's window should be refreshed, default current
|
||||||
* @param string|RegExp $replace=null regular expression to replace in url
|
* @param string|RegExp $replace=null regular expression to replace in url
|
||||||
* @param string $with=null
|
* @param string $with=null
|
||||||
|
* @param string $msg_type=null 'error', 'warning' or 'success' (default)
|
||||||
*/
|
*/
|
||||||
public static function refresh_opener($msg, $app, $id=null, $type=null, $targetapp=null, $replace=null, $with=null)
|
public static function refresh_opener($msg, $app, $id=null, $type=null, $targetapp=null, $replace=null, $with=null, $msg_type=null)
|
||||||
{
|
{
|
||||||
//error_log(__METHOD__.'('.array2string(func_get_args()).')');
|
//error_log(__METHOD__.'('.array2string(func_get_args()).')');
|
||||||
self::$extra['refresh-opener'] = func_get_args();
|
self::$extra['refresh-opener'] = func_get_args();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display an error or regular message
|
||||||
|
*
|
||||||
|
* Calls egw_message on client-side in a content security save way
|
||||||
|
*
|
||||||
|
* @param string $msg message to show
|
||||||
|
* @param string $type='success' 'error', 'warning' or 'success' (default)
|
||||||
|
*/
|
||||||
|
function message($msg, $type='success')
|
||||||
|
{
|
||||||
|
self::$extra['message'] = func_get_args();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Close (popup) window, use to replace egw_framework::onload('window.close()') in a content security save way
|
* Close (popup) window, use to replace egw_framework::onload('window.close()') in a content security save way
|
||||||
*
|
*
|
||||||
@ -385,17 +399,15 @@ abstract class egw_framework
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($GLOBALS['egw_info']['flags']['app_header'])
|
$app = $GLOBALS['egw_info']['flags']['currentapp'];
|
||||||
{
|
$app_title = isset($GLOBALS['egw_info']['apps'][$app]) ? $GLOBALS['egw_info']['apps'][$app]['title'] : lang($app);
|
||||||
$app = $GLOBALS['egw_info']['flags']['app_header'];
|
$app_header = $GLOBALS['egw_info']['flags']['app_header'] ? $GLOBALS['egw_info']['flags']['app_header'] : $app_title;
|
||||||
}
|
$site_title = strip_tags($GLOBALS['egw_info']['server']['site_title'].' ['.($app_header ? $app_header : $app_title).']');
|
||||||
else
|
|
||||||
{
|
// send appheader to clientside
|
||||||
$app = $GLOBALS['egw_info']['flags']['currentapp'];
|
$extra['app-header'] = $app_header;
|
||||||
$app = isset($GLOBALS['egw_info']['apps'][$app]) ? $GLOBALS['egw_info']['apps'][$app]['title'] : lang($app);
|
|
||||||
}
|
if($GLOBALS['egw_info']['flags']['currentapp'] != 'wiki') $robots ='<meta name="robots" content="none" />';
|
||||||
$var = array();
|
|
||||||
if($app!='wiki') $robots ='<meta name="robots" content="none" />';
|
|
||||||
if (substr($GLOBALS['egw_info']['server']['favicon_file'],0,4) == 'http')
|
if (substr($GLOBALS['egw_info']['server']['favicon_file'],0,4) == 'http')
|
||||||
{
|
{
|
||||||
$var['favicon_file'] = $GLOBALS['egw_info']['server']['favicon_file'];
|
$var['favicon_file'] = $GLOBALS['egw_info']['server']['favicon_file'];
|
||||||
@ -417,7 +429,7 @@ abstract class egw_framework
|
|||||||
'pngfix' => $pngfix,
|
'pngfix' => $pngfix,
|
||||||
'lang_code' => $lang_code,
|
'lang_code' => $lang_code,
|
||||||
'charset' => translation::charset(),
|
'charset' => translation::charset(),
|
||||||
'website_title' => strip_tags($GLOBALS['egw_info']['server']['site_title']. ($app ? " [$app]" : '')),
|
'website_title' => $site_title,
|
||||||
'body_tags' => self::_get_body_attribs(),
|
'body_tags' => self::_get_body_attribs(),
|
||||||
'java_script' => self::_get_js($extra),
|
'java_script' => self::_get_js($extra),
|
||||||
'meta_robots' => $robots,
|
'meta_robots' => $robots,
|
||||||
|
@ -158,6 +158,16 @@
|
|||||||
et2.load(data.name,data.url,data.data,callback);
|
et2.load(data.name,data.url,data.data,callback);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// set app-header
|
||||||
|
if (window.framework && (data = egw_script.getAttribute('data-app-header')))
|
||||||
|
{
|
||||||
|
window.egw_app_header(data);
|
||||||
|
}
|
||||||
|
// display a message
|
||||||
|
if ((data = egw_script.getAttribute('data-message')) && (data = JSON.parse(data)))
|
||||||
|
{
|
||||||
|
window.egw_message.apply(window, data);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -281,8 +281,7 @@ function egw_message(_msg, _type)
|
|||||||
{
|
{
|
||||||
framework.setMessage.call(window.framework, _msg, _type);
|
framework.setMessage.call(window.framework, _msg, _type);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// handle message display for non-framework templates, eg. idots or jerryr
|
// handle message display for non-framework templates, eg. idots or jerryr
|
||||||
if (window.egw_message_timer)
|
if (window.egw_message_timer)
|
||||||
{
|
{
|
||||||
@ -299,7 +298,29 @@ function egw_message(_msg, _type)
|
|||||||
$j('div#divAppboxHeader').text(document.title.replace(/^.*\[(.*)\]$/, '$1'));
|
$j('div#divAppboxHeader').text(document.title.replace(/^.*\[(.*)\]$/, '$1'));
|
||||||
}, 5000);
|
}, 5000);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update app-header and website-title
|
||||||
|
*
|
||||||
|
* @param _header
|
||||||
|
*/
|
||||||
|
function egw_app_header(_header)
|
||||||
|
{
|
||||||
|
var framework = egw_getFramework();
|
||||||
|
if (framework && !window.opener) // not for popups
|
||||||
|
{
|
||||||
|
var app = egw_getAppName();
|
||||||
|
var title = document.title.replace(/[.*]$/, '['+_header+']');
|
||||||
|
|
||||||
|
framework.setWebsiteTitle.call(window.framework, app, title, _header);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$j('div#divAppboxHeader').text(_header);
|
||||||
|
|
||||||
|
document.title = document.title.replace(/[.*]$/, '['+_header+']');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* View an EGroupware entry: opens a popup of correct size or redirects window.location to requested url
|
* View an EGroupware entry: opens a popup of correct size or redirects window.location to requested url
|
||||||
|
Loading…
Reference in New Issue
Block a user