Revert "fix some egw_LAB not defined errors by using top.egw_ready instead"

This reverts commit 38d44ee3e2.
This commit is contained in:
ralf 2023-01-12 17:23:13 -06:00
parent 4e875c049f
commit 22ac1a21f1
2 changed files with 6 additions and 9 deletions

View File

@ -722,7 +722,6 @@ abstract class Framework extends Framework\Extra
* @param string $password =null password --------- " ----------
* @param array $opts =array() further params for http(s) context, eg. array('timeout' => 123)
* @return resource|null context to use with file_get_context/fopen or null if no proxy configured
* @noinspection UnsupportedStringOffsetOperationsInspection
*/
public static function proxy_context($username=null, $password=null, array $opts = array())
{
@ -1110,7 +1109,7 @@ abstract class Framework extends Framework\Extra
$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']) != '')
{
$java_script .= '<script type="text/javascript">top.egw_ready.then(() => { const egw=top.egw, jQuery=top.jQuery; '.$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";
}
}
@ -1695,7 +1694,6 @@ abstract class Framework extends Framework\Extra
$list = array();
foreach((array)$_account_ids as $account_id)
{
/** @noinspection SuspiciousLoopInspection */
foreach($account_id < 0 && $_resolve_groups ?
$GLOBALS['egw']->accounts->members($account_id, true) : array($account_id) as $account_id)
{

View File

@ -1,5 +1,4 @@
<?php /** @noinspection SuspiciousLoopInspection */
<?php
/**
* EGroupware API: generates html with methods representing html-tags or higher widgets
*
@ -216,7 +215,7 @@ class Html
if($enhanced) {
Framework::includeJS('/api/js/jquery/chosen/chosen.jquery.js');
Framework::includeCSS('/api/js/jquery/chosen/chosen.css',null,false);
$out .= "<script>top.egw_ready.then(() => { const egw=top.egw, jQuery=top.jQuery; jQuery(function() {if(jQuery().chosen) jQuery('select[name=\"$name\"]').chosen({width: '100%'});});})</script>\n";
$out .= "<script>var lab = egw_LAB || \$LAB; lab.wait(function() {jQuery(function() {if(jQuery().chosen) jQuery('select[name=\"$name\"]').chosen({width: '100%'});});})</script>\n";
}
return $out;
}
@ -470,8 +469,8 @@ class Html
'
<script type="text/javascript">
top.egw_ready.then(() => {
const egw=top.egw, jQuery=top.jQuery, tinymce=top.tinymce;
egw_LAB.wait(function() {
var imageUpload = egw.ajaxUrl("EGroupware\\Api\\Etemplate\\Widget\\Vfs::ajax_htmlarea_upload")+"&type=htmlarea";
imageUpload = imageUpload.substr(egw.webserverUrl.length+1);
var font_size_formats = {
@ -1230,7 +1229,7 @@ tinymce.init({
$html = self::div("\n",'id="'.$tree.'"',$_divClass);
$html .= "<script type='text/javascript'>\n";
$html .= "var $tree;";
$html .= "top.egw_ready.then(() => { const egw=top.egw, dhtmlXTreeObject=top.dhtmlXTreeObject; ";
$html .= "egw_LAB.wait(function() {";
$html .= "$tree = new"." dhtmlXTreeObject('$tree','100%','100%',0);\n";
$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";