mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-08-15 10:52:30 +02:00
Merge branch 'master' into web-components
This commit is contained in:
@ -78,7 +78,7 @@ window.app = {classes: {}};
|
||||
window.egw_appName = egw_script.getAttribute('data-app');
|
||||
|
||||
// split includes in legacy js and modules
|
||||
const legacy_js_regexp = /\/dhtmlx|jquery-ui/;
|
||||
const legacy_js_regexp = /\/dhtmlx|jquery-ui-dist/;
|
||||
|
||||
// check if egw object was injected by window open
|
||||
if (typeof window.egw == 'undefined')
|
||||
|
@ -17,6 +17,7 @@ import {et2_dialog} from "../etemplate/et2_widget_dialog";
|
||||
import {et2_createWidget} from "../etemplate/et2_core_widget";
|
||||
import {et2_favorites} from "../etemplate/et2_widget_favorites";
|
||||
import type {IegwAppLocal} from "./egw_global";
|
||||
import Sortable from 'sortablejs/modular/sortable.complete.esm.js';
|
||||
|
||||
/**
|
||||
* Type for push-message
|
||||
@ -781,32 +782,18 @@ export abstract class EgwApp
|
||||
})
|
||||
.addClass("ui-helper-clearfix");
|
||||
|
||||
//Add Sortable handler to sideBox fav. menu
|
||||
jQuery('ul','#favorite_sidebox_'+this.appname).sortable({
|
||||
items:'li:not([data-id$="add"])',
|
||||
placeholder:'ui-fav-sortable-placeholder',
|
||||
delay:250, //(millisecond) delay before the sorting should start
|
||||
helper: function(event, item : any) {
|
||||
// We'll need to know which app this is for
|
||||
item.attr('data-appname',self.appname);
|
||||
// Create custom helper so it can be dragged to Home
|
||||
var h_parent = item.parent().parent().clone();
|
||||
h_parent.find('li').not('[data-id="'+item.attr('data-id')+'"]').remove();
|
||||
h_parent.appendTo('body');
|
||||
return h_parent;
|
||||
},
|
||||
// @ts-ignore
|
||||
refreshPositions: true,
|
||||
update: function (event, ui)
|
||||
{
|
||||
// @ts-ignore
|
||||
var favSortedList = jQuery(this).sortable('toArray', {attribute:'data-id'});
|
||||
|
||||
self.egw.set_preference(self.appname,'fav_sort_pref',favSortedList);
|
||||
|
||||
self._refresh_fav_nm();
|
||||
}
|
||||
});
|
||||
let el = document.getElementById('favorite_sidebox_'+this.appname).getElementsByTagName('ul')[0];
|
||||
let sortablejs = Sortable.create(el, {
|
||||
ghostClass: 'ui-fav-sortable-placeholder',
|
||||
draggable: 'li:not([data-id$="add"])',
|
||||
delay: 25,
|
||||
dataIdAttr:'data-id',
|
||||
onSort: function(event){
|
||||
let favSortedList = sortablejs.toArray();
|
||||
self.egw.set_preference(self.appname,'fav_sort_pref',favSortedList);
|
||||
self._refresh_fav_nm();
|
||||
}
|
||||
});
|
||||
|
||||
// Bind favorite de-select
|
||||
var egw_fw = egw_getFramework();
|
||||
|
@ -10,7 +10,6 @@
|
||||
*/
|
||||
|
||||
/*egw:uses
|
||||
/vendor/bower-asset/jquery-ui/jquery-ui.js;
|
||||
jquery.jquery-ui-timepicker-addon;
|
||||
|
||||
egw_core;
|
||||
@ -19,8 +18,6 @@
|
||||
egw_css;
|
||||
*/
|
||||
|
||||
import "../../../vendor/bower-asset/jquery/dist/jquery.min.js";
|
||||
//import "../../../vendor/bower-asset/jquery-ui/jquery-ui.js";
|
||||
import "../jquery/jquery.noconflict.js";
|
||||
//import "../jquery/jquery-ui-timepicker-addon.js";
|
||||
import './egw_core.js';
|
||||
|
@ -20,6 +20,13 @@ egw.extend('jsonq', egw.MODULE_GLOBAL, function()
|
||||
{
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Explicit registered push callbacks
|
||||
*
|
||||
* @type {Function[]}
|
||||
*/
|
||||
let push_callbacks = [];
|
||||
|
||||
/**
|
||||
* Queued json requests (objects with attributes menuaction, parameters, context, callback, sender and callbeforesend)
|
||||
*
|
||||
@ -149,6 +156,34 @@ egw.extend('jsonq', egw.MODULE_GLOBAL, function()
|
||||
}, 100);
|
||||
}
|
||||
return uid;
|
||||
},
|
||||
|
||||
/**
|
||||
* Register a callback to receive push broadcasts eg. in a popup or iframe
|
||||
*
|
||||
* It's also used internally by egw_message's push method to dispatch to the registered callbacks.
|
||||
*
|
||||
* @param {Function|PushData} data callback (with bound context) or PushData to dispatch to callbacks
|
||||
*/
|
||||
registerPush: function(data)
|
||||
{
|
||||
if (typeof data === "function")
|
||||
{
|
||||
push_callbacks.push(data);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (let n in push_callbacks)
|
||||
{
|
||||
try {
|
||||
push_callbacks[n].call(this, data);
|
||||
}
|
||||
// if we get an exception, we assume the callback is no longer available and remove it
|
||||
catch (ex) {
|
||||
push_callbacks.splice(n, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
@ -459,6 +459,9 @@ egw.extend('message', egw.MODULE_WND_LOCAL, function(_app, _wnd)
|
||||
app_obj.push(pushData);
|
||||
}
|
||||
}
|
||||
|
||||
// call the global registered push callbacks
|
||||
this.registerPush(pushData);
|
||||
}
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user