replacing egw.LAB with egw_LAB, as egw object is shared by all iframes and popups, while LAB has to work on document

This commit is contained in:
Ralf Becker 2013-07-17 12:47:21 +00:00
parent f9b72b05ac
commit 792f1b26cc
12 changed files with 21 additions and 21 deletions

View File

@ -180,7 +180,7 @@ class etemplate_new extends etemplate_widget_template
<div id="' . $this->name .'" class="et2_container"></div> <div id="' . $this->name .'" class="et2_container"></div>
<script> <script>
// Wait for all files to be loaded & executed first // Wait for all files to be loaded & executed first
egw.LAB.wait(function() { egw_LAB.wait(function() {
egw.langRequire(window, '.json_encode($langRequire).'); egw.langRequire(window, '.json_encode($langRequire).');
egw(window).includeJS('.json_encode(egw_framework::get_script_links(true, true)). // return and clear egw(window).includeJS('.json_encode(egw_framework::get_script_links(true, true)). // return and clear
',function() { ',function() {
@ -211,7 +211,7 @@ class etemplate_new extends etemplate_widget_template
<div id="container" class="et2_container"></div> <div id="container" class="et2_container"></div>
<script> <script>
// Wait for all files to be loaded & executed first // Wait for all files to be loaded & executed first
egw.LAB.wait(function() { egw_LAB.wait(function() {
egw.langRequire(window, '.json_encode($langRequire).'); egw.langRequire(window, '.json_encode($langRequire).');
egw(window).ready(function() { egw(window).ready(function() {
// Initialize application js // Initialize application js
@ -239,7 +239,7 @@ class etemplate_new extends etemplate_widget_template
if(egw_json_response::isJSONResponse()) if(egw_json_response::isJSONResponse())
{ {
$response = egw_json_response::get(); $response = egw_json_response::get();
echo '<script>egw.LAB.wait(function() {egw_json_request.prototype.handleResponse('; echo '<script>egw_LAB.wait(function() {egw_json_request.prototype.handleResponse(';
ob_flush(); ob_flush();
$response->sendResult(); $response->sendResult();
unset($response); unset($response);

View File

@ -55,7 +55,7 @@ class etemplate_et2_widgets
<div id="widget_list"></div> <div id="widget_list"></div>
<div id="widget_container"></div> <div id="widget_container"></div>
<script> <script>
egw.LAB.wait(function() { egw_LAB.wait(function() {
var wb = new widget_browser( var wb = new widget_browser(
document.getElementById("widget_list"), document.getElementById("widget_list"),
document.getElementById("widget_container") document.getElementById("widget_container")

View File

@ -312,7 +312,7 @@ class etemplate_old extends boetemplate
if($output_mode == 2) if($output_mode == 2)
{ {
$html .= "\n".'<script language="javascript">'."\n"; $html .= "\n".'<script language="javascript">'."\n";
$html .= 'egw.LAB.wait($j(document).ready(function() { popup_resize();}));'."\n"; $html .= 'egw_LAB.wait($j(document).ready(function() { popup_resize();}));'."\n";
$html .= '</script>'; $html .= '</script>';
} }

View File

@ -920,7 +920,7 @@ class nextmatch_widget
return ' return '
<script type="text/javascript"> <script type="text/javascript">
egw.LAB.wait(function() {$j(document).ready(function() { egw_LAB.wait(function() {$j(document).ready(function() {
// Initialize the action manager and add some actions to it // Initialize the action manager and add some actions to it
var actionManager = egw_getActionManager("'.$app.'"); var actionManager = egw_getActionManager("'.$app.'");
var objectManager = egw_getObjectManager("'.$app.'"); var objectManager = egw_getObjectManager("'.$app.'");

View File

@ -19,7 +19,7 @@ if ($GLOBALS['egw_info']['user']['apps']['notifications'])
$popup_poll_interval = empty($notification_config['popup_poll_interval']) ? 60 : $notification_config['popup_poll_interval']; $popup_poll_interval = empty($notification_config['popup_poll_interval']) ? 60 : $notification_config['popup_poll_interval'];
echo '<script src="'. $GLOBALS['egw_info']['server']['webserver_url']. '/notifications/js/notificationajaxpopup.js?'. echo '<script src="'. $GLOBALS['egw_info']['server']['webserver_url']. '/notifications/js/notificationajaxpopup.js?'.
filemtime(EGW_SERVER_ROOT.'/notifications/js/notificationajaxpopup.js'). '" type="text/javascript"></script>'; filemtime(EGW_SERVER_ROOT.'/notifications/js/notificationajaxpopup.js'). '" type="text/javascript"></script>';
echo '<script type="text/javascript">var lab = egw.LAB || $LAB; lab.wait(function(){egwpopup_init("'.$popup_poll_interval.'");});</script>'; echo '<script type="text/javascript">var lab = egw_LAB || $LAB; lab.wait(function(){egwpopup_init("'.$popup_poll_interval.'");});</script>';
echo ' echo '
<div id="egwpopup" style="display: none; z-index: 999;"> <div id="egwpopup" style="display: none; z-index: 999;">
<div id="egwpopup_header">'.lang('Notification'). '<span style="float:right;">'. <div id="egwpopup_header">'.lang('Notification'). '<span style="float:right;">'.

View File

@ -885,8 +885,8 @@ abstract class egw_framework
$java_script .= '<script type="text/javascript" src="'. $GLOBALS['egw_info']['server']['webserver_url'].'/phpgwapi/js/labjs/LAB.src.js"'." ></script>\n". $java_script .= '<script type="text/javascript" src="'. $GLOBALS['egw_info']['server']['webserver_url'].'/phpgwapi/js/labjs/LAB.src.js"'." ></script>\n".
'<script type="text/javascript"> '<script type="text/javascript">
// Loads files in parallel, executes serially // Loads files in parallel, executes serially
window.egw.LAB = $LAB.setOptions({AlwaysPreserveOrder:true,BasePath:"'.$GLOBALS['egw_info']['server']['webserver_url'].'/"}); window.egw_LAB = $LAB.setOptions({AlwaysPreserveOrder:true,BasePath:"'.$GLOBALS['egw_info']['server']['webserver_url'].'/"});
window.egw.LAB.script( window.egw_LAB.script(
'.json_encode(array_map(function($str){return substr($str,1);}, $to_include, array(1))).').wait(function() {'."\n".$after.'}); '.json_encode(array_map(function($str){return substr($str,1);}, $to_include, array(1))).').wait(function() {'."\n".$after.'});
</script>'; </script>';
@ -905,7 +905,7 @@ window.egw.LAB.script(
$GLOBALS['egw_info']['flags']['java_script'] = preg_replace(array('/(<script[^>]*>)([^<]*)/is','/<\/script>/'),array('$2',''),$GLOBALS['egw_info']['flags']['java_script']); $GLOBALS['egw_info']['flags']['java_script'] = preg_replace(array('/(<script[^>]*>)([^<]*)/is','/<\/script>/'),array('$2',''),$GLOBALS['egw_info']['flags']['java_script']);
if(trim($GLOBALS['egw_info']['flags']['java_script']) != '') if(trim($GLOBALS['egw_info']['flags']['java_script']) != '')
{ {
$java_script .= '<script type="text/javascript">window.egw.LAB.wait(function() {'.$GLOBALS['egw_info']['flags']['java_script'] . "});</script>\n"; $java_script .= '<script type="text/javascript">window.egw_LAB.wait(function() {'.$GLOBALS['egw_info']['flags']['java_script'] . "});</script>\n";
} }
} }
@ -1226,7 +1226,7 @@ window.egw.LAB.script(
{ {
if($what == 'onLoad') if($what == 'onLoad')
{ {
$js .= 'onLoad="egw.LAB.wait(function() {'. htmlspecialchars($data).'})"'; $js .= 'onLoad="egw_LAB.wait(function() {'. htmlspecialchars($data).'})"';
continue; continue;
} }
$js .= ' '.$what.'="' . htmlspecialchars($data) . '"'; $js .= ' '.$what.'="' . htmlspecialchars($data) . '"';

View File

@ -206,7 +206,7 @@ function resize_'.$id.'()
{ {
$j("#'.$id.'").width(egw_getWindowInnerWidth()-20).height(egw_getWindowInnerHeight()-33); $j("#'.$id.'").width(egw_getWindowInnerWidth()-20).height(egw_getWindowInnerHeight()-33);
} }
egw.LAB.wait(function() { egw_LAB.wait(function() {
$j(document).ready(function() $j(document).ready(function()
{ {
resize_'.$id.'(); resize_'.$id.'();

View File

@ -295,7 +295,7 @@ class html
if($enhanced) { if($enhanced) {
egw_framework::validate_file('/phpgwapi/js/jquery/chosen/chosen.jquery.js'); egw_framework::validate_file('/phpgwapi/js/jquery/chosen/chosen.jquery.js');
egw_framework::includeCSS('/phpgwapi/js/jquery/chosen/chosen.css',null,false); egw_framework::includeCSS('/phpgwapi/js/jquery/chosen/chosen.css',null,false);
$out .= "<script>var lab = egw.LAB || \$LAB; lab.wait(function() {\$j(function() {if(\$j().chosen) \$j('select[name=\"$name\"]').chosen();});})</script>\n"; $out .= "<script>var lab = egw_LAB || \$LAB; lab.wait(function() {\$j(function() {if(\$j().chosen) \$j('select[name=\"$name\"]').chosen();});})</script>\n";
} }
return $out; return $out;
} }
@ -558,7 +558,7 @@ class html
' '
<script type="text/javascript"> <script type="text/javascript">
window.CKEDITOR_BASEPATH="'.$GLOBALS['egw_info']['server']['webserver_url'].'/phpgwapi/js/ckeditor/"; window.CKEDITOR_BASEPATH="'.$GLOBALS['egw_info']['server']['webserver_url'].'/phpgwapi/js/ckeditor/";
egw.LAB.wait(function() { egw_LAB.wait(function() {
CKEDITOR.replace("'.$_name.'", '.egw_ckeditor_config::get_ckeditor_config($_mode, CKEDITOR.replace("'.$_name.'", '.egw_ckeditor_config::get_ckeditor_config($_mode,
$pxheight, $expanded, $_start_path).'); $pxheight, $expanded, $_start_path).');
CKEDITOR.addCss("body { margin: 5px; }"); CKEDITOR.addCss("body { margin: 5px; }");
@ -1208,7 +1208,7 @@ egw.LAB.wait(function() {
$html = self::div("\n",'id="'.$tree.'"',$_divClass).$html; $html = self::div("\n",'id="'.$tree.'"',$_divClass).$html;
$html .= "<script type='text/javascript'>\n"; $html .= "<script type='text/javascript'>\n";
$html .= "var $tree;"; $html .= "var $tree;";
$html .= "egw.LAB.wait(function() {"; $html .= "egw_LAB.wait(function() {";
$html .= "$tree = new dhtmlXTreeObject('$tree','100%','100%',0);\n"; $html .= "$tree = new dhtmlXTreeObject('$tree','100%','100%',0);\n";
$html .= "$tree.parentObject.style.overflow='auto';\n"; // dhtmlXTree constructor has hidden hardcoded $html .= "$tree.parentObject.style.overflow='auto';\n"; // dhtmlXTree constructor has hidden hardcoded
if (translation::charset() == 'utf-8') $html .= "if ($tree.setEscapingMode) $tree.setEscapingMode('utf8');\n"; if (translation::charset() == 'utf-8') $html .= "if ($tree.setEscapingMode) $tree.setEscapingMode('utf8');\n";

View File

@ -135,7 +135,7 @@ class jscalendar
$js = '<script type="text/javascript"> $js = '<script type="text/javascript">
'.(!$useicon ? ' document.getElementById("'.$name.'").readOnly=true;' : ''). '.(!$useicon ? ' document.getElementById("'.$name.'").readOnly=true;' : '').
' egw.LAB.wait(function() { ' egw_LAB.wait(function() {
Calendar.setup({ Calendar.setup({
inputField : "'.$name.'",'.(!$useicon ? '' : ' inputField : "'.$name.'",'.(!$useicon ? '' : '
button : "'.$name.'-trigger"').', button : "'.$name.'-trigger"').',
@ -227,7 +227,7 @@ function monthClicked(calendar,monthstart) {
} }
' : '').' ' : '').'
egw.LAB.wait(function() { egw_LAB.wait(function() {
Calendar.setup({ Calendar.setup({
flat : "'.$id.'", flat : "'.$id.'",
flatCallback : dateChanged'.($weekUrl ? ', flatCallback : dateChanged'.($weekUrl ? ',

View File

@ -318,7 +318,7 @@ class uiaccountsel
} }
// jDots needs a little re-do, since it plays with the layout // jDots needs a little re-do, since it plays with the layout
$html .= "<script> $html .= "<script>
egw.LAB.wait(function() { egw_LAB.wait(function() {
if (\$j().chosen) if (\$j().chosen)
window.setTimeout(function() { window.setTimeout(function() {
\$j('#$element_id').unchosen().chosen({placeholder_text: '".lang('Select multiple accounts')."'}); \$j('#$element_id').unchosen().chosen({placeholder_text: '".lang('Select multiple accounts')."'});

View File

@ -67,7 +67,7 @@ egw.extend('files', egw.MODULE_WND_LOCAL, function(_app, _wnd) {
} }
} }
// setting AlwaysPreserverOrder: true, 'til we have some other means of ensuring dependency resolution // setting AlwaysPreserverOrder: true, 'til we have some other means of ensuring dependency resolution
(egw.LAB || $LAB.setOptions({AlwaysPreserveOrder:true,BasePath:_prefix})).script(_jsFiles).wait(function(){ (egw_LAB || $LAB.setOptions({AlwaysPreserveOrder:true,BasePath:_prefix})).script(_jsFiles).wait(function(){
_callback.call(_context); _callback.call(_context);
}); });
}, },

View File

@ -174,7 +174,7 @@ class idots_framework extends egw_framework
self::validate_file('/phpgwapi/config.php'); self::validate_file('/phpgwapi/config.php');
self::validate_file('/phpgwapi/images.php',array('template' => $GLOBALS['egw_info']['user']['preferences']['common']['template_set'])); self::validate_file('/phpgwapi/images.php',array('template' => $GLOBALS['egw_info']['user']['preferences']['common']['template_set']));
$content .= '<script type="text/javascript"> $content .= '<script type="text/javascript">
egw.LAB.wait(function() {egw.set_preferences('.json_encode($GLOBALS['egw_info']['user']['preferences']['common']).', "common"); egw_LAB.wait(function() {egw.set_preferences('.json_encode($GLOBALS['egw_info']['user']['preferences']['common']).', "common");
egw.set_user('.$GLOBALS['egw']->accounts->json($GLOBALS['egw_info']['user']['account_id']).');}); egw.set_user('.$GLOBALS['egw']->accounts->json($GLOBALS['egw_info']['user']['account_id']).');});
</script>'."\n"; </script>'."\n";
} }