mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-28 17:48:56 +01:00
Change over some more dialogs
This commit is contained in:
parent
763ed85668
commit
bfdb53b1cf
@ -540,7 +540,7 @@ export class Et2Dialog extends Et2Widget(ScopedElementsMixin(SlotMixin(LionDialo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// set template-name as id, to allow to style dialogs
|
// set template-name as id, to allow to style dialogs
|
||||||
this._template_widget.DOMContainer.setAttribute('id', this.__template.replace(/^(.*\/)?([^/]+?)(\.xet)?(\?.*)$/, '$2').replace(/\./g, '-'));
|
this._template_widget.DOMContainer.setAttribute('id', this.__template.replace(/^(.*\/)?([^/]+?)(\.xet)?(\?.*)?$/, '$2').replace(/\./g, '-'));
|
||||||
|
|
||||||
// Look for buttons after load
|
// Look for buttons after load
|
||||||
this.addEventListener("load", this._adoptTemplateButtons);
|
this.addEventListener("load", this._adoptTemplateButtons);
|
||||||
@ -818,7 +818,7 @@ export class Et2Dialog extends Et2Widget(ScopedElementsMixin(SlotMixin(LionDialo
|
|||||||
message: _message
|
message: _message
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
template: egw.webserverUrl + '/api/templates/default/prompt.xet',
|
template: egw.webserverUrl + '/api/etemplate.php/api/templates/default/prompt.xet',
|
||||||
class: "et2_prompt"
|
class: "et2_prompt"
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -915,7 +915,7 @@ export class Et2Dialog extends Et2Widget(ScopedElementsMixin(SlotMixin(LionDialo
|
|||||||
];
|
];
|
||||||
let dialog = new Et2Dialog(_egw_or_appname);
|
let dialog = new Et2Dialog(_egw_or_appname);
|
||||||
dialog.transformAttributes({
|
dialog.transformAttributes({
|
||||||
template: egw.webserverUrl + '/api/templates/default/long_task.xet',
|
template: egw.webserverUrl + '/api/etemplate.php/api/templates/default/long_task.xet',
|
||||||
value: {
|
value: {
|
||||||
content: {
|
content: {
|
||||||
message: _message
|
message: _message
|
||||||
|
@ -18,13 +18,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import {et2_baseWidget} from './et2_core_baseWidget';
|
import {et2_baseWidget} from './et2_core_baseWidget';
|
||||||
import {et2_createWidget, et2_register_widget, WidgetConfig} from "./et2_core_widget";
|
import {et2_register_widget, WidgetConfig} from "./et2_core_widget";
|
||||||
import {ClassWithAttributes} from "./et2_core_inheritance";
|
import {ClassWithAttributes} from "./et2_core_inheritance";
|
||||||
import {et2_IDetachedDOM} from "./et2_core_interfaces";
|
import {et2_IDetachedDOM} from "./et2_core_interfaces";
|
||||||
import {et2_no_init} from "./et2_core_common";
|
import {et2_no_init} from "./et2_core_common";
|
||||||
import {egw} from "../jsapi/egw_global";
|
import {egw} from "../jsapi/egw_global";
|
||||||
import {et2_dialog} from "./et2_widget_dialog";
|
|
||||||
import '../../../vendor/bower-asset/cropper/dist/cropper.min.js';
|
import '../../../vendor/bower-asset/cropper/dist/cropper.min.js';
|
||||||
|
import {Et2Dialog} from "./Et2Dialog/Et2Dialog";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class which implements the "image" XET-Tag
|
* Class which implements the "image" XET-Tag
|
||||||
@ -546,41 +546,43 @@ export class et2_avatar extends et2_image
|
|||||||
.addClass('emlEdit')
|
.addClass('emlEdit')
|
||||||
.click(function(){
|
.click(function(){
|
||||||
let buttons = [
|
let buttons = [
|
||||||
{"button_id": 1,"text": self.egw().lang('save'), id: 'save', image: 'check', "default":true},
|
{"button_id": 1, label: self.egw().lang('save'), id: 'save', image: 'check', "default": true},
|
||||||
{"button_id": 0,"text": self.egw().lang('cancel'), id: 'cancel', image: 'cancelled'}
|
{"button_id": 0, label: self.egw().lang('cancel'), id: 'cancel', image: 'cancelled'}
|
||||||
];
|
];
|
||||||
let dialog = function(_title, _value, _buttons, _egw_or_appname)
|
let dialog = function(_title, _value, _buttons, _egw_or_appname)
|
||||||
{
|
{
|
||||||
return et2_createWidget("dialog",
|
let dialog = new Et2Dialog(self.egw());
|
||||||
|
dialog.transformAttributes({
|
||||||
|
callback: function(_buttons, _value)
|
||||||
{
|
{
|
||||||
callback: function(_buttons, _value)
|
if(_buttons == 'save')
|
||||||
{
|
{
|
||||||
if (_buttons == 'save')
|
let canvas = jQuery('#_cropper_image').cropper('getCroppedCanvas');
|
||||||
{
|
self.image.attr('src', canvas.toDataURL("image/jpeg", 1.0));
|
||||||
let canvas = jQuery('#_cropper_image').cropper('getCroppedCanvas');
|
self.egw().json('addressbook.addressbook_ui.ajax_update_photo',
|
||||||
self.image.attr('src', canvas.toDataURL("image/jpeg", 1.0));
|
[self.getInstanceManager().etemplate_exec_id, canvas.toDataURL('image/jpeg', 1.0)],
|
||||||
self.egw().json('addressbook.addressbook_ui.ajax_update_photo',
|
function(res)
|
||||||
[self.getInstanceManager().etemplate_exec_id, canvas.toDataURL('image/jpeg',1.0)],
|
{
|
||||||
function(res)
|
if(res)
|
||||||
{
|
{
|
||||||
if (res)
|
del.show();
|
||||||
{
|
}
|
||||||
del.show();
|
}).sendRequest();
|
||||||
}
|
}
|
||||||
}).sendRequest();
|
},
|
||||||
}
|
title: _title || egw.lang('Input required'),
|
||||||
},
|
buttons: _buttons || Et2Dialog.BUTTONS_OK_CANCEL,
|
||||||
title: _title||egw.lang('Input required'),
|
value: {
|
||||||
buttons: _buttons||et2_dialog.BUTTONS_OK_CANCEL,
|
content: _value
|
||||||
value: {
|
},
|
||||||
content: _value
|
width: "90%",
|
||||||
},
|
height: "450",
|
||||||
width: "90%",
|
resizable: false,
|
||||||
height:"450",
|
position: "top+10",
|
||||||
resizable: false,
|
template: egw.webserverUrl + '/api/templates/default/avatar_edit.xet?2'
|
||||||
position:"top+10",
|
});
|
||||||
template: egw.webserverUrl+'/api/templates/default/avatar_edit.xet?2'
|
document.body.appendChild(dialog);
|
||||||
}, et2_dialog._create_parent(_egw_or_appname));
|
return dialog;
|
||||||
};
|
};
|
||||||
|
|
||||||
dialog(egw.lang('Edit avatar'),self.options, buttons, null);
|
dialog(egw.lang('Edit avatar'),self.options, buttons, null);
|
||||||
@ -590,23 +592,25 @@ export class et2_avatar extends et2_image
|
|||||||
// delete button
|
// delete button
|
||||||
var del = jQuery(document.createElement('div'))
|
var del = jQuery(document.createElement('div'))
|
||||||
.addClass('emlDelete')
|
.addClass('emlDelete')
|
||||||
.click(function(){
|
.click(function()
|
||||||
et2_dialog.show_dialog(function(_btn){
|
{
|
||||||
if (_btn == et2_dialog.YES_BUTTON)
|
Et2Dialog.show_dialog(function(_btn)
|
||||||
|
{
|
||||||
|
if(_btn == Et2Dialog.YES_BUTTON)
|
||||||
{
|
{
|
||||||
self.egw().json('addressbook.addressbook_ui.ajax_update_photo',
|
self.egw().json('addressbook.addressbook_ui.ajax_update_photo',
|
||||||
[self.getInstanceManager().etemplate_exec_id, null],
|
[self.getInstanceManager().etemplate_exec_id, null],
|
||||||
function(res)
|
function(res)
|
||||||
{
|
{
|
||||||
if (res)
|
if(res)
|
||||||
{
|
{
|
||||||
self.image.attr('src','');
|
self.image.attr('src', '');
|
||||||
del.hide();
|
del.hide();
|
||||||
egw.refresh('Avatar Deleted.', egw.app_name());
|
egw.refresh('Avatar Deleted.', egw.app_name());
|
||||||
}
|
}
|
||||||
}).sendRequest();
|
}).sendRequest();
|
||||||
}
|
}
|
||||||
}, egw.lang('Delete this photo?'), egw.lang('Delete'), null, et2_dialog.BUTTONS_YES_NO);
|
}, egw.lang('Delete this photo?'), egw.lang('Delete'), null, Et2Dialog.BUTTONS_YES_NO);
|
||||||
})
|
})
|
||||||
.appendTo(eml);
|
.appendTo(eml);
|
||||||
if (_noDelete) del.hide();
|
if (_noDelete) del.hide();
|
||||||
|
@ -27,7 +27,6 @@ import {et2_valueWidget} from "./et2_core_valueWidget";
|
|||||||
import {et2_inputWidget} from "./et2_core_inputWidget";
|
import {et2_inputWidget} from "./et2_core_inputWidget";
|
||||||
import {et2_selectbox} from "./et2_widget_selectbox";
|
import {et2_selectbox} from "./et2_widget_selectbox";
|
||||||
import {et2_button} from "./et2_widget_button";
|
import {et2_button} from "./et2_widget_button";
|
||||||
import {et2_dialog} from "./et2_widget_dialog";
|
|
||||||
import {et2_file} from "./et2_widget_file";
|
import {et2_file} from "./et2_widget_file";
|
||||||
import {et2_vfsSelect} from "./et2_widget_vfs";
|
import {et2_vfsSelect} from "./et2_widget_vfs";
|
||||||
import {egw, egw_get_file_editor_prefered_mimes} from "../jsapi/egw_global";
|
import {egw, egw_get_file_editor_prefered_mimes} from "../jsapi/egw_global";
|
||||||
@ -36,6 +35,7 @@ import {et2_csvSplit, et2_no_init} from "./et2_core_common";
|
|||||||
import {et2_IDetachedDOM, et2_IExposable} from "./et2_core_interfaces";
|
import {et2_IDetachedDOM, et2_IExposable} from "./et2_core_interfaces";
|
||||||
import {expose} from "./expose";
|
import {expose} from "./expose";
|
||||||
import {egwMenu} from "../egw_action/egw_menu.js";
|
import {egwMenu} from "../egw_action/egw_menu.js";
|
||||||
|
import {Et2Dialog} from "./Et2Dialog/Et2Dialog";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UI widgets for Egroupware linking system
|
* UI widgets for Egroupware linking system
|
||||||
@ -1892,16 +1892,19 @@ export class et2_link_list extends et2_link_string
|
|||||||
{
|
{
|
||||||
var link_id = typeof self.context.data.link_id == 'number' ? self.context.data.link_id : self.context.data.link_id.replace(/[:\.]/g, '_');
|
var link_id = typeof self.context.data.link_id == 'number' ? self.context.data.link_id : self.context.data.link_id.replace(/[:\.]/g, '_');
|
||||||
|
|
||||||
et2_dialog.show_prompt(
|
Et2Dialog.show_prompt(
|
||||||
function (button, comment)
|
function(button, comment)
|
||||||
{
|
{
|
||||||
if (button != et2_dialog.OK_BUTTON) return;
|
if(button != Et2Dialog.OK_BUTTON)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
var remark = jQuery('#link_' + (self.context.data.dom_id ? self.context.data.dom_id : link_id), self.list).children('.remark');
|
var remark = jQuery('#link_' + (self.context.data.dom_id ? self.context.data.dom_id : link_id), self.list).children('.remark');
|
||||||
if (isNaN(self.context.data.link_id)) // new entry, not yet stored
|
if(isNaN(self.context.data.link_id)) // new entry, not yet stored
|
||||||
{
|
{
|
||||||
remark.text(comment);
|
remark.text(comment);
|
||||||
// Look for a link-to with the same ID, refresh it
|
// Look for a link-to with the same ID, refresh it
|
||||||
if (self.context.data.link_id)
|
if(self.context.data.link_id)
|
||||||
{
|
{
|
||||||
var _widget = link_id.widget || null;
|
var _widget = link_id.widget || null;
|
||||||
self.getRoot().iterateOver(
|
self.getRoot().iterateOver(
|
||||||
@ -2034,10 +2037,13 @@ export class et2_link_list extends et2_link_string
|
|||||||
{
|
{
|
||||||
var link_id = isNaN(self.context.data.link_id) ? self.context.data : self.context.data.link_id;
|
var link_id = isNaN(self.context.data.link_id) ? self.context.data : self.context.data.link_id;
|
||||||
var row = jQuery('#link_' + (self.context.data.dom_id ? self.context.data.dom_id : self.context.data.link_id), self.list);
|
var row = jQuery('#link_' + (self.context.data.dom_id ? self.context.data.dom_id : self.context.data.link_id), self.list);
|
||||||
et2_dialog.show_dialog(
|
Et2Dialog.show_dialog(
|
||||||
function (button)
|
function(button)
|
||||||
{
|
{
|
||||||
if (button == et2_dialog.YES_BUTTON) self._delete_link(link_id, row);
|
if(button == Et2Dialog.YES_BUTTON)
|
||||||
|
{
|
||||||
|
self._delete_link(link_id, row);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
egw.lang('Delete link?')
|
egw.lang('Delete link?')
|
||||||
);
|
);
|
||||||
@ -2231,10 +2237,10 @@ export class et2_link_list extends et2_link_string
|
|||||||
.addClass("delete icon")
|
.addClass("delete icon")
|
||||||
.bind('click', function ()
|
.bind('click', function ()
|
||||||
{
|
{
|
||||||
et2_dialog.show_dialog(
|
Et2Dialog.show_dialog(
|
||||||
function (button)
|
function(button)
|
||||||
{
|
{
|
||||||
if (button == et2_dialog.YES_BUTTON)
|
if(button == Et2Dialog.YES_BUTTON)
|
||||||
{
|
{
|
||||||
self._delete_link(
|
self._delete_link(
|
||||||
self.value && typeof self.value.to_id != 'object' && _link_data.link_id ? _link_data.link_id : _link_data,
|
self.value && typeof self.value.to_id != 'object' && _link_data.link_id ? _link_data.link_id : _link_data,
|
||||||
|
@ -20,8 +20,8 @@ import {et2_createWidget, et2_register_widget, WidgetConfig} from "./et2_core_wi
|
|||||||
import {et2_inputWidget} from './et2_core_inputWidget'
|
import {et2_inputWidget} from './et2_core_inputWidget'
|
||||||
import {et2_button} from './et2_widget_button'
|
import {et2_button} from './et2_widget_button'
|
||||||
import {et2_textbox, et2_textbox_ro} from "./et2_widget_textbox";
|
import {et2_textbox, et2_textbox_ro} from "./et2_widget_textbox";
|
||||||
import {et2_dialog} from "./et2_widget_dialog";
|
|
||||||
import {egw} from "../jsapi/egw_global";
|
import {egw} from "../jsapi/egw_global";
|
||||||
|
import {Et2Dialog} from "./Et2Dialog/Et2Dialog";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class which implements the "textbox" XET-Tag
|
* Class which implements the "textbox" XET-Tag
|
||||||
@ -248,7 +248,7 @@ export class et2_password extends et2_textbox
|
|||||||
// Need username & password to decrypt
|
// Need username & password to decrypt
|
||||||
let callback = function(button, user_password)
|
let callback = function(button, user_password)
|
||||||
{
|
{
|
||||||
if(button == et2_dialog.CANCEL_BUTTON)
|
if(button == Et2Dialog.CANCEL_BUTTON)
|
||||||
{
|
{
|
||||||
return this.toggle_visibility(false);
|
return this.toggle_visibility(false);
|
||||||
}
|
}
|
||||||
@ -264,17 +264,18 @@ export class et2_password extends et2_textbox
|
|||||||
this.input.attr("type", "textbox");
|
this.input.attr("type", "textbox");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.set_validation_error(this.egw().lang("invalid password"));
|
this.set_validation_error(this.egw().lang("invalid password"));
|
||||||
window.setTimeout(function() {
|
window.setTimeout(function()
|
||||||
this.set_validation_error(false);
|
{
|
||||||
}.bind(this), 2000);
|
this.set_validation_error(false);
|
||||||
}
|
}.bind(this), 2000);
|
||||||
},
|
}
|
||||||
this,true,this
|
},
|
||||||
|
this, true, this
|
||||||
).sendRequest();
|
).sendRequest();
|
||||||
}.bind(this);
|
}.bind(this);
|
||||||
let prompt = et2_dialog.show_prompt(
|
let prompt = Et2Dialog.show_prompt(
|
||||||
callback,
|
callback,
|
||||||
this.egw().lang("Enter your password"),
|
this.egw().lang("Enter your password"),
|
||||||
this.egw().lang("Authenticate")
|
this.egw().lang("Authenticate")
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
|
|
||||||
import {et2_register_widget, WidgetConfig} from "./et2_core_widget";
|
import {et2_register_widget, WidgetConfig} from "./et2_core_widget";
|
||||||
import {ClassWithAttributes} from "./et2_core_inheritance";
|
import {ClassWithAttributes} from "./et2_core_inheritance";
|
||||||
import {et2_dialog} from "./et2_widget_dialog";
|
|
||||||
import {et2_inputWidget} from "./et2_core_inputWidget";
|
import {et2_inputWidget} from "./et2_core_inputWidget";
|
||||||
import type {egw} from "../jsapi/egw_global";
|
import type {egw} from "../jsapi/egw_global";
|
||||||
import {et2_selectbox} from "./et2_widget_selectbox";
|
import {et2_selectbox} from "./et2_widget_selectbox";
|
||||||
@ -417,7 +416,7 @@ export class et2_placeholder_snippet_select extends et2_placeholder_select
|
|||||||
|
|
||||||
button : JQuery;
|
button : JQuery;
|
||||||
submit_callback : any;
|
submit_callback : any;
|
||||||
dialog : et2_dialog;
|
dialog : Et2Dialog;
|
||||||
protected value : any;
|
protected value : any;
|
||||||
|
|
||||||
protected LIST_URL = 'EGroupware\\Api\\Etemplate\\Widget\\Placeholder::ajax_get_placeholders';
|
protected LIST_URL = 'EGroupware\\Api\\Etemplate\\Widget\\Placeholder::ajax_get_placeholders';
|
||||||
|
@ -14,15 +14,20 @@
|
|||||||
et2_core_baseWidget;
|
et2_core_baseWidget;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {et2_createWidget, et2_register_widget, WidgetConfig} from "./et2_core_widget";
|
import {et2_register_widget, WidgetConfig} from "./et2_core_widget";
|
||||||
import {et2_valueWidget} from "./et2_core_valueWidget";
|
import {et2_valueWidget} from "./et2_core_valueWidget";
|
||||||
import {ClassWithAttributes} from "./et2_core_inheritance";
|
import {ClassWithAttributes} from "./et2_core_inheritance";
|
||||||
import {et2_action_object_impl, et2_DOMWidget} from "./et2_core_DOMWidget";
|
import {et2_action_object_impl, et2_DOMWidget} from "./et2_core_DOMWidget";
|
||||||
import {egw} from "../jsapi/egw_global";
|
import {egw} from "../jsapi/egw_global";
|
||||||
import {et2_no_init} from "./et2_core_common";
|
import {et2_no_init} from "./et2_core_common";
|
||||||
import {et2_IResizeable} from "./et2_core_interfaces";
|
import {et2_IResizeable} from "./et2_core_interfaces";
|
||||||
import {et2_dialog} from "./et2_widget_dialog";
|
import {
|
||||||
import {egw_getAppObjectManager, egwActionObject, egwAction, egwActionObjectInterface} from "../egw_action/egw_action.js";
|
egw_getAppObjectManager,
|
||||||
|
egwAction,
|
||||||
|
egwActionObject,
|
||||||
|
egwActionObjectInterface
|
||||||
|
} from "../egw_action/egw_action.js";
|
||||||
|
import {Et2Dialog} from "./Et2Dialog/Et2Dialog";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class which implements the UI of a Portlet
|
* Class which implements the UI of a Portlet
|
||||||
@ -268,21 +273,25 @@ export class et2_portlet extends et2_valueWidget
|
|||||||
*/
|
*/
|
||||||
edit_settings()
|
edit_settings()
|
||||||
{
|
{
|
||||||
let dialog = <et2_dialog>et2_createWidget("dialog", {
|
let dialog = new Et2Dialog(this.egw());
|
||||||
callback: jQuery.proxy(this._process_edit, this),
|
dialog.transformAttributes({
|
||||||
|
callback: this._process_edit.bind(this),
|
||||||
template: this.options.edit_template,
|
template: this.options.edit_template,
|
||||||
value: {
|
value: {
|
||||||
content: this.options.settings
|
content: this.options.settings
|
||||||
},
|
},
|
||||||
buttons: et2_dialog.BUTTONS_OK_CANCEL
|
buttons: Et2Dialog.BUTTONS_OK_CANCEL
|
||||||
},this);
|
});
|
||||||
// Set seperately to avoid translation
|
// Set separately to avoid translation
|
||||||
dialog.set_title(this.egw().lang("Edit") + " " + (this.options.title || ''));
|
dialog.title = this.egw().lang("Edit") + " " + (this.options.title || '');
|
||||||
}
|
}
|
||||||
|
|
||||||
_process_edit(button_id, value)
|
_process_edit(button_id, value)
|
||||||
{
|
{
|
||||||
if(button_id != et2_dialog.OK_BUTTON) return;
|
if(button_id != Et2Dialog.OK_BUTTON)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Save settings - server might reply with new content if the portlet needs an update,
|
// Save settings - server might reply with new content if the portlet needs an update,
|
||||||
@ -343,13 +352,17 @@ export class et2_portlet extends et2_valueWidget
|
|||||||
remove_portlet()
|
remove_portlet()
|
||||||
{
|
{
|
||||||
let self = this;
|
let self = this;
|
||||||
et2_dialog.show_dialog(function(button_id) {
|
Et2Dialog.show_dialog(function(button_id)
|
||||||
if(button_id != et2_dialog.OK_BUTTON) return;
|
{
|
||||||
|
if(button_id != Et2Dialog.OK_BUTTON)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
self._process_edit(button_id, '~remove~');
|
self._process_edit(button_id, '~remove~');
|
||||||
self.getParent().removeChild(self);
|
self.getParent().removeChild(self);
|
||||||
self.destroy();
|
self.destroy();
|
||||||
},this.egw().lang("Remove"), this.options.title,{},
|
}, this.egw().lang("Remove"), this.options.title, {},
|
||||||
et2_dialog.BUTTONS_OK_CANCEL, et2_dialog.QUESTION_MESSAGE
|
Et2Dialog.BUTTONS_OK_CANCEL, Et2Dialog.QUESTION_MESSAGE
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,13 +18,14 @@
|
|||||||
import {et2_DOMWidget} from "./et2_core_DOMWidget";
|
import {et2_DOMWidget} from "./et2_core_DOMWidget";
|
||||||
import {et2_createWidget, et2_register_widget, WidgetConfig} from "./et2_core_widget";
|
import {et2_createWidget, et2_register_widget, WidgetConfig} from "./et2_core_widget";
|
||||||
import {ClassWithAttributes} from "./et2_core_inheritance";
|
import {ClassWithAttributes} from "./et2_core_inheritance";
|
||||||
import {egwActionObject, egw_getObjectManager, egwActionObjectManager} from '../egw_action/egw_action.js';
|
import {egw_getObjectManager, egwActionObject, egwActionObjectManager} from '../egw_action/egw_action.js';
|
||||||
import {et2_dialog} from "./et2_widget_dialog";
|
|
||||||
import {et2_dropdown_button} from "./et2_widget_dropdown_button";
|
import {et2_dropdown_button} from "./et2_widget_dropdown_button";
|
||||||
import {et2_checkbox} from "./et2_widget_checkbox";
|
import {et2_checkbox} from "./et2_widget_checkbox";
|
||||||
import {et2_IInput} from "./et2_core_interfaces";
|
import {et2_IInput} from "./et2_core_interfaces";
|
||||||
import {egw} from "../jsapi/egw_global";
|
import {egw} from "../jsapi/egw_global";
|
||||||
import {egwIsMobile} from "../egw_action/egw_action_common.js";
|
import {egwIsMobile} from "../egw_action/egw_action_common.js";
|
||||||
|
import {Et2Dialog} from "./Et2Dialog/Et2Dialog";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This toolbar gets its contents from its actions
|
* This toolbar gets its contents from its actions
|
||||||
*
|
*
|
||||||
@ -32,7 +33,7 @@ import {egwIsMobile} from "../egw_action/egw_action_common.js";
|
|||||||
*/
|
*/
|
||||||
export class et2_toolbar extends et2_DOMWidget implements et2_IInput
|
export class et2_toolbar extends et2_DOMWidget implements et2_IInput
|
||||||
{
|
{
|
||||||
static readonly _attributes : any = {
|
static readonly _attributes : any = {
|
||||||
"view_range": {
|
"view_range": {
|
||||||
"name": "View range",
|
"name": "View range",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@ -781,8 +782,8 @@ export class et2_toolbar extends et2_DOMWidget implements et2_IInput
|
|||||||
private _admin_settings_dialog(_actions, _default_prefs)
|
private _admin_settings_dialog(_actions, _default_prefs)
|
||||||
{
|
{
|
||||||
let buttons = [
|
let buttons = [
|
||||||
{text: egw.lang("Save"), id:"save"},
|
{label: egw.lang("Save"), id: "save"},
|
||||||
{text: egw.lang("Close"), id:"close"}
|
{label: egw.lang("Close"), id: "close"}
|
||||||
];
|
];
|
||||||
let self = this;
|
let self = this;
|
||||||
let sel_options = {actions:[]};
|
let sel_options = {actions:[]};
|
||||||
@ -805,34 +806,44 @@ export class et2_toolbar extends et2_DOMWidget implements et2_IInput
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
sel_options.actions.push({
|
sel_options.actions.push({
|
||||||
id:key,
|
id: key,
|
||||||
value: key,
|
value: key,
|
||||||
label: _actions[key]['caption'],
|
label: _actions[key]['caption'],
|
||||||
app: self.options.preference_app,
|
app: self.options.preference_app,
|
||||||
icon: _actions[key]['iconUrl']
|
icon: _actions[key]['iconUrl']
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if ((!_default_prefs || _default_prefs.length == 0) && _actions[key]['toolbarDefault']) content.actions.push(key);
|
if((!_default_prefs || _default_prefs.length == 0) && _actions[key]['toolbarDefault'])
|
||||||
}
|
|
||||||
if (_default_prefs && _default_prefs.length > 0) content.actions = _default_prefs;
|
|
||||||
et2_createWidget("dialog",
|
|
||||||
{
|
{
|
||||||
|
content.actions.push(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(_default_prefs && _default_prefs.length > 0)
|
||||||
|
{
|
||||||
|
content.actions = _default_prefs;
|
||||||
|
}
|
||||||
|
let dialog = new Et2Dialog(this.egw());
|
||||||
|
dialog.transformAttributes({
|
||||||
callback: function(_button_id, _value)
|
callback: function(_button_id, _value)
|
||||||
{
|
{
|
||||||
if (_button_id == 'save' && _value)
|
if(_button_id == 'save' && _value)
|
||||||
{
|
{
|
||||||
if (_value.actions)
|
if(_value.actions)
|
||||||
{
|
{
|
||||||
let pref = jQuery.extend({}, self.preference);
|
let pref = jQuery.extend({}, self.preference);
|
||||||
for (let i in pref)
|
for(let i in pref)
|
||||||
{
|
{
|
||||||
pref[i] = true;
|
pref[i] = true;
|
||||||
if (_value.actions.includes(i)) pref[i] = false;
|
if(_value.actions.includes(i))
|
||||||
|
{
|
||||||
|
pref[i] = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
_value.actions = pref;
|
_value.actions = pref;
|
||||||
}
|
}
|
||||||
egw.json('EGroupware\\Api\\Etemplate\\Widget\\Toolbar::ajax_setAdminSettings',
|
egw.json('EGroupware\\Api\\Etemplate\\Widget\\Toolbar::ajax_setAdminSettings',
|
||||||
[_value, self.options.preference_id, self.options.preference_app],function(_result){
|
[_value, self.options.preference_id, self.options.preference_app], function(_result)
|
||||||
|
{
|
||||||
egw.message(_result);
|
egw.message(_result);
|
||||||
}).sendRequest(true);
|
}).sendRequest(true);
|
||||||
}
|
}
|
||||||
@ -841,10 +852,12 @@ export class et2_toolbar extends et2_DOMWidget implements et2_IInput
|
|||||||
buttons: buttons,
|
buttons: buttons,
|
||||||
minWidth: 600,
|
minWidth: 600,
|
||||||
minHeight: 300,
|
minHeight: 300,
|
||||||
value:{content: content, sel_options: sel_options},
|
value: {content: content, sel_options: sel_options},
|
||||||
template: egw.webserverUrl+'/api/templates/default/toolbarAdminSettings.xet?1',
|
template: egw.webserverUrl + '/api/templates/default/toolbarAdminSettings.xet?1',
|
||||||
resizable: false
|
resizable: false
|
||||||
}, et2_dialog._create_parent('api'));
|
}
|
||||||
|
);
|
||||||
|
document.body.appendChild(dialog);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
et2_register_widget(et2_toolbar, ["toolbar"]);
|
et2_register_widget(et2_toolbar, ["toolbar"]);
|
||||||
|
@ -16,13 +16,12 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
|
||||||
import {et2_createWidget} from "./et2_core_widget";
|
|
||||||
import {et2_dialog} from "./et2_widget_dialog";
|
|
||||||
import {egw, egw_get_file_editor_prefered_mimes} from "../jsapi/egw_global";
|
import {egw, egw_get_file_editor_prefered_mimes} from "../jsapi/egw_global";
|
||||||
import {et2_nextmatch} from "./et2_extension_nextmatch";
|
import {et2_nextmatch} from "./et2_extension_nextmatch";
|
||||||
import {ET2_DATAVIEW_STEPSIZE} from "./et2_dataview_controller";
|
import {ET2_DATAVIEW_STEPSIZE} from "./et2_dataview_controller";
|
||||||
import "../jquery/blueimp/js/blueimp-gallery.min.js";
|
import "../jquery/blueimp/js/blueimp-gallery.min.js";
|
||||||
import "../../../vendor/bower-asset/jquery-touchswipe/jquery.touchSwipe.js";
|
import "../../../vendor/bower-asset/jquery-touchswipe/jquery.touchSwipe.js";
|
||||||
|
import {Et2Dialog} from "./Et2Dialog/Et2Dialog";
|
||||||
|
|
||||||
type Constructor<T = {}> = new (...args: any[]) => T;
|
type Constructor<T = {}> = new (...args: any[]) => T;
|
||||||
|
|
||||||
@ -465,14 +464,17 @@ export function expose<TBase extends Constructor>(Base: TBase)
|
|||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
let mediaContent = this.getMedia(_value)[0];
|
let mediaContent = this.getMedia(_value)[0];
|
||||||
et2_createWidget("dialog",{
|
let dialog = new Et2Dialog();
|
||||||
callback: function(_btn, value){
|
dialog.transformAttributes({
|
||||||
if (_btn == et2_dialog.OK_BUTTON)
|
callback: function(_btn, value)
|
||||||
|
{
|
||||||
|
if(_btn == Et2Dialog.OK_BUTTON)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
beforeClose: function(){
|
beforeClose: function()
|
||||||
|
{
|
||||||
|
|
||||||
},
|
},
|
||||||
title: mediaContent.title,
|
title: mediaContent.title,
|
||||||
@ -480,16 +482,17 @@ export function expose<TBase extends Constructor>(Base: TBase)
|
|||||||
minWidth: 350,
|
minWidth: 350,
|
||||||
minHeight: 200,
|
minHeight: 200,
|
||||||
modal: false,
|
modal: false,
|
||||||
position:"right bottom,right-50 bottom-10",
|
position: "right bottom,right-50 bottom-10",
|
||||||
value: {
|
value: {
|
||||||
content: {
|
content: {
|
||||||
src:mediaContent.download_href
|
src: mediaContent.download_href
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
resizable: false,
|
resizable: false,
|
||||||
template: egw.webserverUrl+'/api/templates/default/audio_player.xet',
|
template: egw.webserverUrl + '/api/templates/default/audio_player.xet',
|
||||||
dialogClass:"audio_player"
|
dialogClass: "audio_player"
|
||||||
});
|
});
|
||||||
|
document.body.appendChild(dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -15,12 +15,12 @@
|
|||||||
import {EgwApp} from "../jsapi/egw_app";
|
import {EgwApp} from "../jsapi/egw_app";
|
||||||
import {et2_vfs, et2_vfsPath, et2_vfsSelect} from "./et2_widget_vfs";
|
import {et2_vfs, et2_vfsPath, et2_vfsSelect} from "./et2_widget_vfs";
|
||||||
import {egw} from "../jsapi/egw_global";
|
import {egw} from "../jsapi/egw_global";
|
||||||
import {et2_dialog} from "./et2_widget_dialog";
|
|
||||||
import {et2_file} from "./et2_widget_file";
|
import {et2_file} from "./et2_widget_file";
|
||||||
import {et2_textbox} from "./et2_widget_textbox";
|
import {et2_textbox} from "./et2_widget_textbox";
|
||||||
import {et2_button} from "./et2_widget_button";
|
import {et2_button} from "./et2_widget_button";
|
||||||
import {et2_selectbox} from "./et2_widget_selectbox";
|
import {et2_selectbox} from "./et2_widget_selectbox";
|
||||||
import {et2_checkbox} from "./et2_widget_checkbox";
|
import {et2_checkbox} from "./et2_widget_checkbox";
|
||||||
|
import {Et2Dialog} from "./Et2Dialog/Et2Dialog";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -142,16 +142,25 @@ export class vfsSelectUI extends EgwApp
|
|||||||
if (_data.uploaded[file].confirm && !_data.uploaded[file].confirmed)
|
if (_data.uploaded[file].confirm && !_data.uploaded[file].confirmed)
|
||||||
{
|
{
|
||||||
let buttons = [
|
let buttons = [
|
||||||
{text: this.egw.lang("Yes"), id: "overwrite", class: "ui-priority-primary", "default": true, image: 'check'},
|
{
|
||||||
{text: this.egw.lang("Rename"), id:"rename", image: 'edit'},
|
label: this.egw.lang("Yes"),
|
||||||
{text: this.egw.lang("Cancel"), id:"cancel"}
|
id: "overwrite",
|
||||||
|
class: "ui-priority-primary",
|
||||||
|
"default": true,
|
||||||
|
image: 'check'
|
||||||
|
},
|
||||||
|
{label: this.egw.lang("Rename"), id: "rename", image: 'edit'},
|
||||||
|
{label: this.egw.lang("Cancel"), id: "cancel"}
|
||||||
];
|
];
|
||||||
if (_data.uploaded[file].confirm === "is_dir")
|
if(_data.uploaded[file].confirm === "is_dir")
|
||||||
|
{
|
||||||
buttons.shift();
|
buttons.shift();
|
||||||
let dialog = et2_dialog.show_prompt(function(_button_id, _value) {
|
}
|
||||||
|
let dialog = Et2Dialog.show_prompt(function(_button_id, _value)
|
||||||
|
{
|
||||||
let uploaded = {};
|
let uploaded = {};
|
||||||
uploaded[this.my_data.file] = this.my_data.data;
|
uploaded[this.my_data.file] = this.my_data.data;
|
||||||
switch (_button_id)
|
switch(_button_id)
|
||||||
{
|
{
|
||||||
case "overwrite":
|
case "overwrite":
|
||||||
uploaded[this.my_data.file].confirmed = true;
|
uploaded[this.my_data.file].confirmed = true;
|
||||||
@ -199,16 +208,18 @@ export class vfsSelectUI extends EgwApp
|
|||||||
createdir(action, selected)
|
createdir(action, selected)
|
||||||
{
|
{
|
||||||
let self = this;
|
let self = this;
|
||||||
et2_dialog.show_prompt(function(button, dir){
|
Et2Dialog.show_prompt(function(button, dir)
|
||||||
if (button && dir)
|
{
|
||||||
|
if(button && dir)
|
||||||
{
|
{
|
||||||
let path = self.get_path();
|
let path = self.get_path();
|
||||||
self.egw.json('EGroupware\\Api\\Etemplate\\Widget\\Vfs::ajax_create_dir', [dir, path], function(msg){
|
self.egw.json('EGroupware\\Api\\Etemplate\\Widget\\Vfs::ajax_create_dir', [dir, path], function(msg)
|
||||||
|
{
|
||||||
self.egw.message(msg);
|
self.egw.message(msg);
|
||||||
self.change_dir((path == '/' ? '' : path)+'/'+ dir);
|
self.change_dir((path == '/' ? '' : path) + '/' + dir);
|
||||||
}).sendRequest(false);
|
}).sendRequest(false);
|
||||||
}
|
}
|
||||||
},this.egw.lang('New directory'),this.egw.lang('Create directory'));
|
}, this.egw.lang('New directory'), this.egw.lang('Create directory'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2692,6 +2692,12 @@ div.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset button.right {
|
|||||||
padding-bottom: 10px;
|
padding-bottom: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.et2_prompt .dialog_icon {
|
||||||
|
margin-right: 2ex;
|
||||||
|
vertical-align: middle;
|
||||||
|
align-self: center;
|
||||||
|
}
|
||||||
|
|
||||||
.et2_prompt #value {
|
.et2_prompt #value {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
@ -9,15 +9,23 @@
|
|||||||
<column width="300px"/>
|
<column width="300px"/>
|
||||||
</columns>
|
</columns>
|
||||||
<rows>
|
<rows>
|
||||||
<row>
|
<row>
|
||||||
<description value="default visible actions" label="%s:"/>
|
<description value="default visible actions" label="%s:"/>
|
||||||
<taglist id="actions" editModeEnabled="false" allowFreeEntries="false" autocomplete_url=' ' class="et2_fullWidth"/>
|
<taglist id="actions" editModeEnabled="false" allowFreeEntries="false" autocomplete_url=' '
|
||||||
</row>
|
class="et2_fullWidth"/>
|
||||||
<row>
|
</row>
|
||||||
<description value="reset all to default" label="%s:"/>
|
<row>
|
||||||
<checkbox id="reset" statustext="This will reset toolbar preferences for all users and set them to configured default prefs."/>
|
<description value="reset all to default" label="%s:"/>
|
||||||
</row>
|
<checkbox id="reset"
|
||||||
</rows>
|
statustext="This will reset toolbar preferences for all users and set them to configured default prefs."/>
|
||||||
</grid>
|
</row>
|
||||||
</template>
|
</rows>
|
||||||
|
</grid>
|
||||||
|
<styles>
|
||||||
|
#toolbarAdminSettings {
|
||||||
|
min-width: 600px;
|
||||||
|
min-height: 300px;
|
||||||
|
}
|
||||||
|
</styles>
|
||||||
|
</template>
|
||||||
</overlay>
|
</overlay>
|
||||||
|
Loading…
Reference in New Issue
Block a user