mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-22 07:53:39 +01:00
move egw_get_file_editor_prefered_mimes() to egw.file_editor_prefered_mimes() as everything in old jsapi.js is deprecated and should be removed
.
This commit is contained in:
parent
9d2a319821
commit
05b316f7ff
@ -92,7 +92,7 @@ export class Et2VfsMime extends Et2ImageExpose
|
||||
let gallery = super.isExposable();
|
||||
|
||||
// @ts-ignore Wants an argument, but does not require it
|
||||
let fe = egw_get_file_editor_prefered_mimes();
|
||||
let fe = egw.file_editor_prefered_mimes();
|
||||
if(fe && fe.mime && fe.edit && fe.mime[this.exposeValue.mime])
|
||||
{
|
||||
return true;
|
||||
@ -131,7 +131,7 @@ export class Et2VfsMime extends Et2ImageExpose
|
||||
if(true == super_handled)
|
||||
{
|
||||
// @ts-ignore Wants an argument, but does not require it
|
||||
let fe = egw_get_file_editor_prefered_mimes();
|
||||
let fe = egw.file_editor_prefered_mimes();
|
||||
if(fe && fe.mime && fe.edit && fe.mime[this.exposeValue.mime])
|
||||
{
|
||||
egw.open_link(egw.link('/index.php', {
|
||||
|
@ -15,7 +15,7 @@ import {css, html, LitElement, render} from "@lion/core";
|
||||
import {et2_nextmatch} from "../et2_extension_nextmatch";
|
||||
import {Et2Dialog} from "../Et2Dialog/Et2Dialog";
|
||||
import {ET2_DATAVIEW_STEPSIZE} from "../et2_dataview_controller";
|
||||
import {egw, egw_get_file_editor_prefered_mimes} from "../../jsapi/egw_global";
|
||||
import {egw} from "../../jsapi/egw_global";
|
||||
|
||||
// Minimum data to qualify as an image and not cause errors
|
||||
const IMAGE_DEFAULT = {
|
||||
@ -182,7 +182,7 @@ export function ExposeMixin<B extends Constructor<LitElement>>(superclass : B)
|
||||
}
|
||||
else
|
||||
{
|
||||
let fe = egw_get_file_editor_prefered_mimes(_value.mime);
|
||||
let fe = egw.file_editor_prefered_mimes(_value.mime);
|
||||
if(fe && fe.mime[_value.mime] && fe.mime[_value.mime].favIconUrl)
|
||||
{
|
||||
mediaContent[0].thumbnail = fe.mime[_value.mime].favIconUrl;
|
||||
|
@ -27,7 +27,7 @@ import {et2_file} from "./et2_widget_file";
|
||||
import {et2_inputWidget} from "./et2_core_inputWidget";
|
||||
import {et2_IDetachedDOM} from "./et2_core_interfaces";
|
||||
import {et2_no_init} from "./et2_core_common";
|
||||
import {egw, egw_get_file_editor_prefered_mimes} from "../jsapi/egw_global";
|
||||
import {egw} from "../jsapi/egw_global";
|
||||
import {egw_getAppObjectManager, egwActionObject} from "../egw_action/egw_action.js";
|
||||
import {egw_keyHandler} from '../egw_action/egw_keymanager.js';
|
||||
import {EGW_KEY_ENTER} from '../egw_action/egw_action_constants.js';
|
||||
@ -893,7 +893,7 @@ export class et2_vfsUpload extends et2_file
|
||||
let vfs_attrs = {value: file_data, onclick: undefined};
|
||||
if (file_data && (typeof file_data.download_url != 'undefined'))
|
||||
{
|
||||
var fe_mime = egw_get_file_editor_prefered_mimes(file_data.mime);
|
||||
var fe_mime = egw.file_editor_prefered_mimes(file_data.mime);
|
||||
// Check if the link entry is mime with media type, in order to open it in expose view
|
||||
if (typeof file_data.mime === 'string' &&
|
||||
(file_data.mime.match(mime.mime_regexp,'ig') || (fe_mime && fe_mime.mime[file_data.mime])))
|
||||
|
7
api/js/jsapi/egw_global.d.ts
vendored
7
api/js/jsapi/egw_global.d.ts
vendored
@ -454,6 +454,13 @@ declare interface IegwGlobal
|
||||
* @return grant object, false if not (yet) loaded and no callback or undefined
|
||||
*/
|
||||
grants(_app : string) /*, _callback, _context)*/ : any;
|
||||
/**
|
||||
* Get mime types supported by file editor AND not excluded by user
|
||||
*
|
||||
* @param {string} _mime current mime type
|
||||
* @returns {object|null} returns object of filemanager editor hook
|
||||
*/
|
||||
file_editor_prefered_mimes(_mime : string) : object|null;
|
||||
|
||||
/**
|
||||
* implemented in egw_store.js
|
||||
|
@ -1,6 +1,5 @@
|
||||
//export var app = window.app;
|
||||
export var egw = window.egw;
|
||||
export var framework = window.framework;
|
||||
export var egw_get_file_editor_prefered_mimes = window.egw_get_file_editor_prefered_mimes;
|
||||
export var egw_getFramework = window.egw_getFramework;
|
||||
export var jQuery = window.jQuery;
|
@ -539,7 +539,7 @@ egw.extend('links', egw.MODULE_GLOBAL, function()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
let fe = egw_get_file_editor_prefered_mimes(mime);
|
||||
let fe = this.file_editor_prefered_mimes(mime);
|
||||
if (!fe || !fe.mime || fe && fe.mime && !fe.mime[mime])
|
||||
{
|
||||
return false;
|
||||
|
@ -276,6 +276,35 @@ egw.extend('preferences', egw.MODULE_GLOBAL, function()
|
||||
if (typeof _callback == 'function') return false;
|
||||
}*/
|
||||
return typeof grants[_app] === 'object' ? jQuery.extend({}, grants[_app]) : grants[_app];
|
||||
},
|
||||
|
||||
/**
|
||||
* Get mime types supported by file editor AND not excluded by user
|
||||
*
|
||||
* @param {string} _mime current mime type
|
||||
* @returns {object|null} returns object of filemanager editor hook
|
||||
*/
|
||||
file_editor_prefered_mimes: function(_mime)
|
||||
{
|
||||
const fe = jQuery.extend(true, {}, this.link_get_registry('filemanager-editor'));
|
||||
let ex_mimes = this.preference('collab_excluded_mimes', 'filemanager');
|
||||
const dblclick_action = this.preference('document_doubleclick_action', 'filemanager');
|
||||
if (dblclick_action === 'download' && typeof _mime === 'string')
|
||||
{
|
||||
ex_mimes = !ex_mimes ? _mime : ex_mimes+','+_mime;
|
||||
}
|
||||
if (fe && fe.mime && ex_mimes && typeof ex_mimes === 'string')
|
||||
{
|
||||
ex_mimes = ex_mimes.split(',');
|
||||
for (let mime in fe.mime)
|
||||
{
|
||||
for (let i in ex_mimes)
|
||||
{
|
||||
if (ex_mimes[i] === mime) delete(fe.mime[mime]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return fe && fe.mime ? fe : null;
|
||||
}
|
||||
};
|
||||
});
|
@ -700,31 +700,11 @@ window.addOption = function(id,label,value,do_onchange)
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {string} _mime current mime type
|
||||
* @returns {object|null} returns object of filemanager editor hook
|
||||
* @deprecated use egw.file_editor_prefered_mimes()
|
||||
*/
|
||||
window.egw_get_file_editor_prefered_mimes = function(_mime)
|
||||
{
|
||||
var fe = jQuery.extend(true, {},egw.link_get_registry('filemanager-editor'));
|
||||
var ex_mimes = egw.preference('collab_excluded_mimes', 'filemanager');
|
||||
var dblclick_action = egw.preference('document_doubleclick_action', 'filemanager');
|
||||
if (dblclick_action == 'download' && typeof _mime === 'string')
|
||||
{
|
||||
ex_mimes = !ex_mimes ? _mime : ex_mimes+','+_mime;
|
||||
}
|
||||
if (fe && fe.mime && ex_mimes && typeof ex_mimes === 'string')
|
||||
{
|
||||
ex_mimes = ex_mimes.split(',');
|
||||
for (var mime in fe.mime)
|
||||
{
|
||||
for (var i in ex_mimes)
|
||||
{
|
||||
if (ex_mimes[i] == mime) delete(fe.mime[mime]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return fe && fe.mime?fe:null;
|
||||
return egw.file_editor_prefered_mimes(_mime);
|
||||
}
|
||||
/**
|
||||
* Install click handlers for popup and multiple triggers of uiaccountselection
|
||||
|
@ -17,7 +17,7 @@ import {etemplate2} from "../../api/js/etemplate/etemplate2";
|
||||
import {Et2Dialog} from "../../api/js/etemplate/Et2Dialog/Et2Dialog";
|
||||
import {et2_file} from "../../api/js/etemplate/et2_widget_file";
|
||||
import {et2_nextmatch_controller} from "../../api/js/etemplate/et2_extension_nextmatch_controller";
|
||||
import {egw, egw_get_file_editor_prefered_mimes} from "../../api/js/jsapi/egw_global";
|
||||
import {egw} from "../../api/js/jsapi/egw_global";
|
||||
import {et2_selectbox} from "../../api/js/etemplate/et2_widget_selectbox";
|
||||
import {et2_textbox} from "../../api/js/etemplate/et2_widget_textbox";
|
||||
|
||||
@ -853,7 +853,7 @@ export class filemanagerAPP extends EgwApp
|
||||
let mime = this.et2._inst.widgetContainer.getWidgetById('$row');
|
||||
// try to get mime widget DOM node out of the row DOM
|
||||
let mime_dom = jQuery(_senders[0].iface.getDOMNode()).find("span#filemanager-index_\\$row");
|
||||
let fe = egw_get_file_editor_prefered_mimes();
|
||||
let fe = egw.file_editor_prefered_mimes();
|
||||
|
||||
// symlinks dont have mime 'http/unix-directory', but server marks all directories with class 'isDir'
|
||||
if (data.data.mime == 'httpd/unix-directory' || data.data['class'] && data.data['class'].split(/ +/).indexOf('isDir') != -1)
|
||||
@ -1420,7 +1420,7 @@ export class filemanagerAPP extends EgwApp
|
||||
if (_senders.length>1) return false;
|
||||
let data = egw.dataGetUIDdata(_senders[0].id);
|
||||
let mime = this.et2.getInstanceManager().widgetContainer.getWidgetById('$row');
|
||||
let fe = egw_get_file_editor_prefered_mimes(data.data.mime);
|
||||
let fe = egw.file_editor_prefered_mimes(data.data.mime);
|
||||
if (fe && fe.mime && !fe.mime[data.data.mime]) return false;
|
||||
return !!data.data.mime.match(mime.mime_odf_regex);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user